x11: don't unconditionally move the window on geometry changes

With the pieces set in place with the previous changes, we can implement
the desired behavior. The trick here is that we do want to force
centering the window when mpv first initially starts and the window size
is not known yet. This can be done by simply checking
x11->pseudo_mapped. The other change is to just look if we have the
VO_WIN_FORCE_POS flag and feed that to highlevel resize.
This commit is contained in:
Dudemanguy 2024-09-27 09:19:35 -05:00
parent e01eab4385
commit 2fa87117e0
1 changed files with 3 additions and 2 deletions

View File

@ -1809,7 +1809,8 @@ void vo_x11_config_vo_window(struct vo *vo)
vo_x11_update_screeninfo(vo);
struct vo_win_geometry geo;
vo_calc_window_geometry(vo, &x11->screenrc, &x11->screenrc, x11->dpi_scale, false, &geo);
vo_calc_window_geometry(vo, &x11->screenrc, &x11->screenrc, x11->dpi_scale,
!x11->pseudo_mapped, &geo);
vo_apply_window_geometry(vo, &geo);
struct mp_rect rc = geo.win;
@ -1833,7 +1834,7 @@ void vo_x11_config_vo_window(struct vo *vo)
x11->nofsrc = rc;
vo_x11_map_window(vo, rc);
} else if (reset_size) {
vo_x11_highlevel_resize(vo, rc, x11->geometry_change);
vo_x11_highlevel_resize(vo, rc, geo.flags & VO_WIN_FORCE_POS);
}
x11->geometry_change = false;