summaryrefslogtreecommitdiffstats
path: root/video/out/w32_common.c
diff options
context:
space:
mode:
authorZenos <zeno.arrows@gmail.com>2023-04-04 05:27:29 +0200
committersfan5 <sfan5@live.de>2023-08-20 20:39:05 +0200
commit57ba77fc736f6976bc114974f5955c972139740f (patch)
tree6400c2a6a56fc439424e90b102b207657cab7766 /video/out/w32_common.c
parentda965906ef0919689d86362e8611e099b098a418 (diff)
downloadmpv-57ba77fc736f6976bc114974f5955c972139740f.tar.bz2
mpv-57ba77fc736f6976bc114974f5955c972139740f.tar.xz
w32_common: try to get the monitor from the window bounds
Diffstat (limited to 'video/out/w32_common.c')
-rw-r--r--video/out/w32_common.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/video/out/w32_common.c b/video/out/w32_common.c
index f7c34cd096..32e8cfa195 100644
--- a/video/out/w32_common.c
+++ b/video/out/w32_common.c
@@ -681,8 +681,12 @@ static MONITORINFO get_monitor_info(struct vo_w32_state *w32)
HMONITOR mon;
if (IsWindowVisible(w32->window) && !w32->current_fs) {
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
+ // 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.
mon = get_default_monitor(w32);
}