diff options
author | Dudemanguy <random342@airmail.cc> | 2024-04-11 22:16:18 -0500 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2024-04-13 14:33:58 +0000 |
commit | 4023146a04be2bd4aaf46e57cac80c7883a9239b (patch) | |
tree | 98fc461ae51318614bb5ce66759a9bd41f22ffb9 | |
parent | 247ef82a7691e2614e52f544e8e5b62070d7c2f0 (diff) | |
download | mpv-4023146a04be2bd4aaf46e57cac80c7883a9239b.tar.bz2 mpv-4023146a04be2bd4aaf46e57cac80c7883a9239b.tar.xz |
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
-rw-r--r-- | video/out/wayland_common.c | 11 | ||||
-rw-r--r-- | video/out/wayland_common.h | 1 |
2 files changed, 12 insertions, 0 deletions
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; |