-
Notifications
You must be signed in to change notification settings - Fork 0
/
tstack.c
45 lines (42 loc) · 910 Bytes
/
tstack.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
34
35
36
37
38
39
40
41
42
43
44
45
static void tstack(void)
{
unsigned int i, n, nx, ny, nw, nh, m, mw, mh, tw;
Client *c;
for (n = 0, c = windows_list(); c; c = c->next)
if (!c->minimized)
n++;
m = MAX(1, MIN(n, screen.nmaster));
mh = n == m ? wah : screen.mfact * wah;
mw = waw / m;
tw = n == m ? 0 : waw / (n - m);
nx = wax;
ny = way + wah - mh;
for (i = 0, c = windows_list(); c; c = c->next) {
if (c->minimized)
continue;
if (i < m) { /* master */
if (i > 0) {
mvvline(ny, nx, ACS_VLINE, nh);
mvaddch(ny, nx, ACS_TTEE);
nx++;
}
nh = mh;
nw = (i < m - 1) ? mw : (wax + waw) - nx;
} else { /* tile window */
if (i == m) {
nx = wax;
ny = way;
nh = (way + wah) - ny - mh;
}
if (i > m) {
mvvline(ny, nx, ACS_VLINE, nh);
mvaddch(ny, nx, ACS_TTEE);
nx++;
}
nw = (i < n - 1) ? tw : (wax + waw) - nx;
}
resize(c, nx, ny, nw, nh);
nx += nw;
i++;
}
}