summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2015-01-30 12:22:59 +0800
committerBryce Harrington <bryce@osg.samsung.com>2015-02-04 19:39:26 -0800
commite90b9e9b5958d3e613d7e08f58321fc664084dde (patch)
treef703f647f76905e316f0d5618955abaf9846079c
parent6b4b24155fb3f6fbfc98f38ba3eb5f2f3115371f (diff)
downloadweston-e90b9e9b5958d3e613d7e08f58321fc664084dde.tar.gz
libinput: Only forward first and last press and release for a button
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. Signed-off-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniels@collabora.com>
-rw-r--r--src/libinput-device.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libinput-device.c b/src/libinput-device.c
index 3ce74b8d..5c5b9b90 100644
--- a/src/libinput-device.c
+++ b/src/libinput-device.c
@@ -119,6 +119,17 @@ handle_pointer_button(struct libinput_device *libinput_device,
{
struct evdev_device *device =
libinput_device_get_user_data(libinput_device);
+ int button_state =
+ libinput_event_pointer_get_button_state(pointer_event);
+ int seat_button_count =
+ libinput_event_pointer_get_seat_button_count(pointer_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))
+ return;
notify_button(device->seat,
libinput_event_pointer_get_time(pointer_event),