-dotile(void) {
- unsigned int i, n, mw, mh, tw, th;
- Client *c;
-
- for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
- n++;
- /* window geoms */
- mw = (n > nmaster) ? (waw * master) / 1000 : waw;
- mh = (n > nmaster) ? wah / nmaster : wah / (n > 0 ? n : 1);
- tw = waw - mw;
- th = (n > nmaster) ? wah / (n - nmaster) : 0;
-
- for(i = 0, c = clients; c; c = c->next)
- if(isvisible(c)) {
- if(c->isfloat) {
- resize(c, True, TopLeft);
- continue;
- }
- c->ismax = False;
- c->x = wax;
- c->y = way;
- if(i < nmaster) {
- c->y += i * mh;
- c->w = mw - 2 * BORDERPX;
- c->h = mh - 2 * BORDERPX;
- }
- else { /* tile window */
- c->x += mw;
- c->w = tw - 2 * BORDERPX;
- if(th > bh) {
- c->y += (i - nmaster) * th;
- c->h = th - 2 * BORDERPX;
- }
- else /* fallback if th < bh */
- c->h = wah - 2 * BORDERPX;
- }
- resize(c, False, TopLeft);
- i++;
- }
- else
- ban(c);
+detach(Client *c) {
+ if(c->prev)
+ c->prev->next = c->next;
+ if(c->next)
+ c->next->prev = c->prev;
+ if(c == clients)
+ clients = c->next;
+ c->next = c->prev = NULL;
+}