wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

commit ee0dda360673f2c0af7288ef133d39fa86cbb754
parent eeb62d2041868a7d2b6566e01d18ff5cd0664c01
Author: Kris Maglione <bsdaemon@wmii.de>
Date:   Wed, 31 May 2006 13:33:54 -0400

Return the mouse pointer after warping it to move/resize. Fair's fair.


Diffstat:
cmd/wm/mouse.c | 14++++++++++----
config.mk | 2+-
2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/cmd/wm/mouse.c b/cmd/wm/mouse.c @@ -149,6 +149,7 @@ void do_mouse_resize(Client *c, BlitzAlign align) { int px, py, ox, oy, i, di; + float rx, ry; Window dummy; XEvent ev; unsigned int num = 0; @@ -160,6 +161,10 @@ do_mouse_resize(Client *c, BlitzAlign align) XRectangle origin = frect; XPoint pt; + XQueryPointer(dpy, c->framewin, &dummy, &dummy, &i, &i, &ox, &oy, &di); + rx = (float)ox / frect.width; + ry = (float)oy / frect.height; + if (!aidx || align != CENTER) { px = ox = frect.width / 2; py = oy = frect.height / 2; @@ -173,14 +178,12 @@ do_mouse_resize(Client *c, BlitzAlign align) ox -= px; XWarpPointer(dpy, None, c->framewin, 0, 0, 0, 0, ox, oy); - XTranslateCoordinates(dpy, c->framewin, root, ox, oy, &ox, &oy, &dummy); } - else - XQueryPointer(dpy, c->framewin, &dummy, &dummy, &ox, &oy, &i, &i, &di); + XTranslateCoordinates(dpy, c->framewin, root, ox, oy, &ox, &oy, &dummy); pt.x = ox; pt.y = oy; - XSync(dpy, False); + XSync(dpy, False); if(XGrabPointer(dpy, c->framewin, False, MouseMask, GrabModeAsync, GrabModeAsync, None, cursor[CurResize], CurrentTime) != GrabSuccess) return; @@ -201,6 +204,9 @@ do_mouse_resize(Client *c, BlitzAlign align) XUngrabServer(dpy); XUngrabPointer(dpy, CurrentTime); XSync(dpy, False); + + XWarpPointer(dpy, None, c->framewin, 0, 0, 0, 0, + frect.width * rx, frect.height * ry); return; break; case MotionNotify: diff --git a/config.mk b/config.mk @@ -1,7 +1,7 @@ # Customize to fit your system # paths -PREFIX = /usr/local +PREFIX = /usr/home/kris/wmii-dev/inst/ CONFPREFIX = ${PREFIX}/etc MANPREFIX = ${PREFIX}/share/man