From 86db3b43364cd60503e37b91437e0bc25ddfc40d Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Tue, 31 Oct 2023 16:42:33 +0100 Subject: [PATCH] placementtracker: don't set geometry to geometry restores It can cause problems when the geometry restore value is invalid BUG: 473602 --- src/placementtracker.cpp | 19 ++++++------------- src/window.h | 4 ++-- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/placementtracker.cpp b/src/placementtracker.cpp index 6ce79bccfa..76b3f3af38 100644 --- a/src/placementtracker.cpp +++ b/src/placementtracker.cpp @@ -109,20 +109,11 @@ void PlacementTracker::restore(const QString &key) } } if (restore) { - window->setFullScreen(false); - window->setQuickTileMode(QuickTileFlag::None, true); - window->setMaximize(false, false); - if (newData.quickTile || newData.maximize) { - window->moveResize(newData.geometryRestore); - window->setQuickTileMode(newData.quickTile, true); - window->setMaximize(newData.maximize & MaximizeMode::MaximizeVertical, newData.maximize & MaximizeMode::MaximizeHorizontal); - } - if (newData.fullscreen) { - window->moveResize(newData.fullscreenGeometryRestore); - window->setFullScreen(newData.fullscreen); - } + window->setQuickTileMode(newData.quickTile, true); + window->setMaximize(newData.maximize & MaximizeMode::MaximizeVertical, newData.maximize & MaximizeMode::MaximizeHorizontal); + window->setFullScreen(newData.fullscreen); if (newData.quickTile || newData.maximize || newData.fullscreen) { - // restore geometry isn't necessarily on the output the window was, so explicitly restore it + // send the window to the correct output const auto outputIt = std::find_if(outputs.begin(), outputs.end(), [&newData](const auto output) { return output->uuid() == newData.outputUuid; }); @@ -132,6 +123,8 @@ void PlacementTracker::restore(const QString &key) } else { window->moveResize(newData.geometry); } + window->setGeometryRestore(newData.geometryRestore); + window->setFullscreenGeometryRestore(newData.fullscreenGeometryRestore); m_lastRestoreData[window] = dataForWindow(window); } } diff --git a/src/window.h b/src/window.h index 160cc0f061..f5f6287424 100644 --- a/src/window.h +++ b/src/window.h @@ -995,6 +995,7 @@ public: void setSuspended(bool suspended); QRectF fullscreenGeometryRestore() const; + void setFullscreenGeometryRestore(const QRectF &geom); virtual bool isFullScreenable() const; virtual bool isFullScreen() const; virtual bool isRequestedFullScreen() const; @@ -1003,6 +1004,7 @@ public: bool wantsAdaptiveSync() const; QRectF geometryRestore() const; + void setGeometryRestore(const QRectF &rect); virtual bool isMaximizable() const; virtual MaximizeMode maximizeMode() const; virtual MaximizeMode requestedMaximizeMode() const; @@ -1547,8 +1549,6 @@ protected: int borderRight() const; int borderTop() const; int borderBottom() const; - void setGeometryRestore(const QRectF &rect); - void setFullscreenGeometryRestore(const QRectF &geom); void blockGeometryUpdates(bool block); void blockGeometryUpdates();