summaryrefslogtreecommitdiff
path: root/xnap.c
diff options
context:
space:
mode:
authoruint <abhinav.prsai@gmail.com>2025-12-15 18:19:07 +0000
committeruint <abhinav.prsai@gmail.com>2025-12-15 18:19:07 +0000
commit835ac229702417117ad58715d291f0850efc0fcb (patch)
treee77cac5ac31f5557d1758c4736b62ed5f90fea34 /xnap.c
parent1ef9f24c212096e940218cd7787dd140234bb035 (diff)
wait only for latest motion eventsHEADmaster
Diffstat (limited to 'xnap.c')
-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();