Skip to content

Commit 4c9a1db

Browse files
committed
wayland: only reuse old size if both width and height are 0
The protocol states that "If the width or height arguments are zero, it means the client should decide its own window dimension." Key point here is the omission of plurality from "dimension." This means a compositor could theoretically set width OR height to 0 and a specific size for the other dimension. There is no compositor out in the wild that does it but this is one proposed solution to mpv technically violating the letter of the protocol on Wayland when resizing while trying to keep the aspect ratio. mpv isn't allowed to make the window larger than size it receives in the configure event while the resizing event is set, but this means that it is impossible for the mpv window to grow if the user tries to resize from any side of the window (as opposed to corners). When the user attempts to grow the window from sides, mpv cannot keep the same aspect ratio without also growing on the other dimension. This is a protocol violation, though no compositor actually checks or enforces this. The solution to this is compositors setting the required size on one dimension to 0, so mpv can freely grow in that dimension to keep up with interactive resize. Related: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/33
1 parent 5ba7ee5 commit 4c9a1db

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

video/out/wayland_common.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1307,8 +1307,8 @@ static void handle_toplevel_config(void *data, struct xdg_toplevel *toplevel,
13071307
}
13081308
}
13091309

1310-
/* Reuse old size if either of these are 0. */
1311-
if (width == 0 || height == 0) {
1310+
/* Reuse old size if both of these are 0. */
1311+
if (width == 0 && height == 0) {
13121312
if (!wl->locked_size) {
13131313
wl->geometry = wl->window_size;
13141314
}

0 commit comments

Comments
 (0)