[clutter/clutter-1.16] evdev: update the state of the core pointer and core keyboard for all events



commit dd940a71b1b48541fc2410a8d6b49dbb0659c662
Author: Giovanni Campagna <gcampagn redhat com>
Date:   Wed Sep 4 13:36:41 2013 +0200

    evdev: update the state of the core pointer and core keyboard for all events
    
    These two devices are logically tied togheter, and their state
    should always be the same. Also, we need to update them after
    the event is queued, as the current modifier state (as opposed to the
    modifier mask in the event) should include also the effect of the last
    key press/release.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=706494

 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 08ea172..e8404bc 100644
--- a/clutter/evdev/clutter-device-manager-evdev.c
+++ b/clutter/evdev/clutter-device-manager-evdev.c
@@ -544,9 +544,21 @@ clutter_event_dispatch (GSource     *g_source,
 
   if (event)
     {
+      ClutterModifierType event_state;
+      ClutterInputDevice *input_device;
+      ClutterDeviceManagerEvdev *manager_evdev;
+
+      input_device = CLUTTER_INPUT_DEVICE (source->device);
+      manager_evdev = CLUTTER_DEVICE_MANAGER_EVDEV (input_device->device_manager);
+
       /* forward the event into clutter for emission etc. */
       clutter_do_event (event);
       clutter_event_free (event);
+
+      /* update the device states *after* the event */
+      event_state = xkb_state_serialize_mods (manager_evdev->priv->xkb, XKB_STATE_MODS_EFFECTIVE);
+      _clutter_input_device_set_state (manager_evdev->priv->core_pointer, event_state);
+      _clutter_input_device_set_state (manager_evdev->priv->core_keyboard, event_state);
     }
 
 out:


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