From e9a44a275e747c24afab04b22b1a68f75bc8a75f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 11 Apr 2017 20:59:54 +0200 Subject: [PATCH] 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 --- autotests/test_screen_edges.cpp | 9 +++++++++ screenedge.cpp | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/autotests/test_screen_edges.cpp b/autotests/test_screen_edges.cpp index ba97d52819..e26459e5c2 100644 --- a/autotests/test_screen_edges.cpp +++ b/autotests/test_screen_edges.cpp @@ -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()) { + 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()) { 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()) { + QCOMPARE(e->activatesForTouchGesture(), e->border() == KWin::ElectricRight); + } event.time = QDateTime::currentMSecsSinceEpoch(); QVERIFY(s->isEntered(&event)); QVERIFY(!spy.isEmpty()); diff --git a/screenedge.cpp b/screenedge.cpp index a5fe4c9ac5..589c1d03f2 100644 --- a/screenedge.cpp +++ b/screenedge.cpp @@ -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(); }