[clutter/clutter-1.14] x11/xi2: Factor the XKB group state in to fill events' modifier_state



commit 7702893711348eac5484fb8f1b06575c15e9fe9b
Author: Rui Matos <tiagomatos gmail com>
Date:   Wed Mar 6 01:30:52 2013 +0100

    x11/xi2: Factor the XKB group state in to fill events' modifier_state
    
    Otherwise XkbTranslateKeyCode() won't yeld the correct keysyms when
    group > 1.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=695260

 clutter/x11/clutter-device-manager-xi2.c |   20 +++++++++++++-------
 clutter/x11/clutter-input-device-xi2.c   |    6 +++++-
 clutter/x11/clutter-input-device-xi2.h   |    3 ++-
 3 files changed, 20 insertions(+), 9 deletions(-)
---
diff --git a/clutter/x11/clutter-device-manager-xi2.c b/clutter/x11/clutter-device-manager-xi2.c
index d75485d..6a06cec 100644
--- a/clutter/x11/clutter-device-manager-xi2.c
+++ b/clutter/x11/clutter-device-manager-xi2.c
@@ -765,7 +765,7 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
         event->key.time = xev->time;
         event->key.stage = stage;
         event->key.modifier_state =
-          _clutter_input_device_xi2_translate_state (&xev->mods, &xev->buttons);
+          _clutter_input_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group);
         event->key.hardware_keycode = xev->detail;
 
           /* keyval is the key ignoring all modifiers ('1' vs. '!') */
@@ -875,7 +875,8 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
             event->scroll.y = xev->event_y;
             event->scroll.modifier_state =
               _clutter_input_device_xi2_translate_state (&xev->mods,
-                                                         &xev->buttons);
+                                                         &xev->buttons,
+                                                         &xev->group);
 
             clutter_event_set_source_device (event, source_device);
             clutter_event_set_device (event, device);
@@ -923,7 +924,8 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
             event->button.button = xev->detail;
             event->button.modifier_state =
               _clutter_input_device_xi2_translate_state (&xev->mods,
-                                                         &xev->buttons);
+                                                         &xev->buttons,
+                                                         &xev->group);
 
             clutter_event_set_source_device (event, source_device);
             clutter_event_set_device (event, device);
@@ -1004,7 +1006,8 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
             event->scroll.y = xev->event_y;
             event->scroll.modifier_state =
               _clutter_input_device_xi2_translate_state (&xev->mods,
-                                                         &xev->buttons);
+                                                         &xev->buttons,
+                                                         &xev->group);
 
             clutter_event_set_scroll_delta (event, delta_x, delta_y);
             clutter_event_set_source_device (event, source_device);
@@ -1032,7 +1035,8 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
         event->motion.y = xev->event_y;
         event->motion.modifier_state =
           _clutter_input_device_xi2_translate_state (&xev->mods,
-                                                     &xev->buttons);
+                                                     &xev->buttons,
+                                                     &xev->group);
 
         clutter_event_set_source_device (event, source_device);
         clutter_event_set_device (event, device);
@@ -1083,7 +1087,8 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
         event->touch.y = xev->event_y;
         event->touch.modifier_state =
           _clutter_input_device_xi2_translate_state (&xev->mods,
-                                                     &xev->buttons);
+                                                     &xev->buttons,
+                                                     &xev->group);
 
         clutter_event_set_source_device (event, source_device);
 
@@ -1151,7 +1156,8 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
 
         event->touch.modifier_state =
           _clutter_input_device_xi2_translate_state (&xev->mods,
-                                                     &xev->buttons);
+                                                     &xev->buttons,
+                                                     &xev->group);
         event->touch.modifier_state |= CLUTTER_BUTTON1_MASK;
 
         if (xev->flags & XITouchEmulatingPointer)
diff --git a/clutter/x11/clutter-input-device-xi2.c b/clutter/x11/clutter-input-device-xi2.c
index c2b0d18..5923977 100644
--- a/clutter/x11/clutter-input-device-xi2.c
+++ b/clutter/x11/clutter-input-device-xi2.c
@@ -158,7 +158,8 @@ clutter_input_device_xi2_init (ClutterInputDeviceXI2 *self)
 
 guint
 _clutter_input_device_xi2_translate_state (XIModifierState *modifiers_state,
-                                           XIButtonState   *buttons_state)
+                                           XIButtonState   *buttons_state,
+                                           XIGroupState    *group_state)
 {
   guint retval = 0;
 
@@ -204,5 +205,8 @@ _clutter_input_device_xi2_translate_state (XIModifierState *modifiers_state,
         }
     }
 
+  if (group_state)
+    retval |= (group_state->effective) << 13;
+
   return retval;
 }
diff --git a/clutter/x11/clutter-input-device-xi2.h b/clutter/x11/clutter-input-device-xi2.h
index b16e172..b86401f 100644
--- a/clutter/x11/clutter-input-device-xi2.h
+++ b/clutter/x11/clutter-input-device-xi2.h
@@ -38,7 +38,8 @@ typedef struct _ClutterInputDeviceXI2           ClutterInputDeviceXI2;
 GType _clutter_input_device_xi2_get_type (void) G_GNUC_CONST;
 
 guint _clutter_input_device_xi2_translate_state (XIModifierState *modifiers_state,
-                                                 XIButtonState   *buttons_state);
+                                                 XIButtonState   *buttons_state,
+                                                 XIGroupState    *group_state);
 
 G_END_DECLS
 


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