Skip to content

Commit f47a055

Browse files
Dudemanguysfan5
authored andcommitted
wayland: avoid doing unneccesary window resizes
Commits 04018c3 cd7a7a1 introduced behavior that updated window geometry during wayland events (specifically surface and output). This is good but they also are too aggressive with automatically resizing. For example, if a window is manually resized by the user and then dragged to a different monitor with different geometry than the initial monitor, mpv will automatically resize itself to the window's resolution. The initial thought behind this logic was for autofit to automatically readjust itself on a new monitor, but doing that breaks other common use cases. An attempt could be made to distinguish between autofit and a manual resize but that introduces a lot of complexity for an edge case. It's better to simply not change the window geometry here. Internal values are recalculated and scaled of course, but wl->window_size and wl->geometry should not change.
1 parent 80c03b4 commit f47a055

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

video/out/wayland_common.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -653,9 +653,6 @@ static void output_handle_done(void* data, struct wl_output *wl_output)
653653
}
654654
spawn_cursor(wl);
655655
set_geometry(wl);
656-
wl->window_size = wl->vdparams;
657-
if (!wl->vo_opts->fullscreen && !wl->vo_opts->window_maximized)
658-
wl->geometry = wl->window_size;
659656
wl->pending_vo_events |= VO_EVENT_DPI;
660657
wl->pending_vo_events |= VO_EVENT_RESIZE;
661658
}
@@ -716,13 +713,9 @@ static void surface_handle_enter(void *data, struct wl_surface *wl_surface,
716713

717714
if (!mp_rect_equals(&old_output_geometry, &wl->current_output->geometry)) {
718715
set_geometry(wl);
719-
wl->window_size = wl->vdparams;
720716
force_resize = true;
721717
}
722718

723-
if (!wl->vo_opts->fullscreen && !wl->vo_opts->window_maximized)
724-
wl->geometry = wl->window_size;
725-
726719
if (!mp_rect_equals(&old_geometry, &wl->geometry) || force_resize)
727720
wl->pending_vo_events |= VO_EVENT_RESIZE;
728721

0 commit comments

Comments
 (0)