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
This commit is contained in:
Rui Matos 2013-03-06 01:30:52 +01:00
parent ccea1644ba
commit 40ef7a5f6e
3 changed files with 20 additions and 9 deletions

View File

@ -765,7 +765,7 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
event->key.time = xev->time; event->key.time = xev->time;
event->key.stage = stage; event->key.stage = stage;
event->key.modifier_state = 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; event->key.hardware_keycode = xev->detail;
/* keyval is the key ignoring all modifiers ('1' vs. '!') */ /* 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.y = xev->event_y;
event->scroll.modifier_state = event->scroll.modifier_state =
_clutter_input_device_xi2_translate_state (&xev->mods, _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_source_device (event, source_device);
clutter_event_set_device (event, 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.button = xev->detail;
event->button.modifier_state = event->button.modifier_state =
_clutter_input_device_xi2_translate_state (&xev->mods, _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_source_device (event, source_device);
clutter_event_set_device (event, 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.y = xev->event_y;
event->scroll.modifier_state = event->scroll.modifier_state =
_clutter_input_device_xi2_translate_state (&xev->mods, _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_scroll_delta (event, delta_x, delta_y);
clutter_event_set_source_device (event, source_device); 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.y = xev->event_y;
event->motion.modifier_state = event->motion.modifier_state =
_clutter_input_device_xi2_translate_state (&xev->mods, _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_source_device (event, source_device);
clutter_event_set_device (event, 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.y = xev->event_y;
event->touch.modifier_state = event->touch.modifier_state =
_clutter_input_device_xi2_translate_state (&xev->mods, _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_source_device (event, source_device);
@ -1151,7 +1156,8 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
event->touch.modifier_state = event->touch.modifier_state =
_clutter_input_device_xi2_translate_state (&xev->mods, _clutter_input_device_xi2_translate_state (&xev->mods,
&xev->buttons); &xev->buttons,
&xev->group);
event->touch.modifier_state |= CLUTTER_BUTTON1_MASK; event->touch.modifier_state |= CLUTTER_BUTTON1_MASK;
if (xev->flags & XITouchEmulatingPointer) if (xev->flags & XITouchEmulatingPointer)

View File

@ -158,7 +158,8 @@ clutter_input_device_xi2_init (ClutterInputDeviceXI2 *self)
guint guint
_clutter_input_device_xi2_translate_state (XIModifierState *modifiers_state, _clutter_input_device_xi2_translate_state (XIModifierState *modifiers_state,
XIButtonState *buttons_state) XIButtonState *buttons_state,
XIGroupState *group_state)
{ {
guint retval = 0; 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; return retval;
} }

View File

@ -38,7 +38,8 @@ typedef struct _ClutterInputDeviceXI2 ClutterInputDeviceXI2;
GType _clutter_input_device_xi2_get_type (void) G_GNUC_CONST; GType _clutter_input_device_xi2_get_type (void) G_GNUC_CONST;
guint _clutter_input_device_xi2_translate_state (XIModifierState *modifiers_state, guint _clutter_input_device_xi2_translate_state (XIModifierState *modifiers_state,
XIButtonState *buttons_state); XIButtonState *buttons_state,
XIGroupState *group_state);
G_END_DECLS G_END_DECLS