placementtracker: don't set geometry to geometry restores

It can cause problems when the geometry restore value is invalid

BUG: 473602
This commit is contained in:
Xaver Hugl 2023-10-31 16:42:33 +01:00
parent 3ede995b27
commit 86db3b4336
2 changed files with 8 additions and 15 deletions

View file

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

View file

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