aewl

diff mouse.c @ 19:b5510d0c6d43

added basic mouse support (actually we don't need more)
author Anselm R. Garbe <garbeam@wmii.de>
date Tue, 11 Jul 2006 21:41:49 +0200
parents 1efa34c6e1b6
children 4560e0882c1d
line diff
     1.1 --- a/mouse.c	Tue Jul 11 21:24:10 2006 +0200
     1.2 +++ b/mouse.c	Tue Jul 11 21:41:49 2006 +0200
     1.3 @@ -42,7 +42,7 @@
     1.4  
     1.5  	old_cx = c->r[RFloat].x;
     1.6  	old_cy = c->r[RFloat].y;
     1.7 -	if(XGrabPointer(dpy, c->win, False, MouseMask, GrabModeAsync, GrabModeAsync,
     1.8 +	if(XGrabPointer(dpy, root, False, MouseMask, GrabModeAsync, GrabModeAsync,
     1.9  				None, cursor[CurResize], CurrentTime) != GrabSuccess)
    1.10  		return;
    1.11  	XGrabServer(dpy);
    1.12 @@ -55,10 +55,12 @@
    1.13  		case MotionNotify:
    1.14  			XUngrabServer(dpy);
    1.15  			mmatch(c, old_cx, old_cy, ev.xmotion.x, ev.xmotion.y);
    1.16 -			resize(c);
    1.17 +			XResizeWindow(dpy, c->win, c->r[RFloat].width, c->r[RFloat].height);
    1.18  			XGrabServer(dpy);
    1.19  			break;
    1.20  		case ButtonRelease:
    1.21 +			resize(c);
    1.22 +			XUngrabServer(dpy);
    1.23  			XUngrabPointer(dpy, CurrentTime);
    1.24  			return;
    1.25  		}
    1.26 @@ -75,7 +77,7 @@
    1.27  
    1.28  	old_cx = c->r[RFloat].x;
    1.29  	old_cy = c->r[RFloat].y;
    1.30 -	if(XGrabPointer(dpy, c->win, False, MouseMask, GrabModeAsync, GrabModeAsync,
    1.31 +	if(XGrabPointer(dpy, root, False, MouseMask, GrabModeAsync, GrabModeAsync,
    1.32  				None, cursor[CurMove], CurrentTime) != GrabSuccess)
    1.33  		return;
    1.34  	XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui);
    1.35 @@ -88,10 +90,12 @@
    1.36  			XUngrabServer(dpy);
    1.37  			c->r[RFloat].x = old_cx + (ev.xmotion.x - x1);
    1.38  			c->r[RFloat].y = old_cy + (ev.xmotion.y - y1);
    1.39 -			resize(c);
    1.40 +			XMoveResizeWindow(dpy, c->win, c->r[RFloat].x, c->r[RFloat].y,
    1.41 +					c->r[RFloat].width, c->r[RFloat].height);
    1.42  			XGrabServer(dpy);
    1.43  			break;
    1.44  		case ButtonRelease:
    1.45 +			resize(c);
    1.46  			XUngrabServer(dpy);
    1.47  			XUngrabPointer(dpy, CurrentTime);
    1.48  			return;