W32YIHMVPAREXUADJOAX45B6CTXZY42EE77RDDZYNJFEE2HLQ3HAC
DEYEAIOK6XPZXJXKS4S6EFXRZL7U65VBC2T3ABPDTSTEQRBXY25AC
MO5ORR7VSER3YUNO77DZJVKGOVYC2KNDCSC72J4NF7JYOHHTLRQAC
7B74AT3BXYB7PVW4F6SGQNPMHOU5TEV5TZ54CG6VSQI46XSEKWXQC
S7RXJJZG4IEIVLPHEWFT5M2T3SRRO5US5SYBPXSYSWJJLXAKNNPAC
F72VJF4KJZEYZEYGAGKCWPMEQGPKS7T5PEEJPJKZO6ZG246TTLAQC
ZDQINUTDXQUS7OBW53UEYR6IN7DJLTPBOMRURGYQBGJ2FBROIQVAC
CD2JEM3MH5BXN7ADZAWLJFTRZG7PMDCKISDNJEO472PIBEJHBH2AC
ZEKBZDRVZJFHG75HZQVVQHO4G7RIY5OZTSI5G3BWIF566BRQBXHAC
6LVZRZGDURMWBUBXHFGV4HGB7L5M2FKCYGJCAU3X2PK74VJQ6RCAC
QIIHRSY26Q3QJQUIDTU4M4C5NGAW3NGDOKT5UVZBD25A6UVPQDPQC
3ONWXUBO3OC3KAKHAM3VFRVMGNNRE6GXHGLTS6AD2HIV4LDSLKLQC
MEMJUZF3HSX3M747YTV4LVUCOPRIS75IXAVXZIWLCZN2BHPUZHEQC
OYZELWD247C2GT4QAW6YECUCA2GRLG4VI25BMOZKOGNRKERPZ6AQC
XKWY25ZVEJIJU7R23CEG5CTYRAWKZ5FXSHY3ZEZRGCIWYIKQSLOAC
}
}
void
focusclient(Client *c, struct wlr_surface *surface, int lift)
{
if (c) {
/* assert(VISIBLEON(c, c->mon)); ? */
/* If no surface provided, use the client's xdg_surface */
if (!surface)
surface = c->xdg_surface->surface;
/* Focus the correct monitor as well */
selmon = c->mon;
}
/* XXX Need to understand xdg toplevel/popups to know if there's more
* simplification that can be done in this function */
struct wlr_surface *prev_surface = seat->keyboard_state.focused_surface;
/* Don't re-focus an already focused surface. */
if (prev_surface == surface)
return;
if (prev_surface) {
/*
* Deactivate the previously focused surface. This lets the
* client know it no longer has focus and the client will
* repaint accordingly, e.g. stop displaying a caret.
*/
struct wlr_xdg_surface *previous = wlr_xdg_surface_from_wlr_surface(
seat->keyboard_state.focused_surface);
wlr_xdg_toplevel_set_activated(previous, false);
}
/*
* 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. If surface == NULL, this will clear focus.
*/
struct wlr_keyboard *kb = wlr_seat_get_keyboard(seat);
wlr_seat_keyboard_notify_enter(seat, surface,
kb->keycodes, kb->num_keycodes, &kb->modifiers);
if (c) {
/* Move the client to the front of the focus stack */
wl_list_remove(&c->flink);
wl_list_insert(&fstack, &c->flink);
if (lift) {
wl_list_remove(&c->slink);
wl_list_insert(&stack, &c->slink);
}
/* Activate the new surface */
wlr_xdg_toplevel_set_activated(c->xdg_surface, true);
}
void
keyboardfocus(Client *c, struct wlr_surface *surface, int lift)
{
if (c) {
/* assert(VISIBLEON(c, c->mon)); ? */
/* If no surface provided, use the client's xdg_surface */
if (!surface)
surface = c->xdg_surface->surface;
/* Focus the correct monitor as well */
selmon = c->mon;
}
/* XXX Need to understand xdg toplevel/popups to know if there's more
* simplification that can be done in this function */
struct wlr_surface *prev_surface = seat->keyboard_state.focused_surface;
/* Don't re-focus an already focused surface. */
if (prev_surface == surface)
return;
if (prev_surface) {
/*
* Deactivate the previously focused surface. This lets the
* client know it no longer has focus and the client will
* repaint accordingly, e.g. stop displaying a caret.
*/
struct wlr_xdg_surface *previous = wlr_xdg_surface_from_wlr_surface(
seat->keyboard_state.focused_surface);
wlr_xdg_toplevel_set_activated(previous, false);
}
/*
* 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. If surface == NULL, this will clear focus.
*/
struct wlr_keyboard *kb = wlr_seat_get_keyboard(seat);
wlr_seat_keyboard_notify_enter(seat, surface,
kb->keycodes, kb->num_keycodes, &kb->modifiers);
if (c) {
/* Move the client to the front of the focus stack */
wl_list_remove(&c->flink);
wl_list_insert(&fstack, &c->flink);
if (lift) {
wl_list_remove(&c->slink);
wl_list_insert(&stack, &c->slink);
}
/* Activate the new surface */
wlr_xdg_toplevel_set_activated(c->xdg_surface, true);
}