JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
refactored Sanders code somewhat
authorarg@10ksloc.org <unknown>
Wed, 19 Jul 2006 11:52:31 +0000 (13:52 +0200)
committerarg@10ksloc.org <unknown>
Wed, 19 Jul 2006 11:52:31 +0000 (13:52 +0200)
client.c
dwm.h
event.c

index 52e623a..b1328d4 100644 (file)
--- a/client.c
+++ b/client.c
@@ -315,9 +315,9 @@ resize(Client *c, Bool inc, Corner sticky)
                *c->w = c->maxw;
        if(c->maxh && *c->h > c->maxh)
                *c->h = c->maxh;
-       if(sticky == TopRight || sticky == BottomRight)
+       if(sticky == TopRight || sticky == BotRight)
                *c->x = right - *c->w;
-       if(sticky == BottomLeft || sticky == BottomRight)
+       if(sticky == BotLeft || sticky == BotRight)
                *c->y = bottom - *c->h;
        resizetitle(c);
        XSetWindowBorderWidth(dpy, c->win, 1);
diff --git a/dwm.h b/dwm.h
index d3138be..5a714f2 100644 (file)
--- a/dwm.h
+++ b/dwm.h
@@ -25,9 +25,9 @@ enum { Tscratch, Tdev, Twww, Twork, TLast };
 /********** CUSTOMIZE **********/
 
 typedef union Arg Arg;
+typedef struct Client Client;
 typedef enum Corner Corner;
 typedef struct DC DC;
-typedef struct Client Client;
 typedef struct Fnt Fnt;
 typedef struct Key Key;
 typedef struct Rule Rule;
@@ -44,7 +44,7 @@ enum { WMProtocols, WMDelete, WMLast };
 /* cursor */
 enum { CurNormal, CurResize, CurMove, CurLast };
 
-enum Corner { TopLeft, TopRight, BottomLeft, BottomRight };
+enum Corner { TopLeft, TopRight, BotLeft, BotRight };
 
 struct Fnt {
        int ascent;
diff --git a/event.c b/event.c
index 9d69373..e4dfad1 100644 (file)
--- a/event.c
+++ b/event.c
@@ -114,17 +114,10 @@ resizemouse(Client *c)
                        *c->h = abs(ocy - ev.xmotion.y);
                        *c->x = (ocx <= ev.xmotion.x) ? ocx : ocx - *c->w;
                        *c->y = (ocy <= ev.xmotion.y) ? ocy : ocy - *c->h;
-                       if(ocx <= ev.xmotion.x) {
-                               if(ocy <= ev.xmotion.y)
-                                       sticky = TopLeft;
-                               else
-                                       sticky = BottomLeft;
-                       } else {
-                               if(ocy <= ev.xmotion.y)
-                                       sticky = TopRight;
-                               else
-                                       sticky = BottomRight;
-                       }
+                       if(ocx <= ev.xmotion.x)
+                               sticky = (ocy <= ev.xmotion.y) ? TopLeft : BotLeft;
+                       else
+                               sticky = (ocy <= ev.xmotion.y) ? TopRight : BotRight;
                        resize(c, True, sticky);
                        break;
                case ButtonRelease: