diff --git a/src/backends/libinput/connection.cpp b/src/backends/libinput/connection.cpp index e161212164..be67a7ecc8 100644 --- a/src/backends/libinput/connection.cpp +++ b/src/backends/libinput/connection.cpp @@ -302,6 +302,12 @@ void Connection::processEvents() } case LIBINPUT_EVENT_KEYBOARD_KEY: { KeyEvent *ke = static_cast(event.get()); + const int seatKeyCount = libinput_event_keyboard_get_seat_key_count(*ke); + const int keyState = libinput_event_keyboard_get_key_state(*ke); + if ((keyState == LIBINPUT_KEY_STATE_PRESSED && seatKeyCount != 1) || + (keyState == LIBINPUT_KEY_STATE_RELEASED && seatKeyCount != 0)) { + break; + } Q_EMIT ke->device()->keyChanged(ke->key(), ke->state(), ke->time(), ke->device()); break; } @@ -349,6 +355,12 @@ void Connection::processEvents() } case LIBINPUT_EVENT_POINTER_BUTTON: { PointerEvent *pe = static_cast(event.get()); + const int seatButtonCount = libinput_event_pointer_get_seat_button_count(*pe); + const int buttonState = libinput_event_pointer_get_button_state(*pe); + if ((buttonState == LIBINPUT_BUTTON_STATE_PRESSED && seatButtonCount != 1) || + (buttonState == LIBINPUT_BUTTON_STATE_RELEASED && seatButtonCount != 0)) { + break; + } Q_EMIT pe->device()->pointerButtonChanged(pe->button(), pe->buttonState(), pe->time(), pe->device()); Q_EMIT pe->device()->pointerFrame(pe->device()); break;