From 32ce45aa894f54a3cabfac53a6733ac182a424e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 28 Jan 2015 12:11:34 +0800 Subject: [PATCH] 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 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 2b3828a2c..9158a1898 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;