summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xnap.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/xnap.c b/xnap.c
index c8da443..80bffe7 100644
--- a/xnap.c
+++ b/xnap.c
@@ -254,6 +254,9 @@ void run(void)
p.y0 = p.y1 = p.ly = ev.xbutton.y_root;
}
else if (ev.type == MotionNotify && p.sel) { /* dragging selection */
+ /* keep only latest motion ev */
+ while (XCheckTypedEvent(dpy, MotionNotify, &ev));
+
/* remove old rectangle */
drawrect();
@@ -269,6 +272,7 @@ void run(void)
else if (ev.type == ButtonRelease && p.sel && b == Button1) { /* release selection */
/* remove final rectangle */
drawrect();
+ XSync(dpy, False);
p.sel = False;
capsel();