aewl
diff mouse.c @ 26:e8f627998d6f
simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
author | Anselm R. Garbe <garbeam@wmii.de> |
---|---|
date | Wed, 12 Jul 2006 15:17:22 +0200 |
parents | 4560e0882c1d |
children | 386649deb651 |
line diff
1.1 --- a/mouse.c Wed Jul 12 00:53:11 2006 +0200 1.2 +++ b/mouse.c Wed Jul 12 15:17:22 2006 +0200 1.3 @@ -45,21 +45,21 @@ 1.4 if(XGrabPointer(dpy, root, False, MouseMask, GrabModeAsync, GrabModeAsync, 1.5 None, cursor[CurResize], CurrentTime) != GrabSuccess) 1.6 return; 1.7 - XGrabServer(dpy); 1.8 XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w, c->h); 1.9 for(;;) { 1.10 - XMaskEvent(dpy, MouseMask, &ev); 1.11 + XMaskEvent(dpy, MouseMask | ExposureMask, &ev); 1.12 switch(ev.type) { 1.13 default: break; 1.14 + case Expose: 1.15 + handler[Expose](&ev); 1.16 + break; 1.17 case MotionNotify: 1.18 - XUngrabServer(dpy); 1.19 + XFlush(dpy); 1.20 mmatch(c, old_cx, old_cy, ev.xmotion.x, ev.xmotion.y); 1.21 XResizeWindow(dpy, c->win, c->w, c->h); 1.22 - XGrabServer(dpy); 1.23 break; 1.24 case ButtonRelease: 1.25 resize(c); 1.26 - XUngrabServer(dpy); 1.27 XUngrabPointer(dpy, CurrentTime); 1.28 return; 1.29 } 1.30 @@ -80,21 +80,21 @@ 1.31 None, cursor[CurMove], CurrentTime) != GrabSuccess) 1.32 return; 1.33 XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui); 1.34 - XGrabServer(dpy); 1.35 for(;;) { 1.36 - XMaskEvent(dpy, MouseMask, &ev); 1.37 + XMaskEvent(dpy, MouseMask | ExposureMask, &ev); 1.38 switch (ev.type) { 1.39 default: break; 1.40 + case Expose: 1.41 + handler[Expose](&ev); 1.42 + break; 1.43 case MotionNotify: 1.44 - XUngrabServer(dpy); 1.45 + XFlush(dpy); 1.46 c->x = old_cx + (ev.xmotion.x - x1); 1.47 c->y = old_cy + (ev.xmotion.y - y1); 1.48 XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); 1.49 - XGrabServer(dpy); 1.50 break; 1.51 case ButtonRelease: 1.52 resize(c); 1.53 - XUngrabServer(dpy); 1.54 XUngrabPointer(dpy, CurrentTime); 1.55 return; 1.56 }