JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
applied Jukka's sizeof K&R compliance patch, applied Manuels' last-line printage...
[dwm.git] / event.c
diff --git a/event.c b/event.c
index f0e88d0..edfcc52 100644 (file)
--- a/event.c
+++ b/event.c
@@ -48,14 +48,14 @@ movemouse(Client *c) {
                        XSync(dpy, False);
                        c->x = ocx + (ev.xmotion.x - x1);
                        c->y = ocy + (ev.xmotion.y - y1);
-                       if(abs(c->x) < sx + SNAP)
-                               c->x = sx;
-                       if(abs(c->y) < sy + bh + SNAP)
-                               c->y = sy + bh;
-                       if(c->x + c->w > sx + sw - SNAP)
-                               c->x = sw - c->w - 2 * BORDERPX;
-                       if(c->y + c->h > sy + sh - SNAP)
-                               c->y = sh - c->h - 2 * BORDERPX;
+                       if(abs(wax + c->x) < SNAP)
+                               c->x = wax;
+                       else if(abs((wax + waw) - (c->x + c->w)) < SNAP)
+                               c->x = wax + waw - c->w - 2 * BORDERPX;
+                       if(abs(way - c->y) < SNAP)
+                               c->y = way;
+                       else if(abs((way + wah) - (c->y + c->h)) < SNAP)
+                               c->y = way + wah - c->h - 2 * BORDERPX;
                        resize(c, False, TopLeft);
                        break;
                }
@@ -244,7 +244,7 @@ expose(XEvent *e) {
 
 static void
 keypress(XEvent *e) {
-       static unsigned int len = sizeof(key) / sizeof(key[0]);
+       static unsigned int len = sizeof key / sizeof key[0];
        unsigned int i;
        KeySym keysym;
        XKeyEvent *ev = &e->xkey;
@@ -355,7 +355,7 @@ void (*handler[LASTEvent]) (XEvent *) = {
 
 void
 grabkeys(void) {
-       static unsigned int len = sizeof(key) / sizeof(key[0]);
+       static unsigned int len = sizeof key / sizeof key[0];
        unsigned int i;
        KeyCode code;