Currently mpv always uses the previous window size when unmaximizing or exiting fullscreen. This disregards compositor's preferenced size in the configure event, resulting in wrong window size if changing window state and size are delivered in the same configure event. It's better to always respect the preferenced size instead, unless the state change is due to runtime geometry change, where we want to use our preference.
Unified · Split
| @@ -1099,13 +1099,11 @@ static void handle_toplevel_config(void *data, struct xdg_toplevel *toplevel, · 1098 unmodified lines | ||
| 1099 | 1099 | wl->hidden = is_suspended; |
| 1100 | 1100 | |
| 1101 | 1101 | if (vo_opts->fullscreen != is_fullscreen) { |
| 1102 | − wl->state_change = true; | |
| 1103 | 1102 | vo_opts->fullscreen = is_fullscreen; |
| 1104 | 1103 | m_config_cache_write_opt(wl->vo_opts_cache, &vo_opts->fullscreen); |
| 1105 | 1104 | } |
| 1106 | 1105 | |
| 1107 | 1106 | if (vo_opts->window_maximized != is_maximized) { |
| 1108 | − wl->state_change = true; | |
| 1109 | 1107 | vo_opts->window_maximized = is_maximized; |
| 1110 | 1108 | m_config_cache_write_opt(wl->vo_opts_cache, &vo_opts->window_maximized); |
| 1111 | 1109 | } |
| @@ -2142,7 +2140,6 @@ static int spawn_cursor(struct vo_wayland_state *wl) · 1030 unmodified lines | ||
| 2142 | 2140 | |
| 2143 | 2141 | static void toggle_fullscreen(struct vo_wayland_state *wl) |
| 2144 | 2142 | { |
| 2145 | − wl->state_change = true; | |
| 2146 | 2143 | bool specific_screen = wl->vo_opts->fsscreen_id >= 0 || wl->vo_opts->fsscreen_name; |
| 2147 | 2144 | if (wl->vo_opts->fullscreen && !specific_screen) { |
| 2148 | 2145 | xdg_toplevel_set_fullscreen(wl->xdg_toplevel, NULL); |
| @@ -2156,7 +2153,6 @@ static void toggle_fullscreen(struct vo_wayland_state *wl) · 7 unmodified lines | ||
| 2156 | 2153 | |
| 2157 | 2154 | static void toggle_maximized(struct vo_wayland_state *wl) |
| 2158 | 2155 | { |
| 2159 | − wl->state_change = true; | |
| 2160 | 2156 | if (wl->vo_opts->window_maximized) { |
| 2161 | 2157 | xdg_toplevel_set_maximized(wl->xdg_toplevel); |
| 2162 | 2158 | } else { |
| @@ -2314,6 +2310,7 @@ int vo_wayland_control(struct vo *vo, int *events, int request, void *arg) · 151 unmodified lines | ||
| 2314 | 2310 | if (opt == &opts->geometry || opt == &opts->autofit || |
| 2315 | 2311 | opt == &opts->autofit_smaller || opt == &opts->autofit_larger) |
| 2316 | 2312 | { |
| 2313 | + wl->state_change = true; | |
| 2317 | 2314 | set_geometry(wl, true); |
| 2318 | 2315 | } |
| 2319 | 2316 | } |
| @@ -2352,6 +2349,7 @@ int vo_wayland_control(struct vo *vo, int *events, int request, void *arg) · 32 unmodified lines | ||
| 2352 | 2349 | wl->window_size.x1 = s[0]; |
| 2353 | 2350 | wl->window_size.y1 = s[1]; |
| 2354 | 2351 | if (!wl->vo_opts->fullscreen && !wl->tiled) { |
| 2352 | + wl->state_change = true; | |
| 2355 | 2353 | if (wl->vo_opts->window_maximized) { |
| 2356 | 2354 | xdg_toplevel_unset_maximized(wl->xdg_toplevel); |
| 2357 | 2355 | wl_display_dispatch_pending(wl->display); |