summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/windows
diff options
context:
space:
mode:
author Oliver Stöneberg <firewave@users.noreply.github.com>2012-12-29 11:27:56 +0000
committer Oliver Stöneberg <firewave@users.noreply.github.com>2012-12-29 11:27:56 +0000
commitf48344c62e23e669f522d5afe4ec664defbc3b23 (patch)
treea36fcb6ea2cf5cef45a807d92f70c5acbca265dc /src/osd/windows
parent368caac5a26f1ffd87bf41be64dec7635f1d1c61 (diff)
fixed MT#4846: make sure, that we always get a win_monitor_info* in winwindow_video_window_monitor() [Oliver Stöneberg]
Diffstat (limited to 'src/osd/windows')
-rw-r--r--src/osd/windows/window.c14
1 files 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