diff options
author | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2021-08-09 20:12:25 +0300 |
---|---|---|
committer | avih <avih@users.noreply.github.com> | 2021-08-18 02:21:33 +0300 |
commit | 052220d1c7774fc700054a69d1e773bd4ec687c1 (patch) | |
tree | 91240aef5a2af3990283a10ae90668afba97c140 /video/out/w32_common.c | |
parent | 19e24bbe86d5cb241c5a23a9fec423aef0a4063d (diff) | |
download | mpv-052220d1c7774fc700054a69d1e773bd4ec687c1.tar.bz2 mpv-052220d1c7774fc700054a69d1e773bd4ec687c1.tar.xz |
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.
Diffstat (limited to 'video/out/w32_common.c')
-rw-r--r-- | video/out/w32_common.c | 7 |
1 files 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; |