Fix switch desktop through edge when moving window

Summary:
There was a regression introduced in ScreenEdges when introducing the
activatesForPointer method. It considered the switch desktop on edge,
but not the special case of switch desktop when moving windows. Due to
that the edges did not activate when moving the window.

This change addresses the regression and extends the autotest to ensure
it's properly covered.

BUG: 380440
FIXED-IN: 5.10.3

Test Plan: Manual testing and extended auto test

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6257
This commit is contained in:
Martin Flöser 2017-06-18 13:36:27 +02:00
parent a6dee74ee4
commit c45e165514
6 changed files with 41 additions and 7 deletions

View file

@ -30,6 +30,7 @@ AbstractClient::AbstractClient(QObject *parent)
, m_hiddenInternal(false)
, m_keepBelow(false)
, m_geometry()
, m_resize(false)
{
}
@ -103,4 +104,14 @@ void AbstractClient::setKeepBelow(bool keepBelow)
emit keepBelowChanged();
}
bool AbstractClient::isResize() const
{
return m_resize;
}
void AbstractClient::setResize(bool set)
{
m_resize = set;
}
}

View file

@ -47,6 +47,8 @@ public:
void setHiddenInternal(bool set);
void setGeometry(const QRect &rect);
void setKeepBelow(bool);
bool isResize() const;
void setResize(bool set);
virtual void showOnScreenEdge() = 0;
Q_SIGNALS:
@ -60,6 +62,7 @@ private:
bool m_hiddenInternal;
bool m_keepBelow;
QRect m_geometry;
bool m_resize;
};
}

View file

@ -35,9 +35,4 @@ void Client::showOnScreenEdge()
setHiddenInternal(false);
}
bool Client::isResize() const
{
return false;
}
}

View file

@ -34,8 +34,6 @@ class Client : public AbstractClient
public:
explicit Client(QObject *parent);
virtual ~Client();
bool isResize() const;
void showOnScreenEdge() override;
};

View file

@ -392,6 +392,27 @@ void TestScreenEdges::testCreatingInitialEdges()
QCOMPARE(e->activatesForTouchGesture(), false);
QCOMPARE(e->approachGeometry(), expectedGeometries.at(i*2+1));
}
// let's start a move of window.
Client client(workspace());
workspace()->setMovingClient(&client);
for (int i = 0; i < 8; ++i) {
auto e = edges.at(i);
QVERIFY(!e->isReserved());
QCOMPARE(e->activatesForPointer(), true);
QCOMPARE(e->activatesForTouchGesture(), false);
QCOMPARE(e->approachGeometry(), expectedGeometries.at(i*2+1));
}
// not for resize
client.setResize(true);
for (int i = 0; i < 8; ++i) {
auto e = edges.at(i);
QVERIFY(!e->isReserved());
QCOMPARE(e->activatesForPointer(), false);
QCOMPARE(e->activatesForTouchGesture(), false);
QCOMPARE(e->approachGeometry(), expectedGeometries.at(i*2+1));
}
workspace()->setMovingClient(nullptr);
}
void TestScreenEdges::testCallback()

View file

@ -183,6 +183,12 @@ bool Edge::activatesForPointer() const
if (m_edges->isDesktopSwitching()) {
return true;
}
if (m_edges->isDesktopSwitchingMovingClients()) {
auto c = Workspace::self()->getMovingClient();
if (c && !c->isResize()) {
return true;
}
}
if (!m_callBacks.isEmpty()) {
return true;
}