From 8ea0b212605e1d21db32472ef12ccb6aae5a0bbe Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 21 Feb 2011 22:27:19 -0800 Subject: [PATCH] Simplified Windows window creation. --- src/video/windows/SDL_windowswindow.c | 35 +++++---------------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index bb34c81bb..3b7bba59f 100755 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -194,7 +194,6 @@ WIN_CreateWindow(_THIS, SDL_Window * window) SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); HWND hwnd; RECT rect; - SDL_Rect bounds; DWORD style = STYLE_BASIC; int x, y; int w, h; @@ -202,38 +201,16 @@ WIN_CreateWindow(_THIS, SDL_Window * window) style |= GetWindowStyle(window); /* Figure out what the window area will be */ - rect.left = 0; - rect.top = 0; - rect.right = window->w; - rect.bottom = window->h; + rect.left = window->x; + rect.top = window->y; + rect.right = window->x + window->w; + rect.bottom = window->y + window->h; AdjustWindowRectEx(&rect, style, FALSE, 0); + x = rect.left; + y = rect.top; w = (rect.right - rect.left); h = (rect.bottom - rect.top); - WIN_GetDisplayBounds(_this, display, &bounds); - if (SDL_WINDOWPOS_ISCENTERED(window->x)) { - x = bounds.x + (bounds.w - w) / 2; - } else if (SDL_WINDOWPOS_ISUNDEFINED(window->x)) { - if (bounds.x == 0) { - x = CW_USEDEFAULT; - } else { - x = bounds.x; - } - } else { - x = window->x + rect.left; - } - if (SDL_WINDOWPOS_ISCENTERED(window->y)) { - y = bounds.y + (bounds.h - h) / 2; - } else if (SDL_WINDOWPOS_ISUNDEFINED(window->x)) { - if (bounds.x == 0) { - y = CW_USEDEFAULT; - } else { - y = bounds.y; - } - } else { - y = window->y + rect.top; - } - hwnd = CreateWindow(SDL_Appname, TEXT(""), style, x, y, w, h, NULL, NULL, SDL_Instance, NULL);