dwm

my fork of dwm
Index Commits Files Refs README LICENSE
commit b003a35fde6e83bd65efa6d195d96a835fd457ea
parent df1a0f9445d4f14e3b5a464a577018f755ea1b5f
Author: arg@mig29 <unknown>
Date:   Thu, 16 Nov 2006 14:40:57 +0100

applied Gottox' windowarea patch
Diffstat:
Mdwm.h | 1+
Mevent.c | 16++++++++--------
Mmain.c | 7++++++-
Mview.c | 40+++++++++++++++++-----------------------
4 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/dwm.h b/dwm.h
@@ -96,6 +96,7 @@ extern const char *tags[];			/* all tags */
 extern char stext[1024];            /* status text */
 extern int bx, by, bw, bh, bmw;            /* bar geometry, bar mode label width */
 extern int screen, sx, sy, sw, sh;        /* screen geometry */
+extern int wax, way, wah, waw;            /* windowarea geometry */
 extern unsigned int master, ntags, numlockmask;    /* master percent, number of tags, dynamic lock mask */
 extern void (*handler[LASTEvent])(XEvent *);    /* event handler */
 extern void (*arrange)(void);            /* arrange function, indicates mode  */
diff --git 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(sx + c->x) < SNAP)
-                c->x = sx;
-            else if(abs((sx + sw) - (c->x + c->w)) < SNAP)
-                c->x = sw - c->w - 2 * BORDERPX;
-            if(abs((sy + bh) - c->y) < SNAP)
-                c->y = sy + bh;
-            else if(abs((sy + sh) - (c->y + c->h)) < 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;
         }
diff --git a/main.c b/main.c
@@ -18,7 +18,7 @@
 
 char stext[1024];
 Bool *seltag;
-int bx, by, bw, bh, bmw, masterd, screen, sx, sy, sw, sh;
+int bx, by, bw, bh, bmw, masterd, screen, sx, sy, sw, sh, wax, way, waw, wah;
 unsigned int master, ntags, numlockmask;
 Atom wmatom[WMLast], netatom[NetLast];
 Bool running = True;
@@ -142,6 +142,11 @@ setup(void) {
     XDefineCursor(dpy, barwin, cursor[CurNormal]);
     XMapRaised(dpy, barwin);
     strcpy(stext, "dwm-"VERSION);
+    /* windowarea */
+    wax = sx;
+    way = bh;
+    wah = sh - bh;
+    waw = sw;
     /* pixmap for everything */
     dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
     dc.gc = XCreateGC(dpy, root, 0, 0);
diff --git a/view.c b/view.c
@@ -49,10 +49,10 @@ togglemax(Client *c) {
         return;
 
     if((c->ismax = !c->ismax)) {
-        c->rx = c->x; c->x = sx;
-        c->ry = c->y; c->y = bh;
-        c->rw = c->w; c->w = sw - 2 * BORDERPX;
-        c->rh = c->h; c->h = sh - bh - 2 * BORDERPX;
+        c->rx = c->x; c->x = wax;
+        c->ry = c->y; c->y = way;
+        c->rw = c->w; c->w = waw - 2 * BORDERPX;
+        c->rh = c->h; c->h = wah - 2 * BORDERPX;
     }
     else {
         c->x = c->rx;
@@ -99,17 +99,13 @@ dofloat(void) {
 
 void
 dotile(void) {
-    unsigned int i, n, mpx, stackw, stackh, th;
+    unsigned int i, n, mpx, stackw, th;
     Client *c;
 
     for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
         n++;
-    mpx = (sw * master) / 1000;
-    stackw = sw - mpx;
-    stackh = sh - bh;
-    th = stackh;
-    if(n > 1)
-        th /= (n - 1);
+    mpx = (waw * master) / 1000;
+    stackw = waw - mpx;
 
     for(i = 0, c = clients; c; c = c->next)
         if(isvisible(c)) {
@@ -118,28 +114,26 @@ dotile(void) {
                 continue;
             }
             c->ismax = False;
-            c->x = sx;
-            c->y = sy + bh;
+            c->x = wax;
+            c->y = way;
             if(n == 1) { /* only 1 window */
-                c->w = sw - 2 * BORDERPX;
-                c->h = sh - 2 * BORDERPX - bh;
+                c->w = waw - 2 * BORDERPX;
+                c->h = wah - 2 * BORDERPX;
             }
             else if(i == 0) { /* master window */
-                c->w = mpx - 2 * BORDERPX;
-                c->h = sh - bh - 2 * BORDERPX;
+                c->w = waw - stackw - 2 * BORDERPX;
+                c->h = wah - 2 * BORDERPX;
+                th = wah / (n - 1);
             }
             else {  /* tile window */
                 c->x += mpx;
                 c->w = stackw - 2 * BORDERPX;
                 if(th > bh) {
-                    c->y = sy + (i - 1) * th + bh;
-                    if(i + 1 == n)
-                        c->h = sh - c->y - 2 * BORDERPX;
-                    else
-                        c->h = th - 2 * BORDERPX;
+                    c->y = way + (i - 1) * th;
+                    c->h = th - 2 * BORDERPX;
                 }
                 else /* fallback if th < bh */
-                    c->h = stackh - 2 * BORDERPX;
+                    c->h = wah - 2 * BORDERPX;
             }
             resize(c, False, TopLeft);
             i++;