Fix Mod-C and eliminate redundant shell process
[dvtm.git] / tstack.c
blobf3f1eb92c04125d3e2ff43c8cf04ff8b193d5506
1 static void tstack(void)
3 unsigned int i, n, nx, ny, nw, nh, m, mw, mh, tw;
4 Client *c;
6 for (n = 0, c = nextvisible(clients); c; c = nextvisible(c->next))
7 if (!c->minimized)
8 n++;
10 m = MAX(1, MIN(n, screen.nmaster));
11 mh = n == m ? wah : screen.mfact * wah;
12 mw = waw / m;
13 tw = n == m ? 0 : waw / (n - m);
14 nx = wax;
15 ny = way + wah - mh;
17 for (i = 0, c = nextvisible(clients); c; c = nextvisible(c->next)) {
18 if (c->minimized)
19 continue;
20 if (i < m) { /* master */
21 if (i > 0) {
22 mvvline(ny, nx, ACS_VLINE, nh);
23 mvaddch(ny, nx, ACS_TTEE);
24 nx++;
26 nh = mh;
27 nw = (i < m - 1) ? mw : (wax + waw) - nx;
28 } else { /* tile window */
29 if (i == m) {
30 nx = wax;
31 ny = way;
32 nh = (way + wah) - ny - mh;
34 if (i > m) {
35 mvvline(ny, nx, ACS_VLINE, nh);
36 mvaddch(ny, nx, ACS_TTEE);
37 nx++;
39 nw = (i < n - 1) ? tw : (wax + waw) - nx;
41 resize(c, nx, ny, nw, nh);
42 nx += nw;
43 i++;