1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-20 02:09:52 +00:00

w32_common: try to get the monitor from the window bounds

This commit is contained in:
Zenos 2023-04-04 05:27:29 +02:00 committed by sfan5
parent da965906ef
commit 57ba77fc73

View File

@ -681,8 +681,12 @@ static MONITORINFO get_monitor_info(struct vo_w32_state *w32)
HMONITOR mon; HMONITOR mon;
if (IsWindowVisible(w32->window) && !w32->current_fs) { if (IsWindowVisible(w32->window) && !w32->current_fs) {
mon = MonitorFromWindow(w32->window, MONITOR_DEFAULTTOPRIMARY); mon = MonitorFromWindow(w32->window, MONITOR_DEFAULTTOPRIMARY);
} else { } else if (w32->window_bounds_initialized && !w32->current_fs) {
// The window is not visible during initialization, so get the // The window is not visible during initialization, so get the
// monitor by the cached window rect, or fallback to primary.
mon = MonitorFromRect(&w32->windowrc, MONITOR_DEFAULTTOPRIMARY);
} else {
// The window bounds have not been initialized, so get the
// monitor by --screen or --fs-screen id, or fallback to primary. // monitor by --screen or --fs-screen id, or fallback to primary.
mon = get_default_monitor(w32); mon = get_default_monitor(w32);
} }