src/video/SDL_video.c
changeset 9363 c9a4d606f6db
parent 9278 8900afb78a19
child 9412 8b1436ce1028
--- a/src/video/SDL_video.c	Sat Jan 10 13:47:37 2015 +0100
+++ b/src/video/SDL_video.c	Thu Feb 19 19:40:58 2015 -0500
@@ -1607,13 +1607,14 @@
     CHECK_WINDOW_MAGIC(window,);
 
     if (SDL_WINDOWPOS_ISCENTERED(x) || SDL_WINDOWPOS_ISCENTERED(y)) {
-        SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
-        int displayIndex;
+        int displayIndex = (x & 0xFFFF);
         SDL_Rect bounds;
+        if (displayIndex > _this->num_displays) {
+            displayIndex = 0;
+        }
 
         SDL_zero(bounds);
 
-        displayIndex = SDL_GetIndexOfDisplay(display);
         SDL_GetDisplayBounds(displayIndex, &bounds);
         if (SDL_WINDOWPOS_ISCENTERED(x)) {
             x = bounds.x + (bounds.w - window->w) / 2;