From 4023146a04be2bd4aaf46e57cac80c7883a9239b Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Thu, 11 Apr 2024 22:16:18 -0500 Subject: [PATCH] wayland: enforce a state change after a reconfigure If mpv is coming out of some locked size state (fullscreen, maximized, tiled), the window size given by the reconfigure event should be used assuming the --auto-window-size option is set. Fixes 8a9749b8a563f258342450160c98e9c02ebedc96 --- video/out/wayland_common.c | 11 +++++++++++ video/out/wayland_common.h | 1 + 2 files changed, 12 insertions(+) diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index d48af35917..0a87296e19 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -1106,18 +1106,24 @@ static void handle_toplevel_config(void *data, struct xdg_toplevel *toplevel, wl->hidden = is_suspended; if (vo_opts->fullscreen != is_fullscreen) { + wl->state_change = wl->reconfigured; vo_opts->fullscreen = is_fullscreen; m_config_cache_write_opt(wl->vo_opts_cache, &vo_opts->fullscreen); } if (vo_opts->window_maximized != is_maximized) { + wl->state_change = wl->reconfigured; vo_opts->window_maximized = is_maximized; m_config_cache_write_opt(wl->vo_opts_cache, &vo_opts->window_maximized); } + if (!is_tiled && wl->tiled) + wl->state_change = wl->reconfigured; + wl->tiled = is_tiled; wl->locked_size = is_fullscreen || is_maximized || is_tiled; + wl->reconfigured = false; if (wl->requested_decoration) request_decoration_mode(wl, wl->requested_decoration); @@ -2154,6 +2160,7 @@ static void toggle_fullscreen(struct vo_wayland_state *wl) struct vo_wayland_output *output = find_output(wl); xdg_toplevel_set_fullscreen(wl->xdg_toplevel, output->output); } else { + wl->state_change = wl->reconfigured; xdg_toplevel_unset_fullscreen(wl->xdg_toplevel); } } @@ -2163,6 +2170,7 @@ static void toggle_maximized(struct vo_wayland_state *wl) if (wl->vo_opts->window_maximized) { xdg_toplevel_set_maximized(wl->xdg_toplevel); } else { + wl->state_change = wl->reconfigured; xdg_toplevel_unset_maximized(wl->xdg_toplevel); } } @@ -2606,6 +2614,9 @@ bool vo_wayland_reconfig(struct vo *vo) if (wl->vo_opts->auto_window_resize || !wl->geometry_configured) set_geometry(wl, false); + if (wl->geometry_configured && wl->vo_opts->auto_window_resize) + wl->reconfigured = true; + if (wl->opts->configure_bounds) set_window_bounds(wl); diff --git a/video/out/wayland_common.h b/video/out/wayland_common.h index 3e8530eaff..7d1c113f3a 100644 --- a/video/out/wayland_common.h +++ b/video/out/wayland_common.h @@ -75,6 +75,7 @@ struct vo_wayland_state { bool hidden; bool initial_size_hint; bool locked_size; + bool reconfigured; bool scale_configured; bool state_change; bool tiled;