From c70df62ce58ec03f407a57e7e1195dcb7219bc7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 15 Sep 2016 08:31:05 +0200 Subject: [PATCH] Pass all key events during Alt+Tab to the Wayland Seat When Alt+(Shift)+Tab is grabbed we have the modifier press key being passed to the Wayland server as key events are not yet grabbed. As KWin grabbed the release event the Wayland server considered the key still as pressed when going into the next application. This change ensures that all events are also passed to the wayland server. As no surface has focus we can be sure that it won't be passed to the application, but it ensures that the events are processed correctly. Reviewed-By: bshah --- input.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/input.cpp b/input.cpp index f95eb4e6a2..17edd484b7 100644 --- a/input.cpp +++ b/input.cpp @@ -744,7 +744,21 @@ public: if (!TabBox::TabBox::self() || !TabBox::TabBox::self()->isGrabbed()) { return false; } - waylandServer()->seat()->setFocusedKeyboardSurface(nullptr); + auto seat = waylandServer()->seat(); + seat->setFocusedKeyboardSurface(nullptr); + // pass the key event to the seat, so that it has a proper model of the currently hold keys + // this is important for combinations like alt+shift to ensure that shift is not considered pressed + switch (event->type()) { + case QEvent::KeyPress: + seat->keyPressed(event->nativeScanCode()); + break; + case QEvent::KeyRelease: + seat->keyReleased(event->nativeScanCode()); + break; + default: + break; + } + if (event->type() == QEvent::KeyPress) { TabBox::TabBox::self()->keyPress(event->modifiers() | event->key()); } else if (input()->keyboard()->xkb()->modifiersRelevantForGlobalShortcuts() == Qt::NoModifier) {