wayland: Simplify xdg-shell's fullscreen mode implementation

XdgToplevelClient::setFullScreen() won't change the geometry
immediately, so workspace()->updateFocusMousePosition() can be removed.

Also, input handling code takes care of updating the cached mouse
position in the workspace.
This commit is contained in:
Vlad Zahorodnii 2022-02-03 10:22:51 +02:00
parent 77f712d3a7
commit 5cfa4bae77

View file

@ -1567,9 +1567,7 @@ void XdgToplevelClient::installPalette(ServerSideDecorationPaletteInterface *pal
void XdgToplevelClient::setFullScreen(bool set, bool user)
{
set = rules()->checkFullScreen(set);
const bool wasFullscreen = isRequestedFullScreen();
if (wasFullscreen == set) {
if (m_isRequestedFullScreen == set) {
return;
}
if (isSpecialWindow()) {
@ -1579,17 +1577,12 @@ void XdgToplevelClient::setFullScreen(bool set, bool user)
return;
}
if (wasFullscreen) {
workspace()->updateFocusMousePosition(Cursors::self()->mouse()->pos()); // may cause leave event
} else {
setFullscreenGeometryRestore(moveResizeGeometry());
}
m_isRequestedFullScreen = set;
configureDecoration();
if (set) {
const AbstractOutput *output = m_fullScreenRequestedOutput ? m_fullScreenRequestedOutput.data() : kwinApp()->platform()->outputAt(moveResizeGeometry().center());
setFullscreenGeometryRestore(moveResizeGeometry());
moveResize(workspace()->clientArea(FullScreenArea, this, output));
} else {
m_fullScreenRequestedOutput.clear();