From 64a38189fabe0da979777595541987337eeb6c29 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 3 Oct 2012 18:54:31 -0700 Subject: [PATCH] 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 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 24c44bbf6..23193151a 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -933,13 +933,20 @@ SDL_GetWindowDisplay(SDL_Window * window) } /* 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(¢er, 1, &rect, NULL)) { + if (SDL_EnclosePoints(¢er, 1, &rect, NULL)) { return i; }