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
This commit is contained in:
Martin Gräßlin 2016-09-15 08:31:05 +02:00
parent cd053bf864
commit c70df62ce5

View file

@ -744,7 +744,21 @@ public:
if (!TabBox::TabBox::self() || !TabBox::TabBox::self()->isGrabbed()) { if (!TabBox::TabBox::self() || !TabBox::TabBox::self()->isGrabbed()) {
return false; 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) { if (event->type() == QEvent::KeyPress) {
TabBox::TabBox::self()->keyPress(event->modifiers() | event->key()); TabBox::TabBox::self()->keyPress(event->modifiers() | event->key());
} else if (input()->keyboard()->xkb()->modifiersRelevantForGlobalShortcuts() == Qt::NoModifier) { } else if (input()->keyboard()->xkb()->modifiersRelevantForGlobalShortcuts() == Qt::NoModifier) {