Support blocking of screen edges on active fullscreen windows also for touch

Summary:
This change ensures that the blocking condition of screen edges is also
honored for touch screen swipe gestures.

Test Plan: Only the added test case

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5403
This commit is contained in:
Martin Gräßlin 2017-04-11 20:59:54 +02:00
parent b132fe7c24
commit e9a44a275e
2 changed files with 16 additions and 0 deletions

View file

@ -652,8 +652,13 @@ void TestScreenEdges::testFullScreenBlocking()
QVERIFY(spy.isValid());
s->reserve(KWin::ElectricLeft, &callback, "callback");
s->reserve(KWin::ElectricBottomRight, &callback, "callback");
QAction action;
s->reserveTouch(KWin::ElectricRight, &action);
// currently there is no active client yet, so check blocking shouldn't do anything
emit s->checkBlocking();
for (auto e: s->findChildren<Edge*>()) {
QCOMPARE(e->activatesForTouchGesture(), e->border() == KWin::ElectricRight);
}
xcb_enter_notify_event_t event;
Cursor::setPos(0, 50);
@ -678,6 +683,7 @@ void TestScreenEdges::testFullScreenBlocking()
// the signal doesn't trigger for corners, let's go over all windows just to be sure that it doesn't call for corners
for (auto e: s->findChildren<Edge*>()) {
e->checkBlocking();
QCOMPARE(e->activatesForTouchGesture(), false);
}
// calling again should not trigger
QTest::qWait(160);
@ -691,6 +697,9 @@ void TestScreenEdges::testFullScreenBlocking()
// let's make the client not fullscreen, which should trigger
client.setFullScreen(false);
emit s->checkBlocking();
for (auto e: s->findChildren<Edge*>()) {
QCOMPARE(e->activatesForTouchGesture(), e->border() == KWin::ElectricRight);
}
event.time = QDateTime::currentMSecsSinceEpoch();
QVERIFY(s->isEntered(&event));
QVERIFY(!spy.isEmpty());

View file

@ -197,6 +197,9 @@ bool Edge::activatesForTouchGesture() const
if (!isScreenEdge()) {
return false;
}
if (m_blocked) {
return false;
}
if (m_client) {
return true;
}
@ -538,7 +541,11 @@ void Edge::checkBlocking()
if (newValue == m_blocked) {
return;
}
const bool wasTouch = activatesForTouchGesture();
m_blocked = newValue;
if (wasTouch != activatesForTouchGesture()) {
emit activatesForTouchGestureChanged();
}
doUpdateBlocking();
}