Commit d9597d21 authored by Carlos Garnacho's avatar Carlos Garnacho Committed by Florian Müllner

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.

parent fc3831c7
Pipeline #121683 passed with stages
in 11 minutes and 51 seconds
......@@ -400,9 +400,10 @@ static void
meta_wayland_keyboard_update_xkb_state (MetaWaylandKeyboard *keyboard)
MetaWaylandXkbInfo *xkb_info = &keyboard->xkb_info;
xkb_mod_mask_t latched, locked;
xkb_mod_mask_t latched, locked, numlock;
MetaBackend *backend = meta_get_backend ();
xkb_layout_index_t layout_idx;
ClutterKeymap *keymap;
/* Preserve latched/locked modifiers state */
if (xkb_info->state)
......@@ -416,6 +417,14 @@ meta_wayland_keyboard_update_xkb_state (MetaWaylandKeyboard *keyboard)
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;
locked &= ~numlock;
xkb_info->state = xkb_state_new (xkb_info->keymap);
layout_idx = meta_backend_get_keymap_layout_group (backend);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment