forked from prabirshrestha/dwm-win32
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bstack.c
33 lines (28 loc) · 965 Bytes
/
bstack.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
void
bstack(void) {
int x, y, h, w, mh;
unsigned int i, n;
Client *c;
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next), n++);
if(n == 0)
return;
c = nexttiled(clients);
mh = mfact * wh;
/* adjustborder(c, n == 1 ? 0 : borderpx); */
resize(c, wx, wy, ww - 2 * c->bw, (n == 1 ? wh : mh) - 2 * c->bw);
if(--n == 0)
return;
x = wx;
y = (wy + mh > c->y + c->h) ? c->y + c->h + 2 * c->bw : wy + mh;
w = ww / n;
h = (wy + mh > c->y + c->h) ? wy + wh - y : wh - mh;
if(h < bh)
h = wh;
for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) {
/* adjustborder(c, borderpx); */
resize(c, x, y, ((i + 1 == n) ? wx + ww - x : w) - 2 * c->bw,
h - 2 * c->bw);
if(w != ww)
x = c->x + WIDTH(c);
}
}