Commit 9b8836b4 authored by Martin Flöser's avatar Martin Flöser

Move (set)electricBorderMode() from Client to AbstractClient

While it was public in Client, it was not used anywhere outside of
Client, because of that it's only protected in AbstractClient.
parent b489ebab
......@@ -513,6 +513,12 @@ protected:
virtual bool isActiveFullScreen() const;
virtual Layer layerForDock() const;
// electric border / quick tiling
void setElectricBorderMode(QuickTileMode mode);
QuickTileMode electricBorderMode() const {
return m_electricMode;
}
private:
void handlePaletteChange();
QSharedPointer<TabBox::TabBoxClientImpl> m_tabBoxClient;
......@@ -544,6 +550,9 @@ private:
QList<AbstractClient*> m_transients;
bool m_modal = false;
Layer m_layer = UnknownLayer;
// electric border/quick tiling
QuickTileMode m_electricMode = QuickTileNone;
};
inline void AbstractClient::move(const QPoint& p, ForceGeometry_t force)
......
......@@ -293,8 +293,6 @@ public:
void resizeWithChecks(int w, int h, ForceGeometry_t force = NormalGeometrySet) override;
void resizeWithChecks(int w, int h, xcb_gravity_t gravity, ForceGeometry_t force = NormalGeometrySet);
void resizeWithChecks(const QSize& s, xcb_gravity_t gravity, ForceGeometry_t force = NormalGeometrySet);
void setElectricBorderMode(QuickTileMode mode);
QuickTileMode electricBorderMode() const;
void setElectricBorderMaximizing(bool maximizing);
bool isElectricBorderMaximizing() const;
QRect electricBorderMaximizeGeometry(QPoint pos, int desktop);
......@@ -761,7 +759,6 @@ private:
friend class GeometryUpdatesBlocker;
bool electricMaximizing;
QuickTileMode electricMode;
QTimer* m_electricMaximizingDelay;
friend bool performTransiencyCheck();
......
......@@ -1355,7 +1355,7 @@ void Client::checkQuickTilingMaximizationZones(int xroot, int yroot)
}
break; // no point in checking other screens to contain this... "point"...
}
if (mode != electricMode) {
if (mode != electricBorderMode()) {
setElectricBorderMode(mode);
if (innerBorder) {
if (!m_electricMaximizingDelay) {
......@@ -1364,7 +1364,7 @@ void Client::checkQuickTilingMaximizationZones(int xroot, int yroot)
m_electricMaximizingDelay->setSingleShot(true);
connect(m_electricMaximizingDelay, &QTimer::timeout, [this]() {
if (isMove())
setElectricBorderMaximizing(electricMode != QuickTileNone);
setElectricBorderMaximizing(electricBorderMode() != QuickTileNone);
});
}
m_electricMaximizingDelay->start();
......
......@@ -2696,7 +2696,7 @@ void Client::finishMoveResize(bool cancel)
}
if (isElectricBorderMaximizing()) {
setQuickTileMode(electricMode);
setQuickTileMode(electricBorderMode());
electricMaximizing = false;
} else if (!cancel) {
if (!(maximizeMode() & MaximizeHorizontal)) {
......@@ -3177,7 +3177,7 @@ void Client::performMoveResize()
emit clientStepUserMovedResized(this, moveResizeGeom);
}
void Client::setElectricBorderMode(QuickTileMode mode)
void AbstractClient::setElectricBorderMode(QuickTileMode mode)
{
if (mode != QuickTileMaximize) {
// sanitize the mode, ie. simplify "invalid" combinations
......@@ -3186,12 +3186,7 @@ void Client::setElectricBorderMode(QuickTileMode mode)
if ((mode & QuickTileVertical) == QuickTileVertical)
mode &= ~QuickTileVertical;
}
electricMode = mode;
}
Client::QuickTileMode Client::electricBorderMode() const
{
return electricMode;
m_electricMode = mode;
}
bool Client::isElectricBorderMaximizing() const
......@@ -3211,7 +3206,7 @@ void Client::setElectricBorderMaximizing(bool maximizing)
QRect Client::electricBorderMaximizeGeometry(QPoint pos, int desktop)
{
if (electricMode == QuickTileMaximize) {
if (electricBorderMode() == QuickTileMaximize) {
if (maximizeMode() == MaximizeFull)
return geometryRestore();
else
......@@ -3219,13 +3214,13 @@ QRect Client::electricBorderMaximizeGeometry(QPoint pos, int desktop)
}
QRect ret = workspace()->clientArea(MaximizeArea, pos, desktop);
if (electricMode & QuickTileLeft)
if (electricBorderMode() & QuickTileLeft)
ret.setRight(ret.left()+ret.width()/2 - 1);
else if (electricMode & QuickTileRight)
else if (electricBorderMode() & QuickTileRight)
ret.setLeft(ret.right()-(ret.width()-ret.width()/2) + 1);
if (electricMode & QuickTileTop)
if (electricBorderMode() & QuickTileTop)
ret.setBottom(ret.top()+ret.height()/2 - 1);
else if (electricMode & QuickTileBottom)
else if (electricBorderMode() & QuickTileBottom)
ret.setTop(ret.bottom()-(ret.height()-ret.height()/2) + 1);
return ret;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment