diff --git a/src/workspace.cpp b/src/workspace.cpp index 5b43ea9e8c..444d4a91a3 100644 --- a/src/workspace.cpp +++ b/src/workspace.cpp @@ -1482,16 +1482,6 @@ void Workspace::removeOutput(Output *output) disconnect(output, &Output::geometryChanged, this, &Workspace::desktopResized); desktopResized(); - const auto stack = stackingOrder(); - for (Window *window : stack) { - if (window->output() == output) { - window->setOutput(outputAt(window->frameGeometry().center())); - } - if (window->moveResizeOutput() == output) { - window->setMoveResizeOutput(kwinApp()->platform()->outputAt(window->moveResizeGeometry().center())); - } - } - Q_EMIT outputRemoved(output); } @@ -2281,6 +2271,12 @@ void Workspace::desktopResized() updateClientArea(); + const auto stack = stackingOrder(); + for (Window *window : stack) { + window->setMoveResizeOutput(outputAt(window->moveResizeGeometry().center())); + window->setOutput(outputAt(window->frameGeometry().center())); + } + // restore cursor position const auto oldCursorOutput = std::find_if(m_oldScreenGeometries.cbegin(), m_oldScreenGeometries.cend(), [](const auto &geometry) { return geometry.contains(Cursors::self()->mouse()->pos());