summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2022-01-25 11:56:37 -0600
committerDudemanguy <random342@airmail.cc>2022-01-27 15:15:43 +0000
commit073fbd98eeec86e62b8fada4fe9d42444981edfa (patch)
treeba97a2efdec49acbfdd38cbcfd3b2b2954623b5c /video/out
parent5bcf0617448362e12a813c6c8f5192a8c9c05cc2 (diff)
downloadmpv-073fbd98eeec86e62b8fada4fe9d42444981edfa.tar.bz2
mpv-073fbd98eeec86e62b8fada4fe9d42444981edfa.tar.xz
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
Diffstat (limited to 'video/out')
-rw-r--r--video/out/wayland_common.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 8867deaaa3..1f176aaad3 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -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;