~kaction/dvtm

ref: 426ff5f3766b54c899ff04650f566217747260e1 dvtm/vstack.c -rw-r--r-- 684 bytes
426ff5f3 — Ross Mohn Display control keys, when typed, next to Layout icon 5 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* A vertical stack layout, all windows have the full screen width. */
static void vstack(void)
{
	unsigned int i, n, ny, nh, m, mh, th;
	Client *c;

	for (n = 0, c = nextvisible(clients); c; c = nextvisible(c->next))
		if (!c->minimized)
			n++;

	m  = MAX(1, MIN(n, screen.nmaster));
	mh = (n == m ? wah : screen.mfact * wah);
	th = n == m ? 0 : (wah - mh) / (n - m);
	ny = way;

	for (i = 0, c = nextvisible(clients); c; c = nextvisible(c->next)) {
		if (c->minimized)
			continue;
		if (i < m) /* master */
			nh = (i < m - 1) ? mh / m : (way + mh) - ny;
		else /* tile window */
			nh = (i < n - 1) ? th : (way + wah) - ny;
		resize(c, wax, ny, waw, nh);
		ny += nh;
		i++;
	}
}