diff --git a/video/out/w32_common.c b/video/out/w32_common.c index 4a4bbd89c4df6..ba569a176f824 100644 --- a/video/out/w32_common.c +++ b/video/out/w32_common.c @@ -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 @@ -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);