Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
A window being fullscreen takes precedence over coordinate checks
Browse files Browse the repository at this point in the history
This fixes restoring video mode on the second display at shutdown in some circumstances.
  • Loading branch information
slouken committed Oct 4, 2012
1 parent bf1427e commit 64a3818
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/video/SDL_video.c
Expand Up @@ -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(&center, 1, &rect, NULL)) {
if (SDL_EnclosePoints(&center, 1, &rect, NULL)) {
return i;
}

Expand Down

0 comments on commit 64a3818

Please sign in to comment.