Fixed bug 1848 - SDL_SetWindowSize cannot set sizes larger than desktop resolution in Windows
authorSam Lantinga <slouken@libsdl.org>
Tue, 06 Aug 2013 22:55:55 -0700
changeset 75837e053ad01aa3
parent 7582 fb276f54cd07
child 7584 864eca4d27a7
Fixed bug 1848 - SDL_SetWindowSize cannot set sizes larger than desktop resolution in Windows
src/video/windows/SDL_windowswindow.c
     1.1 --- a/src/video/windows/SDL_windowswindow.c	Tue Aug 06 22:31:11 2013 -0700
     1.2 +++ b/src/video/windows/SDL_windowswindow.c	Tue Aug 06 22:55:55 2013 -0700
     1.3 @@ -131,8 +131,15 @@
     1.4      {
     1.5          RECT rect;
     1.6          if (GetClientRect(hwnd, &rect)) {
     1.7 -            window->w = rect.right;
     1.8 -            window->h = rect.bottom;
     1.9 +            int w = rect.right;
    1.10 +            int h = rect.bottom;
    1.11 +            if ((window->w && window->w != w) || (window->h && window->h != h)) {
    1.12 +                // We tried to create a window larger than the desktop and Windows didn't allow it.  Override!
    1.13 +                SetWindowPos(hwnd, NULL, 0, 0, window->w, window->h, SWP_NOCOPYBITS | SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
    1.14 +            } else {
    1.15 +                window->w = w;
    1.16 +                window->h = h;
    1.17 +            }
    1.18          }
    1.19      }
    1.20      {