From 052220d1c7774fc700054a69d1e773bd4ec687c1 Mon Sep 17 00:00:00 2001 From: "Avi Halachmi (:avih)" Date: Mon, 9 Aug 2021 20:12:25 +0300 Subject: win32: apply dpi-scale with [current]-window-scale When --window-scale=NUM is set from CLI, the dpi_scale value was/is taken into account when the win32 VO calls vo_calc_window_geometry2. However, when [current]-window-scale is read or set at runtime, it uses the VOCTRL_{GET,SET}_UNFS_WINDOW_SIZE interface, where other VOs apply the dpi_scale value internally (wayland, x11, osx), but the win32 VO didn't before this commit. Fixes two issues when --hidpi-window-scale=yes and dpi_scale != 1 : - Incorrect window-size when setting [current-]window-scale at runtime. - Incorrect current-window-scale value when reading it. --- video/out/w32_common.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/video/out/w32_common.c b/video/out/w32_common.c index d5ec8ee04b..c52406de4e 100644 --- a/video/out/w32_common.c +++ b/video/out/w32_common.c @@ -1727,8 +1727,8 @@ static int gui_thread_control(struct vo_w32_state *w32, int request, void *arg) return VO_FALSE; RECT *rc = w32->current_fs ? &w32->prev_windowrc : &w32->windowrc; - s[0] = rect_w(*rc); - s[1] = rect_h(*rc); + s[0] = rect_w(*rc) / w32->dpi_scale; + s[1] = rect_h(*rc) / w32->dpi_scale; return VO_TRUE; } case VOCTRL_SET_UNFS_WINDOW_SIZE: { @@ -1737,6 +1737,9 @@ static int gui_thread_control(struct vo_w32_state *w32, int request, void *arg) if (!w32->window_bounds_initialized) return VO_FALSE; + s[0] *= w32->dpi_scale; + s[1] *= w32->dpi_scale; + RECT *rc = w32->current_fs ? &w32->prev_windowrc : &w32->windowrc; const int x = rc->left + rect_w(*rc) / 2 - s[0] / 2; const int y = rc->top + rect_h(*rc) / 2 - s[1] / 2; -- cgit v1.2.3