aewl

diff view.c @ 678:4dcbbfe9d137

allowing nmaster=0 (I think that's a straight idea)
author Anselm R. Garbe <arg@suckless.org>
date Thu, 11 Jan 2007 13:43:38 +0100
parents 1438e35b622e
children 76b58d21ea98
line diff
     1.1 --- a/view.c	Wed Jan 10 12:56:49 2007 +0100
     1.2 +++ b/view.c	Thu Jan 11 13:43:38 2007 +0100
     1.3 @@ -75,11 +75,16 @@
     1.4  
     1.5  	for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
     1.6  		n++;
     1.7 +
     1.8  	/* window geoms */
     1.9 -	mw = (n > nmaster) ? (waw * master) / 1000 : waw;
    1.10 -	mh = (n > nmaster) ? wah / nmaster : wah / (n > 0 ? n : 1);
    1.11 +	if(nmaster > 0) {
    1.12 +		mh = (n > nmaster) ?  wah / nmaster : wah / (n > 0 ? n : 1);
    1.13 +		mw = (n > nmaster) ? (waw * master) / 1000 : waw;
    1.14 +	}
    1.15 +	else
    1.16 +		mh = mw = 0;
    1.17 +	th = (n > nmaster) ? wah / (n - nmaster) : 0;
    1.18  	tw = waw - mw;
    1.19 -	th = (n > nmaster) ? wah / (n - nmaster) : 0;
    1.20  
    1.21  	for(i = 0, c = clients; c; c = c->next)
    1.22  		if(isvisible(c)) {
    1.23 @@ -90,7 +95,7 @@
    1.24  			c->ismax = False;
    1.25  			c->x = wax;
    1.26  			c->y = way;
    1.27 -			if(i < nmaster) {
    1.28 +			if((nmaster > 0) && (i < nmaster)) {
    1.29  				c->y += i * mh;
    1.30  				c->w = mw - 2 * BORDERPX;
    1.31  				c->h = mh - 2 * BORDERPX;
    1.32 @@ -150,7 +155,9 @@
    1.33  
    1.34  void
    1.35  incnmaster(Arg *arg) {
    1.36 -	if((arrange == dofloat) || (nmaster + arg->i < 1) || (wah / (nmaster + arg->i) < bh))
    1.37 +	if((arrange == dofloat)
    1.38 +	|| ((int)nmaster + arg->i < 0)
    1.39 +	|| (((int)nmaster + arg->i > 0) && (wah / (nmaster + arg->i) < bh)))
    1.40  		return;
    1.41  	nmaster += arg->i;
    1.42  	updatemodetext();