From b4fc4d72357e786e73609a542b12487da31f1320 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 16 Oct 2015 09:57:53 +0200 Subject: [PATCH] Move initialMoveResizeGeometry to AbstractClient --- abstract_client.cpp | 5 +++++ abstract_client.h | 8 ++++++++ client.h | 1 - geometry.cpp | 13 +++++++------ 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/abstract_client.cpp b/abstract_client.cpp index c417779f54..095d6fc3d9 100644 --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -1059,4 +1059,9 @@ void AbstractClient::doMove(int, int) { } +void AbstractClient::updateInitialMoveResizeGeometry() +{ + m_moveResize.initialGeometry = geometry(); +} + } diff --git a/abstract_client.h b/abstract_client.h index e1752be7bf..01989280f2 100644 --- a/abstract_client.h +++ b/abstract_client.h @@ -635,6 +635,13 @@ protected: void setInvertedMoveOffset(const QPoint &offset) { m_moveResize.invertedOffset = offset; } + QRect initialMoveResizeGeometry() const { + return m_moveResize.initialGeometry; + } + /** + * Sets the initial move resize geometry to the current geometry. + **/ + void updateInitialMoveResizeGeometry(); private: void handlePaletteChange(); @@ -687,6 +694,7 @@ private: bool unrestricted = false; QPoint offset; QPoint invertedOffset; + QRect initialGeometry; } m_moveResize; }; diff --git a/client.h b/client.h index 61d5138c13..dea468ab31 100644 --- a/client.h +++ b/client.h @@ -638,7 +638,6 @@ private: Position mode; QRect moveResizeGeom; - QRect initialMoveResizeGeom; Xcb::GeometryHints m_geometryHints; void sendSyntheticConfigureNotify(); enum MappingState { diff --git a/geometry.cpp b/geometry.cpp index 4ec65df231..adcb417cb6 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -2657,7 +2657,8 @@ bool Client::startMoveResize() s_haveResizeEffect = effects && static_cast(effects)->provides(Effect::Resize); moveResizeStartScreen = screen(); - initialMoveResizeGeom = moveResizeGeom = geometry(); + updateInitialMoveResizeGeometry(); + moveResizeGeom = geometry(); checkUnrestrictedMoveResize(); emit clientStartUserMovedResized(this); if (ScreenEdges::self()->isDesktopSwitchingMovingClients()) @@ -2671,13 +2672,13 @@ void Client::finishMoveResize(bool cancel) leaveMoveResize(); if (cancel) - setGeometry(initialMoveResizeGeom); + setGeometry(initialMoveResizeGeometry()); else { if (wasResize) { const bool restoreH = maximizeMode() == MaximizeHorizontal && - moveResizeGeom.width() != initialMoveResizeGeom.width(); + moveResizeGeom.width() != initialMoveResizeGeometry().width(); const bool restoreV = maximizeMode() == MaximizeVertical && - moveResizeGeom.height() != initialMoveResizeGeom.height(); + moveResizeGeom.height() != initialMoveResizeGeometry().height(); if (restoreH || restoreV) { changeMaximize(restoreV, restoreH, false); } @@ -2757,7 +2758,7 @@ void Client::checkUnrestrictedMoveResize() left_marge = qMin(100 + borderRight(), moveResizeGeom.width()); right_marge = qMin(100 + borderLeft(), moveResizeGeom.width()); // width/height change with opaque resizing, use the initial ones - titlebar_marge = initialMoveResizeGeom.height(); + titlebar_marge = initialMoveResizeGeometry().height(); top_marge = borderBottom(); bottom_marge = borderTop(); if (isResize()) { @@ -2900,7 +2901,7 @@ void Client::handleMoveResize(int x, int y, int x_root, int y_root) bool update = false; if (isResize()) { - QRect orig = initialMoveResizeGeom; + QRect orig = initialMoveResizeGeometry(); Sizemode sizemode = SizemodeAny; auto calculateMoveResizeGeom = [this, &topleft, &bottomright, &orig, &sizemode]() { switch(mode) {