backends/native: Pass xkb_state directly when updating MetaKeymapNative

Figuring out the MetaSeatImpl this much indirectly is fairly awkward when
the keymap is only updated from the MetaSeatImpl, pass instead the seat
impl's xkb_state, as we have it handy in all the places this is called.

This will not break on NULL seats during initialization, should the numlock
state be restored from previous sessions.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1556
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1612>
This commit is contained in:
Carlos Garnacho
2020-11-27 18:11:02 +01:00
committed by Marge Bot
parent f5949af0bb
commit 13202f4e45
3 changed files with 7 additions and 11 deletions

View File

@ -124,14 +124,9 @@ meta_keymap_native_get_keyboard_map_in_impl (MetaKeymapNative *keymap)
}
void
meta_keymap_native_update_in_impl (MetaKeymapNative *keymap)
meta_keymap_native_update_in_impl (MetaKeymapNative *keymap,
struct xkb_state *xkb_state)
{
struct xkb_state *xkb_state;
ClutterSeat *seat;
seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
xkb_state = meta_seat_impl_get_xkb_state_in_impl (META_SEAT_NATIVE (seat)->impl);
keymap->num_lock =
xkb_state_mod_name_is_active (xkb_state,
XKB_MOD_NAME_NUM,