"Focus the most recently focused window on selmon" is now refocus()
24NXTKJNNOM6P3OPCN7OZE6LGGMFKRWFR6NUZ5JKETRABZA4YAGQC
EUJMBPB6W6ADQS4ZFMODC4S5WWH6SZIVM5OW46Z6CPMPDOL4HM7QC
IH7QAHDQUTGT7KS2IP7SLDHYDEDX4BCQ4KDRYKIGV5Y477X3ZABQC
MO5ORR7VSER3YUNO77DZJVKGOVYC2KNDCSC72J4NF7JYOHHTLRQAC
S7RXJJZG4IEIVLPHEWFT5M2T3SRRO5US5SYBPXSYSWJJLXAKNNPAC
D425ND7AT3F7QJ3CCSESMVDOC3J5C5P32M5SJDBHECZJXLHNQ2FAC
7B74AT3BXYB7PVW4F6SGQNPMHOU5TEV5TZ54CG6VSQI46XSEKWXQC
J6OSBEBQXZR5JZ5TOCCUPELBPUVEQULGCXURXLPY7WFYTDEQOU2AC
E7UO6NRGXFDMBU3BSJYRDNOA3Y7VHD7NWPHI5PHCPHQF6ZNOPZLQC
O5JVMDEEKP334BAYMJ6HHXROW4X4WC24JHCYZTKJRQE5UGYXV7YQC
ZDQINUTDXQUS7OBW53UEYR6IN7DJLTPBOMRURGYQBGJ2FBROIQVAC
7XCGFU3GX4TQXZBOU7GFAQ62EEOTVRNWFYQGI3XULFPSUKDZ2EYAC
LQPHYO7IIMLXHUD5IK657BO4BE3SGT5HYDRJDU5OFDF5YUXKIRTAC
6XZIQSMIVP2GZ5S3UCKEVNDSLTHSQEVSXLV4UIFF3G3SRCGJPXYAC
/* Default client is most recently focused on selmon */
if (!c || !VISIBLEON(c, c->mon)) {
c = NULL;
surface = NULL;
Client *next;
wl_list_for_each(next, &fstack, flink) {
if (VISIBLEON(next, selmon)) {
c = next;
break;
}
}
if (c) {
/* assert(VISIBLEON(c, c->mon)); ? */
/* Default surface is the client's main xdg_surface */
if (!surface)
surface = c->xdg_surface->surface;
/* Focus the correct monitor as well */
selmon = c->mon;
if (c) {
struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat);
/* Move the client to the front of the focus stack */
wl_list_remove(&c->flink);
wl_list_insert(&fstack, &c->flink);
/* Activate the new surface */
wlr_xdg_toplevel_set_activated(c->xdg_surface, true);
/*
* Tell the seat to have the keyboard enter this surface.
* wlroots will keep track of this and automatically send key
* events to the appropriate clients without additional work on
* your part.
*/
wlr_seat_keyboard_notify_enter(seat, c->xdg_surface->surface,
keyboard->keycodes, keyboard->num_keycodes,
&keyboard->modifiers);
} else {
if (!c) {
struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat);
/* Move the client to the front of the focus stack */
wl_list_remove(&c->flink);
wl_list_insert(&fstack, &c->flink);
/* Activate the new surface */
wlr_xdg_toplevel_set_activated(c->xdg_surface, true);
/*
* Tell the seat to have the keyboard enter this surface.
* wlroots will keep track of this and automatically send key
* events to the appropriate clients without additional work on
* your part.
*/
wlr_seat_keyboard_notify_enter(seat, c->xdg_surface->surface,
keyboard->keycodes, keyboard->num_keycodes,
&keyboard->modifiers);