aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBert Münnich <ber.t@posteo.de>2018-06-09 13:18:18 +0200
committerBert Münnich <ber.t@posteo.de>2018-06-09 13:18:18 +0200
commit5367b75867ccee99dcc5730bf04e3f3b10b4138d (patch)
tree157cf7ec8342fd7a440536b72de3fb0f90db0412
parent87a1ace8a1cb83132f791cb19c3fa31b9b6e3f3f (diff)
(Un)mark thumbnails while holding Button3 down
-rw-r--r--main.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/main.c b/main.c
index 190ca29..c6da126 100644
--- a/main.c
+++ b/main.c
@@ -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: