Move QuickTileMode from KDecorationDefines to Client

This commit is contained in:
Martin Gräßlin 2014-12-02 10:52:16 +01:00
parent d4bf3602ce
commit e38d56b0dd
3 changed files with 27 additions and 13 deletions

View file

@ -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<KWin::Client*>)
Q_DECLARE_OPERATORS_FOR_FLAGS(KWin::Client::QuickTileMode)
#endif

View file

@ -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;

View file

@ -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