From f48344c62e23e669f522d5afe4ec664defbc3b23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Sat, 29 Dec 2012 11:27:56 +0000 Subject: [PATCH] =?UTF-8?q?fixed=20MT#4846:=20make=20sure,=20that=20we=20a?= =?UTF-8?q?lways=20get=20a=20win=5Fmonitor=5Finfo*=20in=20winwindow=5Fvide?= =?UTF-8?q?o=5Fwindow=5Fmonitor()=20[Oliver=20St=C3=B6neberg]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/osd/windows/window.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/osd/windows/window.c b/src/osd/windows/window.c index b4d8114815a..5058bba6b23 100644 --- a/src/osd/windows/window.c +++ b/src/osd/windows/window.c @@ -834,15 +834,19 @@ void winwindow_video_window_update(win_window_info *window) win_monitor_info *winwindow_video_window_monitor(win_window_info *window, const RECT *proposed) { - win_monitor_info *monitor; + win_monitor_info *monitor = NULL; // in window mode, find the nearest if (!window->fullscreen) { - if (proposed != NULL) - monitor = winvideo_monitor_from_handle(MonitorFromRect(proposed, MONITOR_DEFAULTTONEAREST)); - else - monitor = winvideo_monitor_from_handle(MonitorFromWindow(window->hwnd, MONITOR_DEFAULTTONEAREST)); + // result can be NULL when e.g. the color scheme changes + do + { + if (proposed != NULL) + monitor = winvideo_monitor_from_handle(MonitorFromRect(proposed, MONITOR_DEFAULTTONEAREST)); + else + monitor = winvideo_monitor_from_handle(MonitorFromWindow(window->hwnd, MONITOR_DEFAULTTONEAREST)); + } while (monitor == NULL); } // in full screen, just use the configured monitor