mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 17:10:40 -05:00
wayland: Ensure to forward numlock state to clients
This makes sure the numlock key lock state is forwarded to the wl_keyboard internal state, notably on startup and after keymap changes. https://gitlab.gnome.org/GNOME/mutter/issues/769
This commit is contained in:
parent
fc3831c797
commit
d9597d2148
@ -400,9 +400,10 @@ static void
|
|||||||
meta_wayland_keyboard_update_xkb_state (MetaWaylandKeyboard *keyboard)
|
meta_wayland_keyboard_update_xkb_state (MetaWaylandKeyboard *keyboard)
|
||||||
{
|
{
|
||||||
MetaWaylandXkbInfo *xkb_info = &keyboard->xkb_info;
|
MetaWaylandXkbInfo *xkb_info = &keyboard->xkb_info;
|
||||||
xkb_mod_mask_t latched, locked;
|
xkb_mod_mask_t latched, locked, numlock;
|
||||||
MetaBackend *backend = meta_get_backend ();
|
MetaBackend *backend = meta_get_backend ();
|
||||||
xkb_layout_index_t layout_idx;
|
xkb_layout_index_t layout_idx;
|
||||||
|
ClutterKeymap *keymap;
|
||||||
|
|
||||||
/* Preserve latched/locked modifiers state */
|
/* Preserve latched/locked modifiers state */
|
||||||
if (xkb_info->state)
|
if (xkb_info->state)
|
||||||
@ -416,6 +417,14 @@ meta_wayland_keyboard_update_xkb_state (MetaWaylandKeyboard *keyboard)
|
|||||||
latched = locked = 0;
|
latched = locked = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
keymap = clutter_backend_get_keymap (clutter_get_default_backend ());
|
||||||
|
numlock = (1 << xkb_keymap_mod_get_index (xkb_info->keymap, "Mod2"));
|
||||||
|
|
||||||
|
if (clutter_keymap_get_num_lock_state (keymap))
|
||||||
|
locked |= numlock;
|
||||||
|
else
|
||||||
|
locked &= ~numlock;
|
||||||
|
|
||||||
xkb_info->state = xkb_state_new (xkb_info->keymap);
|
xkb_info->state = xkb_state_new (xkb_info->keymap);
|
||||||
|
|
||||||
layout_idx = meta_backend_get_keymap_layout_group (backend);
|
layout_idx = meta_backend_get_keymap_layout_group (backend);
|
||||||
|
Loading…
Reference in New Issue
Block a user