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

This commit is contained in:
Kris Maglione 2006-05-31 13:33:54 -04:00
parent eeb62d2041
commit ee0dda3606
2 changed files with 11 additions and 5 deletions

View File

@ -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:

View File

@ -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