A window being fullscreen takes precedence over coordinate checks
authorSam Lantinga <slouken@libsdl.org>
Wed, 03 Oct 2012 18:54:31 -0700
changeset 6547 38bc368a3b87
parent 6544 c03db4864789
child 6548 fc9e6be24ca9
A window being fullscreen takes precedence over coordinate checks This fixes restoring video mode on the second display at shutdown in some circumstances.
src/video/SDL_video.c
--- a/src/video/SDL_video.c	Wed Oct 03 13:39:42 2012 -0700
+++ b/src/video/SDL_video.c	Wed Oct 03 18:54:31 2012 -0700
@@ -933,13 +933,20 @@
     }
 
     /* Find the display containing the window */
+    for (i = 0; i < _this->num_displays; ++i) {
+        SDL_VideoDisplay *display = &_this->displays[i];
+
+        if (display->fullscreen_window == window) {
+            return i;
+        }
+    }
     center.x = window->x + window->w / 2;
     center.y = window->y + window->h / 2;
     for (i = 0; i < _this->num_displays; ++i) {
         SDL_VideoDisplay *display = &_this->displays[i];
 
         SDL_GetDisplayBounds(i, &rect);
-        if (display->fullscreen_window == window || SDL_EnclosePoints(&center, 1, &rect, NULL)) {
+        if (SDL_EnclosePoints(&center, 1, &rect, NULL)) {
             return i;
         }