wayland: only update toplevel state values if we have a valid state

We have this annoying situation here during the initial window
configuration where sometimes we have to update certain values and other
times they need to be ignored. 45324ce682
made sure to parse the toplevel state before we checked the initial
compositor values which is correct. But it's not enough because mpv can
have its own initial state (e.g. --fullscreen) and by moving it here it
would get overwritten in the toplevel state check and thus ignored. So
to have our cake and eat it too, we need to only update the internal
state values if we know mpv is in a valid state in the first place. So
either we've set the initial geometry already or the compositor has
given us some specific initial state to work with. Fixes #17819.
This commit is contained in:
Dudemanguy committed 2026-04-27 14:39:05 +00:00
1 parent 05b327c723
commit a42b1b9103
1 file changed
+9 -5
+9 -5
View File
@@ -1851,27 +1851,31 @@ static void handle_toplevel_config(void *data, struct xdg_toplevel *toplevel,
}
}
if (wl->hidden != is_suspended)
/* Only update the toplevel state values if either mpv already has
* configured its initial geometry or if the compositor gives us some
* initial state to use. */
if ((wl->geometry_configured || is_suspended) && wl->hidden != is_suspended)
wl->hidden = is_suspended;
if (wl->resizing != is_resizing) {
if ((wl->geometry_configured || is_resizing) && wl->resizing != is_resizing) {
wl->resizing = is_resizing;
wl->resizing_constraint = 0;
}
if (opts->fullscreen != is_fullscreen) {
if ((wl->geometry_configured || is_fullscreen) && opts->fullscreen != is_fullscreen) {
wl->state_change = wl->reconfigured;
opts->fullscreen = is_fullscreen;
m_config_cache_write_opt(wl->opts_cache, &opts->fullscreen);
}
if (opts->window_maximized != is_maximized) {
if ((wl->geometry_configured || is_maximized) && opts->window_maximized != is_maximized) {
wl->state_change = wl->reconfigured;
opts->window_maximized = is_maximized;
m_config_cache_write_opt(wl->opts_cache, &opts->window_maximized);
}
if (!is_tiled && wl->tiled)
if (wl->geometry_configured && !is_tiled && wl->tiled)
wl->state_change = wl->reconfigured;
wl->tiled = is_tiled;