[dwm] Cleanup movemouse()

From: Martin Hurton <martin.hurton_AT_gmail.com>
Date: Mon, 18 Aug 2008 18:34:52 +0200

The patch below gets rid of two superfluous assignments and
moves the function's exit point at the end of its body.
Comments are welcome.

Cheers,
/Martin

diff -r 5be4e277ed7c dwm.c
--- a/dwm.c Mon Aug 18 10:22:46 2008 +0100
+++ b/dwm.c Mon Aug 18 17:45:07 2008 +0200
@@ -961,18 +961,15 @@
         if(!(c = sel))
                 return;
         restack();
- ocx = nx = c->x;
- ocy = ny = c->y;
+ ocx = c->x;
+ ocy = c->y;
         if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
         None, cursor[CurMove], CurrentTime) != GrabSuccess)
                 return;
         XQueryPointer(dpy, root, &dummy, &dummy, &x, &y, &di, &di, &dui);
- for(;;) {
+ do {
                 XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
                 switch (ev.type) {
- case ButtonRelease:
- XUngrabPointer(dpy, CurrentTime);
- return;
                 case ConfigureRequest:
                 case Expose:
                 case MapRequest:
@@ -999,7 +996,8 @@
                                 resize(c, nx, ny, c->w, c->h, False);
                         break;
                 }
- }
+ } while(ev.type != ButtonRelease);
+ XUngrabPointer(dpy, CurrentTime);
 }
 
 Client *
Received on Mon Aug 18 2008 - 16:34:52 UTC

This archive was generated by hypermail 2.2.0 : Mon Aug 18 2008 - 16:36:04 UTC