From 555c15efba09c3f4ed0696606d8533cb82ee11a0 Mon Sep 17 00:00:00 2001 From: "Avi Halachmi (:avih)" Date: Tue, 1 Feb 2022 08:22:35 +0200 Subject: win32: apply geometry position to content instead of window The docs specify that the +-X+-Y geometry values position the content. This used to work correctly but got broken at 8fb4fd9a . Geometry size is unaffected - this only concerns position. Commit 8fb4fd9a made it center the window rather than the content by taking the borders into account during positioning, but forgot to make an exception when a position is specified explicitly. This commit adds this exception, and now if a specific position is requested then the borders are ignored, and the content is positioned correctly. --- video/out/w32_common.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'video/out') diff --git a/video/out/w32_common.c b/video/out/w32_common.c index b899922f08..a69048414d 100644 --- a/video/out/w32_common.c +++ b/video/out/w32_common.c @@ -1419,8 +1419,13 @@ static void gui_thread_reconfig(void *ptr) struct vo *vo = w32->vo; RECT r = get_working_area(w32); - if (!w32->current_fs && !IsMaximized(w32->window) && w32->opts->border) + // for normal window which is auto-positioned (centered), center the window + // rather than the content (by subtracting the borders from the work area) + if (!w32->current_fs && !IsMaximized(w32->window) && w32->opts->border && + !w32->opts->geometry.xy_valid /* specific position not requested */) + { subtract_window_borders(w32, w32->window, &r); + } struct mp_rect screen = { r.left, r.top, r.right, r.bottom }; struct vo_win_geometry geo; -- cgit v1.2.3