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()); QVERIFY(spy.isValid());
s->reserve(KWin::ElectricLeft, &callback, "callback"); s->reserve(KWin::ElectricLeft, &callback, "callback");
s->reserve(KWin::ElectricBottomRight, &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 // currently there is no active client yet, so check blocking shouldn't do anything
emit s->checkBlocking(); emit s->checkBlocking();
for (auto e: s->findChildren<Edge*>()) {
QCOMPARE(e->activatesForTouchGesture(), e->border() == KWin::ElectricRight);
}
xcb_enter_notify_event_t event; xcb_enter_notify_event_t event;
Cursor::setPos(0, 50); 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 // 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*>()) { for (auto e: s->findChildren<Edge*>()) {
e->checkBlocking(); e->checkBlocking();
QCOMPARE(e->activatesForTouchGesture(), false);
} }
// calling again should not trigger // calling again should not trigger
QTest::qWait(160); QTest::qWait(160);
@ -691,6 +697,9 @@ void TestScreenEdges::testFullScreenBlocking()
// let's make the client not fullscreen, which should trigger // let's make the client not fullscreen, which should trigger
client.setFullScreen(false); client.setFullScreen(false);
emit s->checkBlocking(); emit s->checkBlocking();
for (auto e: s->findChildren<Edge*>()) {
QCOMPARE(e->activatesForTouchGesture(), e->border() == KWin::ElectricRight);
}
event.time = QDateTime::currentMSecsSinceEpoch(); event.time = QDateTime::currentMSecsSinceEpoch();
QVERIFY(s->isEntered(&event)); QVERIFY(s->isEntered(&event));
QVERIFY(!spy.isEmpty()); QVERIFY(!spy.isEmpty());

View file

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