From 835ac229702417117ad58715d291f0850efc0fcb Mon Sep 17 00:00:00 2001 From: uint Date: Mon, 15 Dec 2025 18:19:07 +0000 Subject: wait only for latest motion events --- xnap.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'xnap.c') 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(); -- cgit v1.2.3