wayland: avoid unneeded calls to xdg_toplevel state functions

The reconfigure event handles setting fullscreen, maximize, etc. We were
implictly relying on the compositor to just ignore mpv if we set a
redundant state (e.g. setting fullscreen when we're already fullscreen),
but kwin actually doesn't and operates again. This causes some subtle
issues when handling geometry on state changes. Rework the state change
calls so they are only executed if wl->geometry_configured isn't set yet
(i.e. the window just opened up for the first time). It's the only time
this is actually needed.
This commit is contained in:
Dudemanguy 2024-04-12 12:04:03 -05:00
parent 4023146a04
commit 307255d00d
1 changed files with 12 additions and 11 deletions

View File

@ -2620,22 +2620,23 @@ bool vo_wayland_reconfig(struct vo *vo)
if (wl->opts->configure_bounds)
set_window_bounds(wl);
if (!wl->geometry_configured || !wl->locked_size) {
wl->geometry = wl->window_size;
wl->geometry_configured = true;
}
if (wl->vo_opts->cursor_passthrough)
set_input_region(wl, true);
if (wl->vo_opts->fullscreen)
toggle_fullscreen(wl);
if (!wl->geometry_configured || !wl->locked_size)
wl->geometry = wl->window_size;
if (wl->vo_opts->window_maximized)
toggle_maximized(wl);
if (!wl->geometry_configured) {
if (wl->vo_opts->fullscreen)
toggle_fullscreen(wl);
if (wl->vo_opts->window_minimized)
do_minimize(wl);
if (wl->vo_opts->window_maximized)
toggle_maximized(wl);
if (wl->vo_opts->window_minimized)
do_minimize(wl);
wl->geometry_configured = true;
}
prepare_resize(wl);