Buffer text on window resize
[dvtm.git] / tile.c
blob3aa780f9352375c56cd151d3b71198221302a74a
1 static void
2 tile(void) {
3 unsigned int i, m, n, nx, ny, nw, nh, nm, mw, th;
4 Client *c;
6 for(n = 0, m = 0, c = clients; c; c = c->next, n++)
7 if(c->minimized)
8 m++;
9 nm = n - m;
10 /* window geoms */
11 mw = (n == 1 || n - 1 == m) ? waw : mwfact * waw;
12 /* check if there are at least 2 non minimized clients */
13 if(n - 1 > m)
14 th = (wah - m) / (nm - 1);
16 nx = wax;
17 ny = way;
18 for(i = 0, c = clients; c; c = c->next, i++) {
19 if(i == 0) { /* master */
20 nw = mw;
21 nh = (n - 1 > m) ? wah : wah - m;
22 } else { /* tile window */
23 if(!c->minimized){
24 if(i == 1) {
25 ny = way;
26 nx += mw;
27 nw = waw - mw;
28 mvvline(ny, nx, ACS_VLINE, wah);
29 mvaddch(ny, nx, ACS_TTEE);
30 nx++, nw--;
32 /* remainder */
33 if(m == 0 && i + 1 == n) /* no minimized clients */
34 nh = (way + wah) - ny;
35 else if(i == nm - 1) /* last not minimized client */
36 nh = (way + wah - (n - i - 1)) - ny;
37 else
38 nh = th;
39 } else {
40 nh = 1;
41 ny = way + wah - (n - i);
43 if(i > 1 && nm > 1)
44 mvaddch(ny, nx - 1, ACS_LTEE);
46 resize(c,nx,ny,nw,nh);
47 if(n > 1 && th != wah)
48 ny += nh;