[clutter/clutter-1.18] evdev: Keep latched and locked modifier state when switching keymaps



commit 945ee5764af31a0471c8410b094b41f343afd67a
Author: Rui Matos <tiagomatos gmail com>
Date:   Mon Jan 20 13:47:06 2014 +0100

    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 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/clutter/evdev/clutter-device-manager-evdev.c b/clutter/evdev/clutter-device-manager-evdev.c
index 391a542..2ad6ad3 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]