evdev: add master / slave device handling

All evdev devices are slave devices, which means that xkb state
and pointer position must be shared by emulating a core keyboard
and a core pointer. Also, we must make sure to add all modifier
state (keyboard and button) to our events.

https://bugzilla.gnome.org/show_bug.cgi?id=705710
This commit is contained in:
Giovanni Campagna
2013-08-09 11:53:46 +02:00
parent f749858df3
commit 786532213b
4 changed files with 139 additions and 105 deletions

View File

@ -42,8 +42,10 @@
*/
ClutterEvent *
_clutter_key_event_new_from_evdev (ClutterInputDevice *device,
ClutterInputDevice *core_device,
ClutterStage *stage,
struct xkb_state *xkb_state,
uint32_t button_state,
uint32_t _time,
xkb_keycode_t key,
uint32_t state)
@ -71,13 +73,15 @@ _clutter_key_event_new_from_evdev (ClutterInputDevice *device,
else
sym = XKB_KEY_NoSymbol;
event->key.device = device;
event->key.device = core_device;
event->key.stage = stage;
event->key.time = _time;
event->key.modifier_state =
xkb_state_serialize_mods (xkb_state, XKB_STATE_EFFECTIVE);
event->key.modifier_state |= button_state;
event->key.hardware_keycode = key;
event->key.keyval = sym;
clutter_event_set_source_device (event, device);
n = xkb_keysym_to_utf8 (sym, buffer, sizeof (buffer));