src/video/SDL_video.c
changeset 7195 d206c3a59b2e
parent 7191 75360622e65f
child 7210 5b35f3e503c4
--- a/src/video/SDL_video.c	Sun May 19 22:28:10 2013 -0700
+++ b/src/video/SDL_video.c	Sun May 19 22:36:54 2013 -0700
@@ -1497,12 +1497,6 @@
 {
     CHECK_WINDOW_MAGIC(window, );
 
-    if (!SDL_WINDOWPOS_ISUNDEFINED(x)) {
-        window->x = x;
-    }
-    if (!SDL_WINDOWPOS_ISUNDEFINED(y)) {
-        window->y = y;
-    }
     if (SDL_WINDOWPOS_ISCENTERED(x) || SDL_WINDOWPOS_ISCENTERED(y)) {
         SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
         int displayIndex;
@@ -1511,12 +1505,20 @@
         displayIndex = SDL_GetIndexOfDisplay(display);
         SDL_GetDisplayBounds(displayIndex, &bounds);
         if (SDL_WINDOWPOS_ISCENTERED(x)) {
-            window->x = bounds.x + (bounds.w - window->w) / 2;
+            x = bounds.x + (bounds.w - window->w) / 2;
         }
         if (SDL_WINDOWPOS_ISCENTERED(y)) {
-            window->y = bounds.y + (bounds.h - window->h) / 2;
+            y = bounds.y + (bounds.h - window->h) / 2;
         }
     }
+
+    if (!SDL_WINDOWPOS_ISUNDEFINED(x)) {
+        window->x = x;
+    }
+    if (!SDL_WINDOWPOS_ISUNDEFINED(y)) {
+        window->y = y;
+    }
+
     if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
         if (_this->SetWindowPosition) {
             _this->SetWindowPosition(_this, window);