about summary refs log tree commit diff stats
path: root/mouse.c
diff options
context:
space:
mode:
authorAnselm R. Garbe <garbeam@wmii.de>2006-07-12 15:17:22 +0200
committerAnselm R. Garbe <garbeam@wmii.de>2006-07-12 15:17:22 +0200
commitdfd84f9bf3b9d949412a73bc62a43109b340d395 (patch)
treeebeac582951e2ef574f50018298c4bc928849d64 /mouse.c
parent7696c89c90c926f6371b1ee3ec1b13dd2414aa40 (diff)
downloaddwm-dfd84f9bf3b9d949412a73bc62a43109b340d395.tar.gz
simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Diffstat (limited to 'mouse.c')
-rw-r--r--mouse.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/mouse.c b/mouse.c
index 577f23c..896d6b0 100644
--- a/mouse.c
+++ b/mouse.c
@@ -45,21 +45,21 @@ mresize(Client *c)
 	if(XGrabPointer(dpy, root, False, MouseMask, GrabModeAsync, GrabModeAsync,
 				None, cursor[CurResize], CurrentTime) != GrabSuccess)
 		return;
-	XGrabServer(dpy);
 	XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w, c->h);
 	for(;;) {
-		XMaskEvent(dpy, MouseMask, &ev);
+		XMaskEvent(dpy, MouseMask | ExposureMask, &ev);
 		switch(ev.type) {
 		default: break;
+		case Expose:
+			handler[Expose](&ev);
+			break;
 		case MotionNotify:
-			XUngrabServer(dpy);
+			XFlush(dpy);
 			mmatch(c, old_cx, old_cy, ev.xmotion.x, ev.xmotion.y);
 			XResizeWindow(dpy, c->win, c->w, c->h);
-			XGrabServer(dpy);
 			break;
 		case ButtonRelease:
 			resize(c);
-			XUngrabServer(dpy);
 			XUngrabPointer(dpy, CurrentTime);
 			return;
 		}
@@ -80,21 +80,21 @@ mmove(Client *c)
 				None, cursor[CurMove], CurrentTime) != GrabSuccess)
 		return;
 	XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui);
-	XGrabServer(dpy);
 	for(;;) {
-		XMaskEvent(dpy, MouseMask, &ev);
+		XMaskEvent(dpy, MouseMask | ExposureMask, &ev);
 		switch (ev.type) {
 		default: break;
+		case Expose:
+			handler[Expose](&ev);
+			break;
 		case MotionNotify:
-			XUngrabServer(dpy);
+			XFlush(dpy);
 			c->x = old_cx + (ev.xmotion.x - x1);
 			c->y = old_cy + (ev.xmotion.y - y1);
 			XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
-			XGrabServer(dpy);
 			break;
 		case ButtonRelease:
 			resize(c);
-			XUngrabServer(dpy);
 			XUngrabPointer(dpy, CurrentTime);
 			return;
 		}