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
This commit is contained in:
parent
145d11227a
commit
32ce45aa89
@ -1116,7 +1116,7 @@ process_device_event (ClutterDeviceManagerEvdev *manager_evdev,
|
|||||||
{
|
{
|
||||||
case LIBINPUT_EVENT_KEYBOARD_KEY:
|
case LIBINPUT_EVENT_KEYBOARD_KEY:
|
||||||
{
|
{
|
||||||
guint32 time, key, key_state;
|
guint32 time, key, key_state, seat_key_count;
|
||||||
struct libinput_event_keyboard *key_event =
|
struct libinput_event_keyboard *key_event =
|
||||||
libinput_event_get_keyboard_event (event);
|
libinput_event_get_keyboard_event (event);
|
||||||
device = libinput_device_get_user_data (libinput_device);
|
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 = libinput_event_keyboard_get_key (key_event);
|
||||||
key_state = libinput_event_keyboard_get_key_state (key_event) ==
|
key_state = libinput_event_keyboard_get_key_state (key_event) ==
|
||||||
LIBINPUT_KEY_STATE_PRESSED;
|
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);
|
notify_key_device (device, time, key, key_state, TRUE);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user