Ensure that Window::output() is always in sync with the frame geometry

plasmashell may see new output layout before kwin_x11 and move desktop
windows accordingly. If that happens, the desktop windows will have old
outputs in Window::output() property because the Workspace doesn't
re-check outputs if the output layout changes.

In order to fix the Window::output() property getting out of sync,
re-check the current output after the output layout changes. It should
also fix a visual glitch in the slide effect caused by
EffectWindow::screen() not being correct.
This commit is contained in:
Vlad Zahorodnii 2022-06-27 17:24:23 +03:00
parent 6cc4b799f4
commit 16d9a08f85

View file

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