Move buffer related functions up
[dvtm.git] / tile.c
blobc3a8041e2deaa04ea1f8198c78901b42ed02179f
1 static void tile(void)
3 unsigned int i, n, nx, ny, nw, nh, mw, th;
4 Client *c;
6 for (n = 0, c = nextvisible(clients); c; c = nextvisible(c->next))
7 if (!c->minimized)
8 n++;
10 mw = n <= 1 ? waw : screen.mfact * waw;
11 th = n <= 1 ? 0 : wah / (n - 1);
12 nx = wax;
13 ny = way;
15 for (i = 0, c = nextvisible(clients); c; c = nextvisible(c->next)) {
16 if (c->minimized)
17 continue;
18 if (i == 0) { /* master */
19 nw = mw;
20 nh = wah;
21 } else { /* tile window */
22 if (i == 1) {
23 ny = way;
24 nx += mw;
25 nw = waw - mw;
26 mvvline(ny, nx, ACS_VLINE, wah);
27 mvaddch(ny, nx, ACS_TTEE);
28 nx++, nw--;
30 nh = (i < n - 1) ? th : (way + wah) - ny;
31 if (i > 1)
32 mvaddch(ny, nx - 1, ACS_LTEE);
34 resize(c, nx, ny, nw, nh);
35 if (i > 0)
36 ny += nh;
37 i++;