From e734f5ae3387fba5e2e8b8f15580108150faa3f7 Mon Sep 17 00:00:00 2001 From: nanahi <130121847+na-na-hi@users.noreply.github.com> Date: Sat, 2 Nov 2024 02:35:58 -0400 Subject: [PATCH] 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. --- video/out/w32_common.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/video/out/w32_common.c b/video/out/w32_common.c index aa76d1f46f..d5e3a0d485 100644 --- a/video/out/w32_common.c +++ b/video/out/w32_common.c @@ -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;