Simplified Windows window creation.
authorSam Lantinga <slouken@libsdl.org>
Mon, 21 Feb 2011 22:27:19 -0800
changeset 5382fd9a7a0afcbf
parent 5381 79e60256dbf7
child 5383 40c76519000e
Simplified Windows window creation.
src/video/windows/SDL_windowswindow.c
     1.1 --- a/src/video/windows/SDL_windowswindow.c	Mon Feb 21 22:26:59 2011 -0800
     1.2 +++ b/src/video/windows/SDL_windowswindow.c	Mon Feb 21 22:27:19 2011 -0800
     1.3 @@ -194,7 +194,6 @@
     1.4      SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
     1.5      HWND hwnd;
     1.6      RECT rect;
     1.7 -    SDL_Rect bounds;
     1.8      DWORD style = STYLE_BASIC;
     1.9      int x, y;
    1.10      int w, h;
    1.11 @@ -202,38 +201,16 @@
    1.12      style |= GetWindowStyle(window);
    1.13  
    1.14      /* Figure out what the window area will be */
    1.15 -    rect.left = 0;
    1.16 -    rect.top = 0;
    1.17 -    rect.right = window->w;
    1.18 -    rect.bottom = window->h;
    1.19 +    rect.left = window->x;
    1.20 +    rect.top = window->y;
    1.21 +    rect.right = window->x + window->w;
    1.22 +    rect.bottom = window->y + window->h;
    1.23      AdjustWindowRectEx(&rect, style, FALSE, 0);
    1.24 +    x = rect.left;
    1.25 +    y = rect.top;
    1.26      w = (rect.right - rect.left);
    1.27      h = (rect.bottom - rect.top);
    1.28  
    1.29 -    WIN_GetDisplayBounds(_this, display, &bounds);
    1.30 -    if (SDL_WINDOWPOS_ISCENTERED(window->x)) {
    1.31 -        x = bounds.x + (bounds.w - w) / 2;
    1.32 -    } else if (SDL_WINDOWPOS_ISUNDEFINED(window->x)) {
    1.33 -        if (bounds.x == 0) {
    1.34 -            x = CW_USEDEFAULT;
    1.35 -        } else {
    1.36 -            x = bounds.x;
    1.37 -        }
    1.38 -    } else {
    1.39 -        x = window->x + rect.left;
    1.40 -    }
    1.41 -    if (SDL_WINDOWPOS_ISCENTERED(window->y)) {
    1.42 -        y = bounds.y + (bounds.h - h) / 2;
    1.43 -    } else if (SDL_WINDOWPOS_ISUNDEFINED(window->x)) {
    1.44 -        if (bounds.x == 0) {
    1.45 -            y = CW_USEDEFAULT;
    1.46 -        } else {
    1.47 -            y = bounds.y;
    1.48 -        }
    1.49 -    } else {
    1.50 -        y = window->y + rect.top;
    1.51 -    }
    1.52 -
    1.53      hwnd =
    1.54          CreateWindow(SDL_Appname, TEXT(""), style, x, y, w, h, NULL, NULL,
    1.55                       SDL_Instance, NULL);