mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
19e24bbe86
commit
052220d1c7
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue