wayland: actually handle 0x0 resizes correctly

According to the xdg-shell protocol spec, a 0x0 size from the compositor
means that "the client should decide its own window dimension". We were
not doing this correctly. What should happen is that mpv should simply
reuse the old window size if it is not maximized or fullscreened. This
should work on all (reasonably recent) versions of mutter and an
compositor that follows the spec.

https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/stable/xdg-shell/xdg-shell.xml#L1050
This commit is contained in:
Dudemanguy 2022-01-25 11:56:37 -06:00
parent 5bcf061744
commit 073fbd98ee
1 changed files with 8 additions and 0 deletions

View File

@ -842,6 +842,14 @@ static void handle_toplevel_config(void *data, struct xdg_toplevel *toplevel,
}
}
/* Reuse old size if either of these are 0. */
if (width == 0 || height == 0) {
if (!is_fullscreen && !is_maximized) {
wl->geometry = wl->window_size;
}
goto resize;
}
if (old_toplevel_width == wl->toplevel_width &&
old_toplevel_height == wl->toplevel_height)
return;