Krolyxon
Commit 5367b75

Branches

Refs →

nsxiv5367b75

(Un)mark thumbnails while holding Button3 down

Author
Bert Münnich
Date
2018-06-09 13:18 +0200
Parent
87a1ace
Commit
5367b75867ccee99dcc5730bf04e3f3b10b4138d

+13 −4

1 file changed

  1. M main.c +13 −4
M main.c View
@@ -663,10 +663,19 @@ void on_buttonpress(XButtonEvent *bev)
663663 break;
664664 case Button3:
665665 if ((sel = tns_translate(&tns, bev->x, bev->y)) >= 0) {
666− files[sel].flags ^= FF_MARK;
667− markcnt += files[sel].flags & FF_MARK ? 1 : -1;
668− tns_mark(&tns, sel, !!(files[sel].flags & FF_MARK));
669− redraw();
666+ bool on = !(files[sel].flags & FF_MARK);
667+ XEvent e;
668+
669+ for (;;) {
670+ if (sel >= 0 && mark_image(sel, on))
671+ redraw();
672+ XMaskEvent(win.env.dpy,
673+ ButtonPressMask | ButtonReleaseMask | PointerMotionMask, &e);
674+ if (e.type == ButtonPress || e.type == ButtonRelease)
675+ break;
676+ while (XCheckTypedEvent(win.env.dpy, MotionNotify, &e));
677+ sel = tns_translate(&tns, e.xbutton.x, e.xbutton.y);
678+ }
670679 }
671680 break;
672681 case Button4: