Merge branch 'Plasma/5.9' into Plasma/5.10

This commit is contained in:
Martin Flöser 2017-05-12 07:08:04 +02:00
commit 6a4e9cbb58
3 changed files with 9 additions and 6 deletions

View file

@ -340,16 +340,17 @@ void TestPointerConstraints::testBreakConstrainedPointer()
// now try to break // now try to break
quint32 timestamp = 0; quint32 timestamp = 0;
kwinApp()->platform()->keyboardKeyPressed(KEY_ESC, timestamp++); kwinApp()->platform()->keyboardKeyPressed(KEY_ESC, timestamp++);
QVERIFY(keyboardLeftSpy.wait()); QVERIFY(keyChangedSpy.wait());
// and just waiting should break constrain // and just waiting should break constrain
QVERIFY(unlockedSpy.wait()); QVERIFY(unlockedSpy.wait());
QCOMPARE(keyboardLeftSpy.count(), 1);
QCOMPARE(input()->pointer()->isConstrained(), false); QCOMPARE(input()->pointer()->isConstrained(), false);
// and should enter again // and should enter again
QTRY_COMPARE(keyboardEnteredSpy.count(), 2); QTRY_COMPARE(keyboardEnteredSpy.count(), 2);
QCOMPARE(waylandServer()->seat()->focusedKeyboardSurface(), c->surface()); QCOMPARE(waylandServer()->seat()->focusedKeyboardSurface(), c->surface());
kwinApp()->platform()->keyboardKeyReleased(KEY_ESC, timestamp++); kwinApp()->platform()->keyboardKeyReleased(KEY_ESC, timestamp++);
QVERIFY(!keyChangedSpy.wait()); QVERIFY(!keyChangedSpy.wait());
QVERIFY(keyChangedSpy.isEmpty()); QCOMPARE(keyChangedSpy.count(), 1);
// now lock again // now lock again
// need to move out and in // need to move out and in

View file

@ -404,6 +404,10 @@ public:
{ {
QObject::connect(m_timer.data(), &QTimer::timeout, QObject::connect(m_timer.data(), &QTimer::timeout,
[this] { [this] {
if (waylandServer()) {
// break keyboard focus, this cancels the pressed ESC
waylandServer()->seat()->setFocusedKeyboardSurface(nullptr);
}
input()->pointer()->breakPointerConstraints(); input()->pointer()->breakPointerConstraints();
input()->pointer()->blockPointerConstraints(); input()->pointer()->blockPointerConstraints();
// TODO: show notification // TODO: show notification
@ -435,10 +439,8 @@ public:
static_cast<KeyEvent*>(event)->modifiersRelevantForGlobalShortcuts() == Qt::KeyboardModifiers()) { static_cast<KeyEvent*>(event)->modifiersRelevantForGlobalShortcuts() == Qt::KeyboardModifiers()) {
// TODO: don't hard code // TODO: don't hard code
m_timer->start(3000); m_timer->start(3000);
input()->keyboard()->update();
m_keyCode = event->nativeScanCode(); m_keyCode = event->nativeScanCode();
passToWaylandServer(event); return false;
return true;
} }
} }
return false; return false;

View file

@ -171,7 +171,7 @@ void KeyboardInputRedirection::update()
break; break;
} while (it != stacking.begin()); } while (it != stacking.begin());
} }
} else if (!input()->isSelectingWindow() && !input()->isBreakingPointerConstraints()) { } else if (!input()->isSelectingWindow()) {
found = workspace()->activeClient(); found = workspace()->activeClient();
} }
if (found && found->surface()) { if (found && found->surface()) {