From 8fb4fd9a189bd18661ed9dd9e859ddae4dc6f415 Mon Sep 17 00:00:00 2001 From: "Avi Halachmi (:avih)" Date: Fri, 13 Aug 2021 00:49:09 +0300 Subject: win32: initial position: center with borders Previously, the initial positioning and fit ignored the borders, and centered the content (the video itself) at the working area. Now, the initial positioning centers the window, by subtracting the borders (if needed) from the target area for the initial fit/position. While this does mean that the initial maximum content area is now smaller than before, ultimately this has no impact on the window size, because fit_on_screen is called later and, if needed, further shrinks the window to fit the borders too - but without centering the window. So the net impact of this commit is only the initial positioning (same size as before), which now centers the window instead of the content. Note that on Windows 10 the borders include invisible areas at the sides and bottom of the window (for mouse edge-drag), so visibly the window is nearer to the top than to the bottom, but these are the metrics we have (fit_on_screen uses the same border size values). On Windows 7 it looks perfectly centered. --- video/out/w32_common.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/video/out/w32_common.c b/video/out/w32_common.c index 8c06d5b325..b899922f08 100644 --- a/video/out/w32_common.c +++ b/video/out/w32_common.c @@ -1419,6 +1419,8 @@ 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) + 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