trunk/src/osd/windows/window.c
r19915 | r19916 | |
834 | 834 | |
835 | 835 | win_monitor_info *winwindow_video_window_monitor(win_window_info *window, const RECT *proposed) |
836 | 836 | { |
837 | | win_monitor_info *monitor; |
| 837 | win_monitor_info *monitor = NULL; |
838 | 838 | |
839 | 839 | // in window mode, find the nearest |
840 | 840 | if (!window->fullscreen) |
841 | 841 | { |
842 | | if (proposed != NULL) |
843 | | monitor = winvideo_monitor_from_handle(MonitorFromRect(proposed, MONITOR_DEFAULTTONEAREST)); |
844 | | else |
845 | | monitor = winvideo_monitor_from_handle(MonitorFromWindow(window->hwnd, MONITOR_DEFAULTTONEAREST)); |
| 842 | // result can be NULL when e.g. the color scheme changes |
| 843 | do |
| 844 | { |
| 845 | if (proposed != NULL) |
| 846 | monitor = winvideo_monitor_from_handle(MonitorFromRect(proposed, MONITOR_DEFAULTTONEAREST)); |
| 847 | else |
| 848 | monitor = winvideo_monitor_from_handle(MonitorFromWindow(window->hwnd, MONITOR_DEFAULTTONEAREST)); |
| 849 | } while (monitor == NULL); |
846 | 850 | } |
847 | 851 | |
848 | 852 | // in full screen, just use the configured monitor |