[clutter] evdev: Ignore non seat wide pointer button events



commit e9e9578dca773f1592b366376d5e4a75719f0bbd
Author: Jonas Ådahl <jadahl gmail com>
Date:   Wed Jan 28 12:12:48 2015 +0800

    evdev: Ignore non seat wide pointer button events
    
    Pointer button events will be received from a device where a button has
    been pressed, even though an equivalent button has been pressed (same
    button code) on a device connected to the same seat. notify_button()
    expects to only be called as if there was only one pointer 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 9158a18..f88612f 100644
--- a/clutter/evdev/clutter-device-manager-evdev.c
+++ b/clutter/evdev/clutter-device-manager-evdev.c
@@ -1185,7 +1185,7 @@ process_device_event (ClutterDeviceManagerEvdev *manager_evdev,
 
     case LIBINPUT_EVENT_POINTER_BUTTON:
       {
-        guint32 time, button, button_state;
+        guint32 time, button, button_state, seat_button_count;
         struct libinput_event_pointer *button_event =
           libinput_event_get_pointer_event (event);
         device = libinput_device_get_user_data (libinput_device);
@@ -1194,6 +1194,16 @@ process_device_event (ClutterDeviceManagerEvdev *manager_evdev,
         button = libinput_event_pointer_get_button (button_event);
         button_state = libinput_event_pointer_get_button_state (button_event) ==
                        LIBINPUT_BUTTON_STATE_PRESSED;
+        seat_button_count =
+          libinput_event_pointer_get_seat_button_count (button_event);
+
+        /* Ignore button events that are not seat wide state changes. */
+        if ((button_state == LIBINPUT_BUTTON_STATE_PRESSED &&
+             seat_button_count != 1) ||
+            (button_state == LIBINPUT_BUTTON_STATE_RELEASED &&
+             seat_button_count != 0))
+          break;
+
         notify_button (device, time, button, button_state);
 
         break;


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