dwm-meillo

diff view.c @ 531:96563762b4ad

yet another small fix and simplification of dotile
author Anselm R. Garbe <arg@10kloc.org>
date Fri, 06 Oct 2006 11:37:12 +0200
parents 451f19d48845
children 651f2c868b31
line diff
     1.1 --- a/view.c	Thu Oct 05 19:27:28 2006 +0200
     1.2 +++ b/view.c	Fri Oct 06 11:37:12 2006 +0200
     1.3 @@ -95,28 +95,23 @@
     1.4  	restack();
     1.5  }
     1.6  
     1.7 -/* This algorithm is based on a (M)aster area and a (S)tacking area.
     1.8 - * It supports following arrangements:
     1.9 - * 	SSMMM	MMMMM	MMMSS
    1.10 - * 	SSMMM	SSSSS	MMMSS
    1.11 - */
    1.12  void
    1.13  dotile(Arg *arg) {
    1.14 -	unsigned int i, n, md, stackw, stackh, th;
    1.15 +	unsigned int i, n, mpx, stackw, stackh, th;
    1.16  	Client *c;
    1.17  
    1.18  	for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
    1.19  		n++;
    1.20  
    1.21 -	md = (sw * master) / 1000;
    1.22 -	stackw = sw - md;
    1.23 +	mpx = (sw * master) / 1000;
    1.24 +	stackw = sw - mpx;
    1.25  	stackh = sh - bh;
    1.26  
    1.27  	th = stackh;
    1.28  	if(n > 1)
    1.29  		th /= (n - 1);
    1.30  
    1.31 -	for(i = 0, c = clients; c; c = c->next) {
    1.32 +	for(i = 0, c = clients; c; c = c->next, i++)
    1.33  		if(isvisible(c)) {
    1.34  			if(c->isfloat) {
    1.35  				resize(c, True, TopLeft);
    1.36 @@ -130,29 +125,26 @@
    1.37  				c->h = sh - 2 * BORDERPX - bh;
    1.38  			}
    1.39  			else if(i == 0) { /* master window */
    1.40 -				c->w = md - 2 * BORDERPX;
    1.41 +				c->w = mpx - 2 * BORDERPX;
    1.42  				c->h = sh - bh - 2 * BORDERPX;
    1.43  			}
    1.44  			else {  /* tile window */
    1.45 -				c->x += md;
    1.46 +				c->x += mpx;
    1.47 +				c->w = stackw - 2 * BORDERPX;
    1.48  				if(th > bh) {
    1.49  					c->y = sy + (i - 1) * th + bh;
    1.50  					if(i + 1 == n)
    1.51  						c->h = sh - c->y - 2 * BORDERPX;
    1.52 -					c->w = stackw - 2 * BORDERPX;
    1.53 -					c->h = th - 2 * BORDERPX;
    1.54 +					else
    1.55 +						c->h = th - 2 * BORDERPX;
    1.56  				}
    1.57 -				else { /* fallback if th < bh */
    1.58 -					c->w = stackw - 2 * BORDERPX;
    1.59 +				else /* fallback if th < bh */
    1.60  					c->h = stackh - 2 * BORDERPX;
    1.61 -				}
    1.62  			}
    1.63  			resize(c, False, TopLeft);
    1.64 -			i++;
    1.65  		}
    1.66  		else
    1.67  			ban(c);
    1.68 -	}
    1.69  	if(!sel || !isvisible(sel)) {
    1.70  		for(c = stack; c && !isvisible(c); c = c->snext);
    1.71  		focus(c);