diff options
| author | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2012-06-08 20:51:34 +0300 |
|---|---|---|
| committer | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2012-06-09 12:59:40 +0300 |
| commit | ea37d17e055f3327ff4979902147ce239f3b44e7 (patch) | |
| tree | c38d1ae812238675f71d335febaf3b09a70bb60b /monsterwm.c | |
| parent | 5b989f87d264274aa3c06f423f085c0c1852fedd (diff) | |
wrap mouse pointer only on resize
Diffstat (limited to 'monsterwm.c')
| -rw-r--r-- | monsterwm.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/monsterwm.c b/monsterwm.c index 212917b..78aecb8 100644 --- a/monsterwm.c +++ b/monsterwm.c @@ -481,13 +481,13 @@ void maprequest(XEvent *e) { void mousemotion(const Arg *arg) { if (!current) return; static XWindowAttributes wa; - XGetWindowAttributes(dis, current->win, &wa); + if (!XGetWindowAttributes(dis, current->win, &wa)) return; if (XGrabPointer(dis, root, False, BUTTONMASK|PointerMotionMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime) != GrabSuccess) return; - int x, y, z, xw, yh; unsigned int v; Window w; - XWarpPointer(dis, None, current->win, 0, 0, 0, 0, wa.width, wa.height); - XQueryPointer(dis, root, &w, &w, &x, &y, &z, &z, &v); + if (arg->i == RESIZE) XWarpPointer(dis, None, current->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 (current->isfullscrn) setfullscreen(current, False); if (!current->isfloating) current->isfloating = True; @@ -501,8 +501,8 @@ void mousemotion(const Arg *arg) { events[ev.type](&ev); break; case MotionNotify: - xw = (arg->i == MOVE ? wa.x:wa.width) + ev.xmotion.x - x; - yh = (arg->i == MOVE ? wa.y:wa.height) + ev.xmotion.y - y; + xw = (arg->i == MOVE ? wa.x:wa.width) + ev.xmotion.x - rx; + yh = (arg->i == MOVE ? wa.y:wa.height) + ev.xmotion.y - ry; if (arg->i == RESIZE) XResizeWindow(dis, current->win, xw>MINWSZ ? xw:wa.width, yh>MINWSZ ? yh:wa.height); else if (arg->i == MOVE) XMoveWindow(dis, current->win, xw, yh); |
