From 2a2d268cb0127d5b03753016a3341b571124fdb2 Mon Sep 17 00:00:00 2001 From: okan Date: Wed, 10 Apr 2024 19:38:22 +0000 Subject: [PATCH] Grab the pointer against the root window instead of the client we're attempting to move and/or resize; prevents XNextEvent() from blocking on a client that might have been moved to a Withdrawn state. behavior noticed and reported by zenitds at proton.me - thanks! --- kbfunc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kbfunc.c b/kbfunc.c index d858b7b..b73133b 100644 --- a/kbfunc.c +++ b/kbfunc.c @@ -162,7 +162,7 @@ kbfunc_client_move_mb(void *ctx, struct cargs *cargs) client_ptr_inbound(cc, 1); - if (XGrabPointer(X_Dpy, cc->win, False, MOUSEMASK, + if (XGrabPointer(X_Dpy, sc->rootwin, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, None, Conf.cursor[CF_MOVE], CurrentTime) != GrabSuccess) return; @@ -251,7 +251,7 @@ kbfunc_client_resize_mb(void *ctx, struct cargs *cargs) xu_ptr_set(cc->win, cc->geom.w, cc->geom.h); - if (XGrabPointer(X_Dpy, cc->win, False, MOUSEMASK, + if (XGrabPointer(X_Dpy, sc->rootwin, False, MOUSEMASK, GrabModeAsync, GrabModeAsync, None, Conf.cursor[CF_RESIZE], CurrentTime) != GrabSuccess) return; @@ -267,8 +267,8 @@ kbfunc_client_resize_mb(void *ctx, struct cargs *cargs) continue; ltime = ev.xmotion.time; - cc->geom.w = ev.xmotion.x; - cc->geom.h = ev.xmotion.y; + cc->geom.w = ev.xmotion.x - cc->geom.x - cc->bwidth; + cc->geom.h = ev.xmotion.y - cc->geom.y - cc->bwidth; client_apply_sizehints(cc); client_resize(cc, 1); screen_prop_win_draw(sc,