video/out/w32_common: don't move window if position isn't set

The geometry output of vo_calc_window_geometry does not have
any information about the current window position. This causes
the window to move when setting geometry even without setting
x/y.

Change it so that the window position is unchanged if x/y are not
set and after startup.
This commit is contained in:
nanahi 2024-11-02 02:35:58 -04:00 committed by Kacper Michajłow
parent 512f5e2e82
commit e734f5ae33
1 changed files with 7 additions and 2 deletions

View File

@ -1944,8 +1944,13 @@ static void window_reconfig(struct vo_w32_state *w32, bool force)
w32->o_dheight = vo->dheight;
if (!w32->parent && (!w32->window_bounds_initialized || force)) {
SetRect(&w32->windowrc, geo.win.x0, geo.win.y0,
geo.win.x0 + vo->dwidth, geo.win.y0 + vo->dheight);
int x0 = geo.win.x0;
int y0 = geo.win.y0;
if (!w32->opts->geometry.xy_valid && w32->window_bounds_initialized) {
x0 = w32->windowrc.left;
y0 = w32->windowrc.top;
}
SetRect(&w32->windowrc, x0, y0, x0 + vo->dwidth, y0 + vo->dheight);
w32->prev_windowrc = w32->windowrc;
w32->window_bounds_initialized = true;
w32->win_force_pos = geo.flags & VO_WIN_FORCE_POS;