~kris/suckless

dwm

ref: c1e5f29af73533103a98ea642ce7cb7b02b92cc2 dwm/patch/focusmaster.c -rw-r--r-- 873 bytes
c1e5f29a — Kris Yotam update border colors to Plan 9 palette, add fzfmenu rule, bind Mod+w/e/c to tome 3 months 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
void
focusmaster(const Arg *arg)
{
	Client *master;
	Monitor *m = selmon;
	#if FOCUSMASTER_RETURN_PATCH
	int i;
	#endif // FOCUSMASTER_RETURN_PATCH

	if (m->nmaster < 1)
		return;
	#if !FAKEFULLSCREEN_PATCH
	#if FAKEFULLSCREEN_CLIENT_PATCH
	if (!m->sel || (m->sel->isfullscreen && m->sel->fakefullscreen != 1 && lockfullscreen))
		return;
	#else
	if (!m->sel || (m->sel->isfullscreen && lockfullscreen))
		return;
	#endif // FAKEFULLSCREEN_CLIENT_PATCH
	#endif // FAKEFULLSCREEN_PATCH

	master = nexttiled(m->clients);

	if (!master)
		return;

	#if FOCUSMASTER_RETURN_PATCH
	for (i = 0; !(m->tagset[m->seltags] & 1 << i); i++);
	i++;

	if (m->sel == master) {
		if (m->tagmarked[i] && ISVISIBLE(m->tagmarked[i]))
			focus(m->tagmarked[i]);
	} else {
		m->tagmarked[i] = m->sel;
		focus(master);
	}
	#else
	focus(master);
	#endif // FOCUSMASTER_RETURN_PATCH
	restack(m);
}