[clutter] evdev: Ignore non seat wide keyboard key events



commit 32ce45aa894f54a3cabfac53a6733ac182a424e8
Author: Jonas Ådahl <jadahl gmail com>
Date:   Wed Jan 28 12:11:34 2015 +0800

    evdev: Ignore non seat wide keyboard key events
    
    Keyboard key events will be received from a device where a key has
    been pressed, even though an equivalent key has been pressed (same
    key code) on a device connected to the same seat. notify_key()
    expects to only be called as if there was only one keyboard device
    associated with the given seat, so to achieve this, ignore every event
    where forwarding it would result in multiple 'pressed' or 'released'
    notifications.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=743615

 clutter/evdev/clutter-device-manager-evdev.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/clutter/evdev/clutter-device-manager-evdev.c b/clutter/evdev/clutter-device-manager-evdev.c
index 2b3828a..9158a18 100644
--- a/clutter/evdev/clutter-device-manager-evdev.c
+++ b/clutter/evdev/clutter-device-manager-evdev.c
@@ -1116,7 +1116,7 @@ process_device_event (ClutterDeviceManagerEvdev *manager_evdev,
     {
     case LIBINPUT_EVENT_KEYBOARD_KEY:
       {
-        guint32 time, key, key_state;
+        guint32 time, key, key_state, seat_key_count;
         struct libinput_event_keyboard *key_event =
           libinput_event_get_keyboard_event (event);
         device = libinput_device_get_user_data (libinput_device);
@@ -1125,6 +1125,16 @@ process_device_event (ClutterDeviceManagerEvdev *manager_evdev,
         key = libinput_event_keyboard_get_key (key_event);
         key_state = libinput_event_keyboard_get_key_state (key_event) ==
                     LIBINPUT_KEY_STATE_PRESSED;
+        seat_key_count =
+          libinput_event_keyboard_get_seat_key_count (key_event);
+
+       /* Ignore key events that are not seat wide state changes. */
+       if ((key_state == LIBINPUT_KEY_STATE_PRESSED &&
+            seat_key_count != 1) ||
+           (key_state == LIBINPUT_KEY_STATE_RELEASED &&
+            seat_key_count != 0))
+          break;
+
         notify_key_device (device, time, key, key_state, TRUE);
 
         break;


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