2020-08-11 10:25:19 +02:00
|
|
|
void
|
|
|
|
focusmaster(const Arg *arg)
|
|
|
|
{
|
2023-11-12 09:41:31 +01:00
|
|
|
Client *master;
|
|
|
|
Monitor *m = selmon;
|
|
|
|
#if FOCUSMASTER_RETURN_PATCH
|
|
|
|
int i;
|
|
|
|
#endif // FOCUSMASTER_RETURN_PATCH
|
2020-08-11 10:25:19 +02:00
|
|
|
|
2023-11-12 09:41:31 +01:00
|
|
|
if (m->nmaster < 1)
|
2020-08-11 10:25:19 +02:00
|
|
|
return;
|
2023-11-12 09:41:31 +01:00
|
|
|
#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
|
2020-08-11 10:25:19 +02:00
|
|
|
|
2023-11-12 09:41:31 +01:00
|
|
|
master = nexttiled(m->clients);
|
2020-08-11 10:25:19 +02:00
|
|
|
|
2023-11-12 09:41:31 +01:00
|
|
|
if (!master)
|
|
|
|
return;
|
|
|
|
|
|
|
|
#if FOCUSMASTER_RETURN_PATCH
|
|
|
|
for (i = 0; !(m->tagset[m->seltags] & 1 << i); i++);
|
|
|
|
i++;
|
2021-06-14 07:16:17 +02:00
|
|
|
|
2023-11-12 09:41:31 +01:00
|
|
|
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
|
2023-11-13 21:20:37 +01:00
|
|
|
restack(m);
|
2023-11-12 09:41:31 +01:00
|
|
|
}
|