aewl
changeset 522:fd1275f3b205
simplified dotile()
author | Anselm R. Garbe <arg@10kloc.org> |
---|---|
date | Thu, 05 Oct 2006 12:13:24 +0200 |
parents | 73afe7587bea |
children | c1dd19da63ef |
files | dwm.h view.c |
diffstat | 2 files changed, 20 insertions(+), 37 deletions(-) [+] |
line diff
1.1 --- a/dwm.h Thu Oct 05 11:00:55 2006 +0200 1.2 +++ b/dwm.h Thu Oct 05 12:13:24 2006 +0200 1.3 @@ -40,7 +40,6 @@ 1.4 #define MOUSEMASK (BUTTONMASK | PointerMotionMask) 1.5 /* other stuff used in different places */ 1.6 #define BORDERPX 1 1.7 -#define MINW 100 1.8 #define PROTODELWIN 1 1.9 1.10 enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */
2.1 --- a/view.c Thu Oct 05 11:00:55 2006 +0200 2.2 +++ b/view.c Thu Oct 05 12:13:24 2006 +0200 2.3 @@ -4,6 +4,8 @@ 2.4 */ 2.5 #include "dwm.h" 2.6 2.7 +#define MINDIM 100 2.8 + 2.9 /* static */ 2.10 2.11 static Client * 2.12 @@ -138,69 +140,51 @@ 2.13 c->h = sh - 2 * BORDERPX - bh; 2.14 } 2.15 else if(i == 0) { /* master window */ 2.16 + c->x = sx; 2.17 + if(stackpos == StackLeft) 2.18 + c->x += stackw; 2.19 + c->y = sy + bh; 2.20 switch(stackpos) { 2.21 case StackLeft: 2.22 - c->x = sx + stackw; 2.23 - c->y = sy + bh; 2.24 + case StackRight: 2.25 c->w = master - 2 * BORDERPX; 2.26 c->h = sh - bh - 2 * BORDERPX; 2.27 break; 2.28 case StackBottom: 2.29 - c->x = sx; 2.30 - c->y = sy + bh; 2.31 c->w = sw - 2 * BORDERPX; 2.32 c->h = master - 2 * BORDERPX; 2.33 break; 2.34 - case StackRight: 2.35 - c->x = sx; 2.36 - c->y = sy + bh; 2.37 - c->w = master - 2 * BORDERPX; 2.38 - c->h = sh - bh - 2 * BORDERPX; 2.39 - break; 2.40 } 2.41 } 2.42 - else if(th > bh) { 2.43 - /* tile window */ 2.44 + else if(th > bh) { /* tile window */ 2.45 + c->x = sx; 2.46 + if(stackpos == StackRight) 2.47 + c->x += master; 2.48 c->w = tw - 2 * BORDERPX; 2.49 c->h = th - 2 * BORDERPX; 2.50 switch(stackpos) { 2.51 case StackLeft: 2.52 - c->x = sx; 2.53 + case StackRight: 2.54 c->y = sy + (i - 1) * th + bh; 2.55 if(i + 1 == n) 2.56 c->h = sh - c->y - 2 * BORDERPX; 2.57 break; 2.58 case StackBottom: 2.59 - c->x = sx; 2.60 c->y = sy + master + (i - 1) * th + bh; 2.61 if(i + 1 == n) 2.62 c->h = sh - c->y - 2 * BORDERPX; 2.63 break; 2.64 - case StackRight: 2.65 - c->x = sx + master; 2.66 - c->y = sy + (i - 1) * th + bh; 2.67 - if(i + 1 == n) 2.68 - c->h = sh - c->y - 2 * BORDERPX; 2.69 - break; 2.70 } 2.71 } 2.72 else { /* fallback if th < bh */ 2.73 + c->x = sx; 2.74 + if(stackpos == StackRight) 2.75 + c->x += master; 2.76 + c->y = sy + bh; 2.77 + if(stackpos == StackBottom) 2.78 + c->y += master; 2.79 c->w = stackw - 2 * BORDERPX; 2.80 c->h = stackh - 2 * BORDERPX; 2.81 - switch(stackpos) { 2.82 - case StackLeft: 2.83 - c->x = sx; 2.84 - c->y = sy + bh; 2.85 - break; 2.86 - case StackBottom: 2.87 - c->x = sx; 2.88 - c->y = sy + master + bh; 2.89 - break; 2.90 - case StackRight: 2.91 - c->x = sx + master; 2.92 - c->y = sy + bh; 2.93 - break; 2.94 - } 2.95 } 2.96 resize(c, False, TopLeft); 2.97 i++; 2.98 @@ -271,12 +255,12 @@ 2.99 2.100 s = stackpos == StackBottom ? sh - bh : sw; 2.101 if(sel == getnext(clients)) { 2.102 - if(master + arg->i > s - MINW || master + arg->i < MINW) 2.103 + if(master + arg->i > s - MINDIM || master + arg->i < MINDIM) 2.104 return; 2.105 master += arg->i; 2.106 } 2.107 else { 2.108 - if(master - arg->i > s - MINW || master - arg->i < MINW) 2.109 + if(master - arg->i > s - MINDIM || master - arg->i < MINDIM) 2.110 return; 2.111 master -= arg->i; 2.112 }