diff --git a/src/placementtracker.cpp b/src/placementtracker.cpp index 76b3f3af38..9cb76311ea 100644 --- a/src/placementtracker.cpp +++ b/src/placementtracker.cpp @@ -53,6 +53,12 @@ void PlacementTracker::add(Window *window) connect(window, &Window::interactiveMoveResizeFinished, this, [this, window]() { saveInteractionCounter(window); }); + connect(window, &Window::maximizeGeometryRestoreChanged, this, [this, window]() { + saveMaximizeGeometryRestore(window); + }); + connect(window, &Window::fullscreenGeometryRestoreChanged, this, [this, window]() { + saveFullscreenGeometryRestore(window); + }); WindowData data = dataForWindow(window); m_data[m_currentKey][window] = data; m_savedWindows.push_back(window); @@ -161,7 +167,6 @@ void PlacementTracker::saveMaximize(Window *window) if (m_inhibitCount == 0) { auto &data = m_data[m_currentKey][window]; data.maximize = window->maximizeMode(); - data.geometryRestore = window->geometryRestore(); } } @@ -170,7 +175,6 @@ void PlacementTracker::saveQuickTile(Window *window) if (m_inhibitCount == 0) { auto &data = m_data[m_currentKey][window]; data.quickTile = window->quickTileMode(); - data.geometryRestore = window->geometryRestore(); } } @@ -179,6 +183,21 @@ void PlacementTracker::saveFullscreen(Window *window) if (m_inhibitCount == 0) { auto &data = m_data[m_currentKey][window]; data.fullscreen = window->isFullScreen(); + } +} + +void PlacementTracker::saveMaximizeGeometryRestore(Window *window) +{ + if (m_inhibitCount == 0) { + auto &data = m_data[m_currentKey][window]; + data.geometryRestore = window->geometryRestore(); + } +} + +void PlacementTracker::saveFullscreenGeometryRestore(Window *window) +{ + if (m_inhibitCount == 0) { + auto &data = m_data[m_currentKey][window]; data.fullscreenGeometryRestore = window->fullscreenGeometryRestore(); } } diff --git a/src/placementtracker.h b/src/placementtracker.h index 7e5514fe4e..f62832271d 100644 --- a/src/placementtracker.h +++ b/src/placementtracker.h @@ -55,6 +55,8 @@ private: void saveMaximize(Window *window); void saveQuickTile(Window *window); void saveFullscreen(Window *window); + void saveMaximizeGeometryRestore(Window *window); + void saveFullscreenGeometryRestore(Window *window); WindowData dataForWindow(Window *window) const; QList m_savedWindows; diff --git a/src/window.cpp b/src/window.cpp index 8d16faec37..4c6faba682 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -3649,8 +3649,8 @@ void Window::sendToOutput(Output *newOutput) moveResize(newGeom); // move geometry restores to the new output as well - m_fullscreenGeometryRestore = moveToArea(m_fullscreenGeometryRestore, oldScreenArea, screenArea); - m_maximizeGeometryRestore = moveToArea(m_maximizeGeometryRestore, oldScreenArea, screenArea); + setFullscreenGeometryRestore(moveToArea(m_fullscreenGeometryRestore, oldScreenArea, screenArea)); + setGeometryRestore(moveToArea(m_maximizeGeometryRestore, oldScreenArea, screenArea)); auto tso = workspace()->ensureStackingOrder(transients()); for (auto it = tso.constBegin(), end = tso.constEnd(); it != end; ++it) { @@ -3704,8 +3704,8 @@ void Window::checkWorkspacePosition(QRectF oldGeometry, const VirtualDesktop *ol if (isRequestedFullScreen() || requestedMaximizeMode() != MaximizeRestore || quickTileMode() != QuickTileMode(QuickTileFlag::None)) { moveResize(ensureSpecialStateGeometry(newGeom)); - m_fullscreenGeometryRestore = moveToArea(m_fullscreenGeometryRestore, oldScreenArea, screenArea); - m_maximizeGeometryRestore = moveToArea(m_maximizeGeometryRestore, oldScreenArea, screenArea); + setFullscreenGeometryRestore(moveToArea(m_fullscreenGeometryRestore, oldScreenArea, screenArea)); + setGeometryRestore(moveToArea(m_maximizeGeometryRestore, oldScreenArea, screenArea)); return; } @@ -3912,7 +3912,10 @@ QRectF Window::fullscreenGeometryRestore() const void Window::setFullscreenGeometryRestore(const QRectF &geom) { - m_fullscreenGeometryRestore = geom; + if (m_fullscreenGeometryRestore != geom) { + m_fullscreenGeometryRestore = geom; + Q_EMIT fullscreenGeometryRestoreChanged(); + } } /** @@ -4014,7 +4017,10 @@ QRectF Window::geometryRestore() const */ void Window::setGeometryRestore(const QRectF &rect) { - m_maximizeGeometryRestore = rect; + if (m_maximizeGeometryRestore != rect) { + m_maximizeGeometryRestore = rect; + Q_EMIT maximizeGeometryRestoreChanged(); + } } void Window::invalidateDecoration() diff --git a/src/window.h b/src/window.h index f5f6287424..40f10ce9ee 100644 --- a/src/window.h +++ b/src/window.h @@ -1435,6 +1435,8 @@ Q_SIGNALS: void hiddenByShowDesktopChanged(); void lockScreenOverlayChanged(); void readyForPaintingChanged(); + void maximizeGeometryRestoreChanged(); + void fullscreenGeometryRestoreChanged(); protected: Window();