From e9e9578dca773f1592b366376d5e4a75719f0bbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 28 Jan 2015 12:12:48 +0800 Subject: [PATCH] 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 file changed, 11 insertions(+), 1 deletion(-) diff --git a/clutter/evdev/clutter-device-manager-evdev.c b/clutter/evdev/clutter-device-manager-evdev.c index 9158a1898..f88612fd0 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;