summaryrefslogtreecommitdiffstats
path: root/video/out/w32_common.c
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-08-22 15:36:36 +0200
committersfan5 <sfan5@live.de>2023-08-23 15:37:41 +0200
commitce7997649816e4d6c05071fbd4ecac0557120720 (patch)
tree6214f0c65e86848c2c8d40f3fedf3ddde2ef4082 /video/out/w32_common.c
parent391687110170f1b8c0fed35519cb25f83012d662 (diff)
downloadmpv-ce7997649816e4d6c05071fbd4ecac0557120720.tar.bz2
mpv-ce7997649816e4d6c05071fbd4ecac0557120720.tar.xz
win32: don't ignore --screen and --fs-screen
Fixes: 57ba77fc736f6976bc114974f5955c972139740f Fixes: #12220
Diffstat (limited to 'video/out/w32_common.c')
-rw-r--r--video/out/w32_common.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/video/out/w32_common.c b/video/out/w32_common.c
index 32e8cfa195..13001ba540 100644
--- a/video/out/w32_common.c
+++ b/video/out/w32_common.c
@@ -147,6 +147,8 @@ struct vo_w32_state {
// entire virtual desktop area - but we still limit to one monitor size.
bool fit_on_screen;
+ bool win_force_pos;
+
ITaskbarList2 *taskbar_list;
ITaskbarList3 *taskbar_list3;
UINT tbtnCreatedMsg;
@@ -666,8 +668,15 @@ static HMONITOR get_default_monitor(struct vo_w32_state *w32)
w32->opts->screen_id;
// Handle --fs-screen=<all|default> and --screen=default
- if (id < 0)
- return MonitorFromWindow(w32->window, MONITOR_DEFAULTTOPRIMARY);
+ if (id < 0) {
+ if (w32->win_force_pos && !w32->current_fs) {
+ // Get window from forced position
+ return MonitorFromRect(&w32->windowrc, MONITOR_DEFAULTTOPRIMARY);
+ } else {
+ // Let compositor decide
+ return MonitorFromWindow(w32->window, MONITOR_DEFAULTTOPRIMARY);
+ }
+ }
HMONITOR mon = get_monitor(id);
if (mon)
@@ -681,12 +690,8 @@ 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 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
+ // The window is not visible during initialization, so get the
// monitor by --screen or --fs-screen id, or fallback to primary.
mon = get_default_monitor(w32);
}
@@ -1494,7 +1499,8 @@ static void gui_thread_reconfig(void *ptr)
geo.win.x0 + vo->dwidth, geo.win.y0 + vo->dheight);
w32->prev_windowrc = w32->windowrc;
w32->window_bounds_initialized = true;
- w32->fit_on_screen = !(geo.flags & VO_WIN_FORCE_POS);
+ w32->win_force_pos = geo.flags & VO_WIN_FORCE_POS;
+ w32->fit_on_screen = !w32->win_force_pos;
goto finish;
}