History

wayland_common: respect compositor's preferenced size on state change

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.

nanahi committed 2 years ago

Commit 8a9749b1 parent b2ce96b1 file · +2 −4Browse files

Unified · Split

video/out/wayland_common.c+2−4
@@ -1099,13 +1099,11 @@ static void handle_toplevel_config(void *data, struct xdg_toplevel *toplevel, · 1098 unmodified lines
10991099 wl->hidden = is_suspended;
11001100
11011101 if (vo_opts->fullscreen != is_fullscreen) {
1102− wl->state_change = true;
11031102 vo_opts->fullscreen = is_fullscreen;
11041103 m_config_cache_write_opt(wl->vo_opts_cache, &vo_opts->fullscreen);
11051104 }
11061105
11071106 if (vo_opts->window_maximized != is_maximized) {
1108− wl->state_change = true;
11091107 vo_opts->window_maximized = is_maximized;
11101108 m_config_cache_write_opt(wl->vo_opts_cache, &vo_opts->window_maximized);
11111109 }
@@ -2142,7 +2140,6 @@ static int spawn_cursor(struct vo_wayland_state *wl) · 1030 unmodified lines
21422140
21432141 static void toggle_fullscreen(struct vo_wayland_state *wl)
21442142 {
2145− wl->state_change = true;
21462143 bool specific_screen = wl->vo_opts->fsscreen_id >= 0 || wl->vo_opts->fsscreen_name;
21472144 if (wl->vo_opts->fullscreen && !specific_screen) {
21482145 xdg_toplevel_set_fullscreen(wl->xdg_toplevel, NULL);
@@ -2156,7 +2153,6 @@ static void toggle_fullscreen(struct vo_wayland_state *wl) · 7 unmodified lines
21562153
21572154 static void toggle_maximized(struct vo_wayland_state *wl)
21582155 {
2159− wl->state_change = true;
21602156 if (wl->vo_opts->window_maximized) {
21612157 xdg_toplevel_set_maximized(wl->xdg_toplevel);
21622158 } else {
@@ -2314,6 +2310,7 @@ int vo_wayland_control(struct vo *vo, int *events, int request, void *arg) · 151 unmodified lines
23142310 if (opt == &opts->geometry || opt == &opts->autofit ||
23152311 opt == &opts->autofit_smaller || opt == &opts->autofit_larger)
23162312 {
2313+ wl->state_change = true;
23172314 set_geometry(wl, true);
23182315 }
23192316 }
@@ -2352,6 +2349,7 @@ int vo_wayland_control(struct vo *vo, int *events, int request, void *arg) · 32 unmodified lines
23522349 wl->window_size.x1 = s[0];
23532350 wl->window_size.y1 = s[1];
23542351 if (!wl->vo_opts->fullscreen && !wl->tiled) {
2352+ wl->state_change = true;
23552353 if (wl->vo_opts->window_maximized) {
23562354 xdg_toplevel_unset_maximized(wl->xdg_toplevel);
23572355 wl_display_dispatch_pending(wl->display);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t