diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 7e99b2a5d5..442a7ff3e1 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -5610,13 +5610,13 @@ them. ``--wayland-app-id=`` Set the client app id for Wayland-based video output methods (default: ``mpv``). -``--wayland-configure-bounds=`` +``--wayland-configure-bounds=`` Controls whether or not mpv opts into the configure bounds event if sent by the - compositor (default: yes). This restricts the initial size of the mpv window to + compositor (default: auto). This restricts the initial size of the mpv window to a certain maximum size intended by the compositor. In most cases, this simply just prevents the mpv window from being larger than the size of the monitor when - it first renders. This option will take precedence over any ``autofit`` or - ``geometry`` type settings if the configure bounds are used. + it first renders. With the default value of ``auto``, configure-bounds will + silently be ignored if any ``autofit`` or ``geometry`` type option is also set. ``--wayland-content-type=`` If supported by the compositor, mpv will send a hint using the content-type diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index 59ce2e940b..b1631cbb20 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -131,7 +131,8 @@ static const struct mp_keymap keymap[] = { #define OPT_BASE_STRUCT struct wayland_opts const struct m_sub_options wayland_conf = { .opts = (const struct m_option[]) { - {"wayland-configure-bounds", OPT_FLAG(configure_bounds)}, + {"wayland-configure-bounds", OPT_CHOICE(configure_bounds, + {"auto", -1}, {"no", 0}, {"yes", 1})}, {"wayland-disable-vsync", OPT_FLAG(disable_vsync)}, {"wayland-edge-pixels-pointer", OPT_INT(edge_pixels_pointer), M_RANGE(0, INT_MAX)}, @@ -141,7 +142,7 @@ const struct m_sub_options wayland_conf = { }, .size = sizeof(struct wayland_opts), .defaults = &(struct wayland_opts) { - .configure_bounds = true, + .configure_bounds = -1, .disable_vsync = false, .edge_pixels_pointer = 10, .edge_pixels_touch = 32, @@ -1706,6 +1707,15 @@ static void set_surface_scaling(struct vo_wayland_state *wl) static void set_window_bounds(struct vo_wayland_state *wl) { + // If the user has set geometry/autofit and the option is auto, + // don't use these. + if (wl->opts->configure_bounds == -1 && (wl->vo_opts->geometry.wh_valid || + wl->vo_opts->autofit.wh_valid || wl->vo_opts->autofit_larger.wh_valid || + wl->vo_opts->autofit_smaller.wh_valid)) + { + return; + } + if (wl->bounded_width && wl->bounded_width < wl->window_size.x1) wl->window_size.x1 = wl->bounded_width; if (wl->bounded_height && wl->bounded_height < wl->window_size.y1)