diff options
author | Bert Münnich <ber.t@posteo.de> | 2018-06-09 13:18:18 +0200 |
---|---|---|
committer | Bert Münnich <ber.t@posteo.de> | 2018-06-09 13:18:18 +0200 |
commit | 5367b75867ccee99dcc5730bf04e3f3b10b4138d (patch) | |
tree | 157cf7ec8342fd7a440536b72de3fb0f90db0412 /main.c | |
parent | 87a1ace8a1cb83132f791cb19c3fa31b9b6e3f3f (diff) |
(Un)mark thumbnails while holding Button3 down
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -663,10 +663,19 @@ void on_buttonpress(XButtonEvent *bev) break; case Button3: if ((sel = tns_translate(&tns, bev->x, bev->y)) >= 0) { - files[sel].flags ^= FF_MARK; - markcnt += files[sel].flags & FF_MARK ? 1 : -1; - tns_mark(&tns, sel, !!(files[sel].flags & FF_MARK)); - redraw(); + bool on = !(files[sel].flags & FF_MARK); + XEvent e; + + for (;;) { + if (sel >= 0 && mark_image(sel, on)) + redraw(); + XMaskEvent(win.env.dpy, + ButtonPressMask | ButtonReleaseMask | PointerMotionMask, &e); + if (e.type == ButtonPress || e.type == ButtonRelease) + break; + while (XCheckTypedEvent(win.env.dpy, MotionNotify, &e)); + sel = tns_translate(&tns, e.xbutton.x, e.xbutton.y); + } } break; case Button4: |