diff --git a/autotests/integration/pointer_constraints_test.cpp b/autotests/integration/pointer_constraints_test.cpp --- a/autotests/integration/pointer_constraints_test.cpp +++ b/autotests/integration/pointer_constraints_test.cpp @@ -340,16 +340,17 @@ // now try to break quint32 timestamp = 0; kwinApp()->platform()->keyboardKeyPressed(KEY_ESC, timestamp++); - QVERIFY(keyboardLeftSpy.wait()); + QVERIFY(keyChangedSpy.wait()); // and just waiting should break constrain QVERIFY(unlockedSpy.wait()); + QCOMPARE(keyboardLeftSpy.count(), 1); QCOMPARE(input()->pointer()->isConstrained(), false); // and should enter again QTRY_COMPARE(keyboardEnteredSpy.count(), 2); QCOMPARE(waylandServer()->seat()->focusedKeyboardSurface(), c->surface()); kwinApp()->platform()->keyboardKeyReleased(KEY_ESC, timestamp++); QVERIFY(!keyChangedSpy.wait()); - QVERIFY(keyChangedSpy.isEmpty()); + QCOMPARE(keyChangedSpy.count(), 1); // now lock again // need to move out and in diff --git a/input.cpp b/input.cpp --- a/input.cpp +++ b/input.cpp @@ -404,6 +404,10 @@ { QObject::connect(m_timer.data(), &QTimer::timeout, [this] { + if (waylandServer()) { + // break keyboard focus, this cancels the pressed ESC + waylandServer()->seat()->setFocusedKeyboardSurface(nullptr); + } input()->pointer()->breakPointerConstraints(); input()->pointer()->blockPointerConstraints(); // TODO: show notification @@ -435,10 +439,8 @@ static_cast(event)->modifiersRelevantForGlobalShortcuts() == Qt::KeyboardModifiers()) { // TODO: don't hard code m_timer->start(3000); - input()->keyboard()->update(); m_keyCode = event->nativeScanCode(); - passToWaylandServer(event); - return true; + return false; } } return false; diff --git a/keyboard_input.cpp b/keyboard_input.cpp --- a/keyboard_input.cpp +++ b/keyboard_input.cpp @@ -171,7 +171,7 @@ break; } while (it != stacking.begin()); } - } else if (!input()->isSelectingWindow() && !input()->isBreakingPointerConstraints()) { + } else if (!input()->isSelectingWindow()) { found = workspace()->activeClient(); } if (found && found->surface()) {