[mutter/wip/carlosg/native-numlock-fix] wayland: Ensure to forward numlock state to clients
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/native-numlock-fix] wayland: Ensure to forward numlock state to clients
- Date: Mon, 7 Oct 2019 17:45:43 +0000 (UTC)
commit 59fed9194b999af561bfcbf4142a97f3074e1d6a
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Oct 7 19:14:20 2019 +0200
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
src/wayland/meta-wayland-keyboard.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/src/wayland/meta-wayland-keyboard.c b/src/wayland/meta-wayland-keyboard.c
index 0c3447137..d74ef0dfa 100644
--- a/src/wayland/meta-wayland-keyboard.c
+++ b/src/wayland/meta-wayland-keyboard.c
@@ -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;
+ else
+ locked &= ~numlock;
+
xkb_info->state = xkb_state_new (xkb_info->keymap);
layout_idx = meta_backend_get_keymap_layout_group (backend);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]