From e38d56b0ddf1dc7820d666b31306ddc2a295481f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 2 Dec 2014 10:52:16 +0100 Subject: [PATCH] Move QuickTileMode from KDecorationDefines to Client --- client.h | 14 ++++++++++++++ decorations/decoratedclient.cpp | 14 +++++++------- placement.cpp | 12 ++++++------ 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/client.h b/client.h index 17c91a0984..6dad332cae 100644 --- a/client.h +++ b/client.h @@ -385,6 +385,19 @@ public: bool isMaximizable() const; QRect geometryRestore() const; MaximizeMode maximizeMode() const; + + enum QuickTileFlag { + QuickTileNone = 0, + QuickTileLeft = 1, + QuickTileRight = 1<<1, + QuickTileTop = 1<<2, + QuickTileBottom = 1<<3, + QuickTileHorizontal = QuickTileLeft|QuickTileRight, + QuickTileVertical = QuickTileTop|QuickTileBottom, + QuickTileMaximize = QuickTileLeft|QuickTileRight|QuickTileTop|QuickTileBottom + }; + + Q_DECLARE_FLAGS(QuickTileMode, QuickTileFlag) QuickTileMode quickTileMode() const; bool isMinimizable() const; void setMaximize(bool vertically, bool horizontally); @@ -1274,5 +1287,6 @@ inline void Client::print(T &stream) const } // namespace Q_DECLARE_METATYPE(KWin::Client*) Q_DECLARE_METATYPE(QList) +Q_DECLARE_OPERATORS_FOR_FLAGS(KWin::Client::QuickTileMode) #endif diff --git a/decorations/decoratedclient.cpp b/decorations/decoratedclient.cpp index d67a8743fc..df1ee2fa73 100644 --- a/decorations/decoratedclient.cpp +++ b/decorations/decoratedclient.cpp @@ -203,25 +203,25 @@ bool DecoratedClientImpl::isMaximizedHorizontally() const Qt::Edges DecoratedClientImpl::adjacentScreenEdges() const { Qt::Edges edges; - const KDecorationDefines::QuickTileMode mode = m_client->quickTileMode(); - if (mode.testFlag(KDecorationDefines::QuickTileLeft)) { + const Client::QuickTileMode mode = m_client->quickTileMode(); + if (mode.testFlag(Client::QuickTileLeft)) { edges |= Qt::LeftEdge; - if (!mode.testFlag(KDecorationDefines::QuickTileTop) && !mode.testFlag(KDecorationDefines::QuickTileBottom)) { + if (!mode.testFlag(Client::QuickTileTop) && !mode.testFlag(Client::QuickTileBottom)) { // using complete side edges |= Qt::TopEdge | Qt::BottomEdge; } } - if (mode.testFlag(KDecorationDefines::QuickTileTop)) { + if (mode.testFlag(Client::QuickTileTop)) { edges |= Qt::TopEdge; } - if (mode.testFlag(KDecorationDefines::QuickTileRight)) { + if (mode.testFlag(Client::QuickTileRight)) { edges |= Qt::RightEdge; - if (!mode.testFlag(KDecorationDefines::QuickTileTop) && !mode.testFlag(KDecorationDefines::QuickTileBottom)) { + if (!mode.testFlag(Client::QuickTileTop) && !mode.testFlag(Client::QuickTileBottom)) { // using complete side edges |= Qt::TopEdge | Qt::BottomEdge; } } - if (mode.testFlag(KDecorationDefines::QuickTileBottom)) { + if (mode.testFlag(Client::QuickTileBottom)) { edges |= Qt::BottomEdge; } return edges; diff --git a/placement.cpp b/placement.cpp index 7df62d3d90..a0dc2832dd 100644 --- a/placement.cpp +++ b/placement.cpp @@ -798,7 +798,7 @@ void Workspace::slotWindowQuickTileLeft() if (!active_client) return; - active_client->setQuickTileMode(QuickTileLeft, true); + active_client->setQuickTileMode(Client::QuickTileLeft, true); } void Workspace::slotWindowQuickTileRight() @@ -806,7 +806,7 @@ void Workspace::slotWindowQuickTileRight() if (!active_client) return; - active_client->setQuickTileMode(QuickTileRight, true); + active_client->setQuickTileMode(Client::QuickTileRight, true); } void Workspace::slotWindowQuickTileTopLeft() @@ -814,7 +814,7 @@ void Workspace::slotWindowQuickTileTopLeft() if (!active_client) { return; } - active_client->setQuickTileMode(QuickTileTop|QuickTileLeft, true); + active_client->setQuickTileMode(Client::QuickTileTop|Client::QuickTileLeft, true); } void Workspace::slotWindowQuickTileTopRight() @@ -822,7 +822,7 @@ void Workspace::slotWindowQuickTileTopRight() if (!active_client) { return; } - active_client->setQuickTileMode(QuickTileTop|QuickTileRight, true); + active_client->setQuickTileMode(Client::QuickTileTop|Client::QuickTileRight, true); } void Workspace::slotWindowQuickTileBottomLeft() @@ -830,7 +830,7 @@ void Workspace::slotWindowQuickTileBottomLeft() if (!active_client) { return; } - active_client->setQuickTileMode(QuickTileBottom|QuickTileLeft, true); + active_client->setQuickTileMode(Client::QuickTileBottom|Client::QuickTileLeft, true); } void Workspace::slotWindowQuickTileBottomRight() @@ -838,7 +838,7 @@ void Workspace::slotWindowQuickTileBottomRight() if (!active_client) { return; } - active_client->setQuickTileMode(QuickTileBottom|QuickTileRight, true); + active_client->setQuickTileMode(Client::QuickTileBottom|Client::QuickTileRight, true); } int Workspace::packPositionLeft(const Client* cl, int oldx, bool left_edge) const