Skip to content
21 changes: 16 additions & 5 deletions video/out/w32_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1916,9 +1916,22 @@ static void window_resize(struct vo_w32_state *w32)
.wh_valid = true,
};

bool force_geometry = !w32->window_bounds_initialized || w32->force_pos;
bool should_reset_size = w32->pending_reset_size ||
(w32->opts->auto_window_resize &&
(w32->o_dwidth != vo->dwidth ||
w32->o_dheight != vo->dheight));

vo_calc_window_geometry(vo, w32->opts, &screen, &mon, w32->dpi_scale,
!w32->window_bounds_initialized || w32->force_pos,
&geo, &size_constraint);
force_geometry, &geo, NULL);

if (should_reset_size &&
(geo.win.x1 - geo.win.x0 > screen.x1 - screen.x0 ||
geo.win.y1 - geo.win.y0 > screen.y1 - screen.y0)) {
vo_calc_window_geometry(vo, w32->opts, &screen, &mon, w32->dpi_scale,
force_geometry, &geo, &size_constraint);
}

// Limit the minimum window size to prevent the window floating to different
// position when our requested size is smaller than the system minimum.
// C{X,Y}MIN values doesn't seem to be absolute minimum of window, but it's
Expand All @@ -1928,9 +1941,7 @@ static void window_resize(struct vo_w32_state *w32)
geo.win.y1 = MPMAX(geo.win.y0 + min.y, geo.win.y1);
vo_apply_window_geometry(vo, &geo);

w32->pending_reset_size |= w32->opts->auto_window_resize &&
(w32->o_dwidth != vo->dwidth ||
w32->o_dheight != vo->dheight);
w32->pending_reset_size = should_reset_size;

if (w32->parent) {
GetClientRect(w32->window, &r);
Expand Down