From 58611367f2f9432b040798b2fa7f7048c3ff1ad0 Mon Sep 17 00:00:00 2001 From: Ivan Kanakarakis Date: Sun, 22 Jul 2012 17:02:10 +0300 Subject: rework mousemotion function - return if pointer is not above the current window --- monsterwm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/monsterwm.c b/monsterwm.c index 96eb49e..7fae1d7 100644 --- a/monsterwm.c +++ b/monsterwm.c @@ -720,12 +720,14 @@ void mousemotion(const Arg *arg) { XEvent ev; if (!d->curr || !XGetWindowAttributes(dis, d->curr->win, &wa)) return; + + if (arg->i == RESIZE) XWarpPointer(dis, d->curr->win, d->curr->win, 0, 0, 0, 0, wa.width, wa.height); + int rx, ry, c, xw, yh; unsigned int v; Window w; + if (!XQueryPointer(dis, root, &w, &w, &rx, &ry, &c, &c, &v) || w != d->curr->win) return; + if (XGrabPointer(dis, root, False, BUTTONMASK|PointerMotionMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime) != GrabSuccess) return; - if (arg->i == RESIZE) XWarpPointer(dis, None, d->curr->win, 0, 0, 0, 0, wa.width, wa.height); - int rx, ry, c, xw, yh; unsigned int m; Window w; - XQueryPointer(dis, root, &w, &w, &rx, &ry, &c, &c, &m); if (!d->curr->isfloat && !d->curr->istrans) { d->curr->isfloat = True; tile(d); focus(d->curr, d); } -- cgit v1.3.1