mirror of
https://github.com/mpv-player/mpv
synced 2025-04-21 14:49:08 +00:00
w32_common: update stored client area size on window resize
Properly update stored client area size when the window is resized in reinit_window_state due to window size exceeding the size of the screen. This was causing wrong behavior with window-scale - when window size was becoming too big the window was resized but the video was not.
This commit is contained in:
parent
035297212a
commit
981048e041
@ -1100,8 +1100,15 @@ static void reinit_window_state(struct vo_w32_state *w32)
|
|||||||
} else {
|
} else {
|
||||||
n_w = n_h * asp;
|
n_w = n_h * asp;
|
||||||
}
|
}
|
||||||
|
// Save new size
|
||||||
|
w32->dw = n_w;
|
||||||
|
w32->dh = n_h;
|
||||||
|
// Add window borders to the new window size
|
||||||
r = (RECT){.right = n_w, .bottom = n_h};
|
r = (RECT){.right = n_w, .bottom = n_h};
|
||||||
add_window_borders(w32->window, &r);
|
add_window_borders(w32->window, &r);
|
||||||
|
// Get top and left border size for client area position calculation
|
||||||
|
long b_top = -r.top;
|
||||||
|
long b_left = -r.left;
|
||||||
// Center the final window
|
// Center the final window
|
||||||
n_w = r.right - r.left;
|
n_w = r.right - r.left;
|
||||||
n_h = r.bottom - r.top;
|
n_h = r.bottom - r.top;
|
||||||
@ -1109,6 +1116,9 @@ static void reinit_window_state(struct vo_w32_state *w32)
|
|||||||
r.top = w32->screenrc.y0 + screen_h / 2 - n_h / 2;
|
r.top = w32->screenrc.y0 + screen_h / 2 - n_h / 2;
|
||||||
r.right = r.left + n_w;
|
r.right = r.left + n_w;
|
||||||
r.bottom = r.top + n_h;
|
r.bottom = r.top + n_h;
|
||||||
|
// Save new client area position
|
||||||
|
w32->window_x = r.left + b_left;
|
||||||
|
w32->window_y = r.top + b_top;
|
||||||
}
|
}
|
||||||
|
|
||||||
MP_VERBOSE(w32, "reset window bounds: %d:%d:%d:%d\n",
|
MP_VERBOSE(w32, "reset window bounds: %d:%d:%d:%d\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user