From 3535fe0b91b8a66f7c1873ff8e19cfab5e5d37b3 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 14 Sep 2012 13:13:47 -0400 Subject: [PATCH] Consolidate some code in the Windows video target. --- src/video/windows/SDL_windowswindow.c | 41 +++++++-------------------- 1 file changed, 10 insertions(+), 31 deletions(-) diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index 485a11eb6..ecba7ffe9 100755 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -339,8 +339,8 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM) hicon); } -void -WIN_SetWindowPosition(_THIS, SDL_Window * window) +static void +WIN_SetWindowPositionInternal(_THIS, SDL_Window * window, UINT flags) { HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; RECT rect; @@ -372,40 +372,19 @@ WIN_SetWindowPosition(_THIS, SDL_Window * window) x = window->x + rect.left; y = window->y + rect.top; - SetWindowPos(hwnd, top, x, y, 0, 0, (SWP_NOCOPYBITS | SWP_NOSIZE)); + SetWindowPos(hwnd, top, x, y, w, h, flags); +} + +void +WIN_SetWindowPosition(_THIS, SDL_Window * window) +{ + WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOSIZE); } void WIN_SetWindowSize(_THIS, SDL_Window * window) { - HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; - RECT rect; - DWORD style; - HWND top; - BOOL menu; - int w, h; - - /* Figure out what the window area will be */ - if (window->flags & SDL_WINDOW_FULLSCREEN) { - top = HWND_TOPMOST; - } else { - top = HWND_NOTOPMOST; - } - style = GetWindowLong(hwnd, GWL_STYLE); - rect.left = 0; - rect.top = 0; - rect.right = window->w; - rect.bottom = window->h; -#ifdef _WIN32_WCE - menu = FALSE; -#else - menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); -#endif - AdjustWindowRectEx(&rect, style, menu, 0); - w = (rect.right - rect.left); - h = (rect.bottom - rect.top); - - SetWindowPos(hwnd, top, 0, 0, w, h, (SWP_NOCOPYBITS | SWP_NOMOVE)); + WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOMOVE); } #ifdef _WIN32_WCE