allowing nmaster=0 (I think that's a straight idea) d108cfa7
Anselm R. Garbe · 2007-01-11 13:43 1 file(s) · +12 −5
view.c +12 −5
75 75
76 76
	for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
77 77
		n++;
78 +
78 79
	/* window geoms */
79 -
	mw = (n > nmaster) ? (waw * master) / 1000 : waw;
80 -
	mh = (n > nmaster) ? wah / nmaster : wah / (n > 0 ? n : 1);
81 -
	tw = waw - mw;
80 +
	if(nmaster > 0) {
81 +
		mh = (n > nmaster) ?  wah / nmaster : wah / (n > 0 ? n : 1);
82 +
		mw = (n > nmaster) ? (waw * master) / 1000 : waw;
83 +
	}
84 +
	else
85 +
		mh = mw = 0;
82 86
	th = (n > nmaster) ? wah / (n - nmaster) : 0;
87 +
	tw = waw - mw;
83 88
84 89
	for(i = 0, c = clients; c; c = c->next)
85 90
		if(isvisible(c)) {
90 95
			c->ismax = False;
91 96
			c->x = wax;
92 97
			c->y = way;
93 -
			if(i < nmaster) {
98 +
			if((nmaster > 0) && (i < nmaster)) {
94 99
				c->y += i * mh;
95 100
				c->w = mw - 2 * BORDERPX;
96 101
				c->h = mh - 2 * BORDERPX;
150 155
151 156
void
152 157
incnmaster(Arg *arg) {
153 -
	if((arrange == dofloat) || (nmaster + arg->i < 1) || (wah / (nmaster + arg->i) < bh))
158 +
	if((arrange == dofloat)
159 +
	|| ((int)nmaster + arg->i < 0)
160 +
	|| (((int)nmaster + arg->i > 0) && (wah / (nmaster + arg->i) < bh)))
154 161
		return;
155 162
	nmaster += arg->i;
156 163
	updatemodetext();