dwm-meillo
diff view.c @ 522:fd1275f3b205
simplified dotile()
author | Anselm R. Garbe <arg@10kloc.org> |
---|---|
date | Thu, 05 Oct 2006 12:13:24 +0200 |
parents | 73afe7587bea |
children | c1dd19da63ef |
line diff
1.1 --- a/view.c Thu Oct 05 11:00:55 2006 +0200 1.2 +++ b/view.c Thu Oct 05 12:13:24 2006 +0200 1.3 @@ -4,6 +4,8 @@ 1.4 */ 1.5 #include "dwm.h" 1.6 1.7 +#define MINDIM 100 1.8 + 1.9 /* static */ 1.10 1.11 static Client * 1.12 @@ -138,69 +140,51 @@ 1.13 c->h = sh - 2 * BORDERPX - bh; 1.14 } 1.15 else if(i == 0) { /* master window */ 1.16 + c->x = sx; 1.17 + if(stackpos == StackLeft) 1.18 + c->x += stackw; 1.19 + c->y = sy + bh; 1.20 switch(stackpos) { 1.21 case StackLeft: 1.22 - c->x = sx + stackw; 1.23 - c->y = sy + bh; 1.24 + case StackRight: 1.25 c->w = master - 2 * BORDERPX; 1.26 c->h = sh - bh - 2 * BORDERPX; 1.27 break; 1.28 case StackBottom: 1.29 - c->x = sx; 1.30 - c->y = sy + bh; 1.31 c->w = sw - 2 * BORDERPX; 1.32 c->h = master - 2 * BORDERPX; 1.33 break; 1.34 - case StackRight: 1.35 - c->x = sx; 1.36 - c->y = sy + bh; 1.37 - c->w = master - 2 * BORDERPX; 1.38 - c->h = sh - bh - 2 * BORDERPX; 1.39 - break; 1.40 } 1.41 } 1.42 - else if(th > bh) { 1.43 - /* tile window */ 1.44 + else if(th > bh) { /* tile window */ 1.45 + c->x = sx; 1.46 + if(stackpos == StackRight) 1.47 + c->x += master; 1.48 c->w = tw - 2 * BORDERPX; 1.49 c->h = th - 2 * BORDERPX; 1.50 switch(stackpos) { 1.51 case StackLeft: 1.52 - c->x = sx; 1.53 + case StackRight: 1.54 c->y = sy + (i - 1) * th + bh; 1.55 if(i + 1 == n) 1.56 c->h = sh - c->y - 2 * BORDERPX; 1.57 break; 1.58 case StackBottom: 1.59 - c->x = sx; 1.60 c->y = sy + master + (i - 1) * th + bh; 1.61 if(i + 1 == n) 1.62 c->h = sh - c->y - 2 * BORDERPX; 1.63 break; 1.64 - case StackRight: 1.65 - c->x = sx + master; 1.66 - c->y = sy + (i - 1) * th + bh; 1.67 - if(i + 1 == n) 1.68 - c->h = sh - c->y - 2 * BORDERPX; 1.69 - break; 1.70 } 1.71 } 1.72 else { /* fallback if th < bh */ 1.73 + c->x = sx; 1.74 + if(stackpos == StackRight) 1.75 + c->x += master; 1.76 + c->y = sy + bh; 1.77 + if(stackpos == StackBottom) 1.78 + c->y += master; 1.79 c->w = stackw - 2 * BORDERPX; 1.80 c->h = stackh - 2 * BORDERPX; 1.81 - switch(stackpos) { 1.82 - case StackLeft: 1.83 - c->x = sx; 1.84 - c->y = sy + bh; 1.85 - break; 1.86 - case StackBottom: 1.87 - c->x = sx; 1.88 - c->y = sy + master + bh; 1.89 - break; 1.90 - case StackRight: 1.91 - c->x = sx + master; 1.92 - c->y = sy + bh; 1.93 - break; 1.94 - } 1.95 } 1.96 resize(c, False, TopLeft); 1.97 i++; 1.98 @@ -271,12 +255,12 @@ 1.99 1.100 s = stackpos == StackBottom ? sh - bh : sw; 1.101 if(sel == getnext(clients)) { 1.102 - if(master + arg->i > s - MINW || master + arg->i < MINW) 1.103 + if(master + arg->i > s - MINDIM || master + arg->i < MINDIM) 1.104 return; 1.105 master += arg->i; 1.106 } 1.107 else { 1.108 - if(master - arg->i > s - MINW || master - arg->i < MINW) 1.109 + if(master - arg->i > s - MINDIM || master - arg->i < MINDIM) 1.110 return; 1.111 master -= arg->i; 1.112 }