dwm-meillo

diff view.c @ 523:c1dd19da63ef

yet another simplification of dotile()
author Anselm R. Garbe <arg@10kloc.org>
date Thu, 05 Oct 2006 12:18:04 +0200
parents fd1275f3b205
children 1a9a0877650c
line diff
     1.1 --- a/view.c	Thu Oct 05 12:13:24 2006 +0200
     1.2 +++ b/view.c	Thu Oct 05 12:18:04 2006 +0200
     1.3 @@ -133,17 +133,15 @@
     1.4  				continue;
     1.5  			}
     1.6  			c->ismax = False;
     1.7 +			c->x = sx;
     1.8 +			c->y = sy + bh;
     1.9  			if(n == 1) { /* only 1 window */
    1.10 -				c->x = sx;
    1.11 -				c->y = sy + bh;
    1.12  				c->w = sw - 2 * BORDERPX;
    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  				case StackRight:
    1.23 @@ -156,35 +154,32 @@
    1.24  					break;
    1.25  				}
    1.26  			}
    1.27 -			else if(th > bh) { /* tile window */
    1.28 -				c->x = sx;
    1.29 +			else {  /* tile window */
    1.30  				if(stackpos == StackRight)
    1.31  					c->x += master;
    1.32 -				c->w = tw - 2 * BORDERPX;
    1.33 -				c->h = th - 2 * BORDERPX;
    1.34 -				switch(stackpos) {
    1.35 -				case StackLeft:
    1.36 -				case StackRight:
    1.37 -					c->y = sy + (i - 1) * th + bh;
    1.38 -					if(i + 1 == n)
    1.39 -						c->h = sh - c->y - 2 * BORDERPX;
    1.40 -					break;
    1.41 -				case StackBottom:
    1.42 -					c->y = sy + master + (i - 1) * th + bh;
    1.43 -					if(i + 1 == n)
    1.44 -						c->h = sh - c->y - 2 * BORDERPX;
    1.45 -					break;
    1.46 +				if(th > bh) {
    1.47 +					switch(stackpos) {
    1.48 +					case StackLeft:
    1.49 +					case StackRight:
    1.50 +						c->y = sy + (i - 1) * th + bh;
    1.51 +						if(i + 1 == n)
    1.52 +							c->h = sh - c->y - 2 * BORDERPX;
    1.53 +						break;
    1.54 +					case StackBottom:
    1.55 +						c->y = sy + master + (i - 1) * th + bh;
    1.56 +						if(i + 1 == n)
    1.57 +							c->h = sh - c->y - 2 * BORDERPX;
    1.58 +						break;
    1.59 +					}
    1.60 +					c->w = tw - 2 * BORDERPX;
    1.61 +					c->h = th - 2 * BORDERPX;
    1.62  				}
    1.63 -			}
    1.64 -			else { /* fallback if th < bh */
    1.65 -				c->x = sx;
    1.66 -				if(stackpos == StackRight)
    1.67 -					c->x += master;
    1.68 -				c->y = sy + bh;
    1.69 -				if(stackpos == StackBottom)
    1.70 -					c->y += master;
    1.71 -				c->w = stackw - 2 * BORDERPX;
    1.72 -				c->h = stackh - 2 * BORDERPX;
    1.73 +				else { /* fallback if th < bh */
    1.74 +					if(stackpos == StackBottom)
    1.75 +						c->y += master;
    1.76 +					c->w = stackw - 2 * BORDERPX;
    1.77 +					c->h = stackh - 2 * BORDERPX;
    1.78 +				}
    1.79  			}
    1.80  			resize(c, False, TopLeft);
    1.81  			i++;