chneukirchen / dwm-chris2

Personal dwm fork.

This URL has Read+Write access

dwm-chris2 / bstack.c
835d6019 » chneukirchen 2008-07-31 Apply dwm-5.1-bstack.diff 1 void
2 bstack(void) {
3 int x, y, h, w, mh;
4 uint i, n;
5 Client *c;
6
7 for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next), n++);
8 if(n == 0)
9 return;
10
11 /* master */
12 c = nexttiled(clients);
13 mh = mfact * wh;
14 resize(c, wx, wy, ww - 2 * c->bw, (n == 1 ? wh : mh) - 2 * c->bw, resizehints);
15
16 if(--n == 0)
17 return;
18
19 /* tile stack */
20 x = wx;
21 y = (wy + mh > c->y + c->h) ? c->y + c->h + 2 * c->bw : wy - mh;
22 w = ww / n;
23 h = (wy + mh > c->y + c->h) ? wy + wh - y : wh - mh;
24 if(h < bh)
25 h = wh;
26
27 for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) {
28 resize(c, x, y, /* remainder */ ((i + 1 == n) ? (wx + ww) - x
29 : w) - 2 * c->bw, h - 2 * c->bw, resizehints);
30 if(w != ww)
31 x = c->x + c->w + 2 * c->bw;
32 }
33 }