summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvi Halachmi (:avih) <avihpit@yahoo.com>2021-08-13 00:49:09 +0300
committeravih <avih@users.noreply.github.com>2021-09-06 10:16:10 +0300
commit8fb4fd9a189bd18661ed9dd9e859ddae4dc6f415 (patch)
tree6069a0b4b1d9ad2cbb56a6a42a8961eacd7499f0
parent73f16b54316cf3bcb7bfd12501ee5f38c2146d58 (diff)
downloadmpv-8fb4fd9a189bd18661ed9dd9e859ddae4dc6f415.tar.bz2
mpv-8fb4fd9a189bd18661ed9dd9e859ddae4dc6f415.tar.xz
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.
-rw-r--r--video/out/w32_common.c2
1 files changed, 2 insertions, 0 deletions
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;