Removed unreferenced variable
authorSam Lantinga <slouken@libsdl.org>
Sun, 13 Mar 2011 11:17:11 -0700
changeset 5483 ccec742c9b7d
parent 5482 2c0477323626
child 5484 e20c93bc9122
Removed unreferenced variable
src/video/windows/SDL_windowswindow.c
--- a/src/video/windows/SDL_windowswindow.c	Sat Mar 12 13:28:56 2011 -0800
+++ b/src/video/windows/SDL_windowswindow.c	Sun Mar 13 11:17:11 2011 -0700
@@ -345,7 +345,6 @@
     SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
     HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
     RECT rect;
-    SDL_Rect bounds;
     DWORD style;
     HWND top;
     BOOL menu;
@@ -371,8 +370,18 @@
     AdjustWindowRectEx(&rect, style, menu, 0);
     w = (rect.right - rect.left);
     h = (rect.bottom - rect.top);
-    x = window->x + rect.left;
-    y = window->y + rect.top;
+
+    WIN_GetDisplayBounds(_this, display, &bounds);
+    if (SDL_WINDOWPOS_ISCENTERED(window->x)) {
+        x = bounds.x + (bounds.w - w) / 2;
+    } else {
+        x = window->x + rect.left;
+    }
+    if (SDL_WINDOWPOS_ISCENTERED(window->y)) {
+        y = bounds.y + (bounds.h - h) / 2;
+    } else {
+        y = window->y + rect.top;
+    }
 
     SetWindowPos(hwnd, top, x, y, 0, 0, (SWP_NOCOPYBITS | SWP_NOSIZE));
 }