From 945ee5764af31a0471c8410b094b41f343afd67a Mon Sep 17 00:00:00 2001 From: Rui Matos Date: Mon, 20 Jan 2014 13:47:06 +0100 Subject: [PATCH] evdev: Keep latched and locked modifier state when switching keymaps https://bugzilla.gnome.org/show_bug.cgi?id=725102 --- clutter/evdev/clutter-device-manager-evdev.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/clutter/evdev/clutter-device-manager-evdev.c b/clutter/evdev/clutter-device-manager-evdev.c index 391a542d4..2ad6ad34c 100644 --- a/clutter/evdev/clutter-device-manager-evdev.c +++ b/clutter/evdev/clutter-device-manager-evdev.c @@ -1514,6 +1514,8 @@ clutter_evdev_set_keyboard_map (ClutterDeviceManager *evdev, GSList *iter; ClutterSeatEvdev *seat; unsigned int i; + xkb_mod_mask_t latched_mods; + xkb_mod_mask_t locked_mods; g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER_EVDEV (evdev)); @@ -1524,9 +1526,19 @@ clutter_evdev_set_keyboard_map (ClutterDeviceManager *evdev, { seat = iter->data; + latched_mods = xkb_state_serialize_mods (seat->xkb, + XKB_STATE_MODS_LATCHED); + locked_mods = xkb_state_serialize_mods (seat->xkb, + XKB_STATE_MODS_LOCKED); xkb_state_unref (seat->xkb); seat->xkb = xkb_state_new (keymap); + xkb_state_update_mask (seat->xkb, + 0, /* depressed */ + latched_mods, + locked_mods, + 0, 0, 0); + seat->caps_lock_led = xkb_keymap_led_get_index (keymap, XKB_LED_NAME_CAPS); seat->num_lock_led = xkb_keymap_led_get_index (keymap, XKB_LED_NAME_NUM); seat->scroll_lock_led = xkb_keymap_led_get_index (keymap, XKB_LED_NAME_SCROLL);