bstack.c - sites - public wiki contents of suckless.org
(HTM) git clone git://git.suckless.org/sites
(DIR) Log
(DIR) Files
(DIR) Refs
---
bstack.c (813B)
---
1 static void
2 bstack(Monitor *m) {
3 int x, y, h, w, mh;
4 unsigned int i, n;
5 Client *c;
6
7 for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
8 if(n == 0)
9 return;
10 /* master */
11 c = nexttiled(m->clients);
12 mh = m->mfact * m->wh;
13 resize(c, m->wx, m->wy, m->ww - 2 * c->bw, (n == 1 ? m->wh : mh) - 2 * c->bw, False);
14 if(--n == 0)
15 return;
16 /* tile stack */
17 x = m->wx;
18 y = (m->wy + mh > c->y + c->h) ? c->y + c->h + 2 * c->bw : m->wy + mh;
19 w = m->ww / n;
20 h = (m->wy + mh > c->y + c->h) ? m->wy + m->wh - y : m->wh - mh;
21 if(w < bh)
22 w = m->ww;
23 for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) {
24 resize(c, x, y, /* remainder */ ((i + 1 == n)
25 ? m->wx + m->ww - x - 2 * c->bw : w - 2 * c->bw), h - 2 * c->bw, False);
26 if(w != m->ww)
27 x = c->x + WIDTH(c);
28 }
29 }