vt_forkpty: check for success of chdir(2)
[dvtm.git] / bstack.c
blob1d14776fb04527a4af07e504ea23f48abdec45d4
1 static void bstack(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;
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 += mh;
32 nh = (way + wah) - ny;
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++;
46 /* Fill in nmaster intersections */
47 if (n > m) {
48 nx = wax;
49 for (i = 0; i < m; i++) {
50 if (i > 0) {
51 mvaddch(ny, nx, ACS_PLUS);
52 nx++;
54 nw = (i < m - 1) ? mw : (wax + waw) - nx;
55 nx += nw;