Simplify if statements
[dvtm.git] / vstack.c
blob8830bb206e715c8249e6e0ceca97d35837b70697
1 /* A vertical stack layout, all windows have the full screen width. */
2 static void vstack(void)
4 unsigned int i, n, ny, nh, m, mh, th;
5 Client *c;
7 for (n = 0, c = nextvisible(clients); c; c = nextvisible(c->next))
8 if (!c->minimized)
9 n++;
11 m = MAX(1, MIN(n, screen.nmaster));
12 mh = (n == m ? wah : screen.mfact * wah);
13 th = n == m ? 0 : (wah - mh) / (n - m);
14 ny = way;
16 for (i = 0, c = nextvisible(clients); c; c = nextvisible(c->next)) {
17 if (c->minimized)
18 continue;
19 if (i < m) /* master */
20 nh = (i < m - 1) ? mh / m : (way + mh) - ny;
21 else /* tile window */
22 nh = (i < n - 1) ? th : (way + wah) - ny;
23 resize(c, wax, ny, waw, nh);
24 ny += nh;
25 i++;