From d4f488ac673db2979f9954912849c8812b5c6c8f Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 13 Mar 2011 11:17:11 -0700 Subject: [PATCH] Removed unreferenced variable --- src/video/windows/SDL_windowswindow.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index 1bb46c369..afe8516e6 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -345,7 +345,6 @@ WIN_SetWindowPosition(_THIS, SDL_Window * window) 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 @@ WIN_SetWindowPosition(_THIS, SDL_Window * window) 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)); }