aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kanakarakis <ivan.kanak@gmail.com>2012-07-22 17:02:10 +0300
committerIvan Kanakarakis <ivan.kanak@gmail.com>2012-07-22 17:02:10 +0300
commit58611367f2f9432b040798b2fa7f7048c3ff1ad0 (patch)
treef58dcb30fcce9f0f04be828ba4d38afbbe895bc9
parent04fbd83159f51933975b639b68e512b796d8b0c1 (diff)
rework mousemotion function - return if pointer is not above the current window
-rw-r--r--monsterwm.c8
1 files 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); }