comparison 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
comparison
equal deleted inserted replaced
677:a1cabd6c6f9f 678:4dcbbfe9d137
73 unsigned int i, n, mw, mh, tw, th; 73 unsigned int i, n, mw, mh, tw, th;
74 Client *c; 74 Client *c;
75 75
76 for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) 76 for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
77 n++; 77 n++;
78
78 /* window geoms */ 79 /* window geoms */
79 mw = (n > nmaster) ? (waw * master) / 1000 : waw; 80 if(nmaster > 0) {
80 mh = (n > nmaster) ? wah / nmaster : wah / (n > 0 ? n : 1); 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;
86 th = (n > nmaster) ? wah / (n - nmaster) : 0;
81 tw = waw - mw; 87 tw = waw - mw;
82 th = (n > nmaster) ? wah / (n - nmaster) : 0;
83 88
84 for(i = 0, c = clients; c; c = c->next) 89 for(i = 0, c = clients; c; c = c->next)
85 if(isvisible(c)) { 90 if(isvisible(c)) {
86 if(c->isfloat) { 91 if(c->isfloat) {
87 resize(c, True, TopLeft); 92 resize(c, True, TopLeft);
88 continue; 93 continue;
89 } 94 }
90 c->ismax = False; 95 c->ismax = False;
91 c->x = wax; 96 c->x = wax;
92 c->y = way; 97 c->y = way;
93 if(i < nmaster) { 98 if((nmaster > 0) && (i < nmaster)) {
94 c->y += i * mh; 99 c->y += i * mh;
95 c->w = mw - 2 * BORDERPX; 100 c->w = mw - 2 * BORDERPX;
96 c->h = mh - 2 * BORDERPX; 101 c->h = mh - 2 * BORDERPX;
97 } 102 }
98 else { /* tile window */ 103 else { /* tile window */
148 } 153 }
149 } 154 }
150 155
151 void 156 void
152 incnmaster(Arg *arg) { 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 return; 161 return;
155 nmaster += arg->i; 162 nmaster += arg->i;
156 updatemodetext(); 163 updatemodetext();
157 if(sel) 164 if(sel)
158 arrange(); 165 arrange();