bstack.c (1151B)
1 static void bstack(void) 2 { 3 unsigned int i, n, nx, ny, nw, nh, m, mw, mh, tw; 4 Client *c; 5 6 for (n = 0, c = nextvisible(clients); c; c = nextvisible(c->next)) 7 if (!c->minimized) 8 n++; 9 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; 16 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++; 25 } 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; 33 } 34 if (i > m) { 35 mvvline(ny, nx, ACS_VLINE, nh); 36 mvaddch(ny, nx, ACS_TTEE); 37 nx++; 38 } 39 nw = (i < n - 1) ? tw : (wax + waw) - nx; 40 } 41 resize(c, nx, ny, nw, nh); 42 nx += nw; 43 i++; 44 } 45 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++; 53 } 54 nw = (i < m - 1) ? mw : (wax + waw) - nx; 55 nx += nw; 56 } 57 } 58 }