Fixed bug 3985 - SDL_CreateWindow() has stopped changing screen mode when SDL_WINDOW_FULLSCREEN is used
authorSam Lantinga <slouken@libsdl.org>
Thu, 25 Jan 2018 11:12:20 -0800
changeset 11835f622a4457a25
parent 11834 b359333bdc52
child 11836 a42b155124a3
Fixed bug 3985 - SDL_CreateWindow() has stopped changing screen mode when SDL_WINDOW_FULLSCREEN is used

Anthony

This worked in 2.0.5 as normal, but stopped working in 2.0.7. The monitor's resolution doesn't change, a window is created in full screen mode at the virtual desktop resolution instead.
src/video/windows/SDL_windowswindow.c
     1.1 --- a/src/video/windows/SDL_windowswindow.c	Mon Jan 22 09:46:48 2018 -0500
     1.2 +++ b/src/video/windows/SDL_windowswindow.c	Thu Jan 25 11:12:20 2018 -0800
     1.3 @@ -111,8 +111,9 @@
     1.4      rect.right = (use_current ? window->w : window->windowed.w);
     1.5      rect.bottom = (use_current ? window->h : window->windowed.h);
     1.6  
     1.7 -    // borderless windows will have WM_NCCALCSIZE return 0 for the non-client area. When this happens, it looks like windows will send a resize message
     1.8 -    // expanding the window client area to the previous window + chrome size, so shouldn't need to adjust the window size for the set styles.
     1.9 +    /* borderless windows will have WM_NCCALCSIZE return 0 for the non-client area. When this happens, it looks like windows will send a resize message
    1.10 +       expanding the window client area to the previous window + chrome size, so shouldn't need to adjust the window size for the set styles.
    1.11 +     */
    1.12      if (!(window->flags & SDL_WINDOW_BORDERLESS))
    1.13          AdjustWindowRectEx(&rect, style, menu, 0);
    1.14  
    1.15 @@ -211,13 +212,13 @@
    1.16          if (GetClientRect(hwnd, &rect)) {
    1.17              int w = rect.right;
    1.18              int h = rect.bottom;
    1.19 -            if ((window->w && window->w != w) || (window->h && window->h != h)) {
    1.20 +            if ((window->windowed.w && window->windowed.w != w) || (window->windowed.h && window->windowed.h != h)) {
    1.21                  /* We tried to create a window larger than the desktop and Windows didn't allow it.  Override! */
    1.22                  int x, y;
    1.23                  int w, h;
    1.24  
    1.25                  /* Figure out what the window area will be */
    1.26 -                WIN_AdjustWindowRect(window, &x, &y, &w, &h, SDL_TRUE);
    1.27 +                WIN_AdjustWindowRect(window, &x, &y, &w, &h, SDL_FALSE);
    1.28                  SetWindowPos(hwnd, HWND_NOTOPMOST, x, y, w, h, SWP_NOCOPYBITS | SWP_NOZORDER | SWP_NOACTIVATE);
    1.29              } else {
    1.30                  window->w = w;
    1.31 @@ -312,7 +313,7 @@
    1.32      style |= GetWindowStyle(window);
    1.33  
    1.34      /* Figure out what the window area will be */
    1.35 -    WIN_AdjustWindowRectWithStyle(window, style, FALSE, &x, &y, &w, &h, SDL_TRUE);
    1.36 +    WIN_AdjustWindowRectWithStyle(window, style, FALSE, &x, &y, &w, &h, SDL_FALSE);
    1.37  
    1.38      hwnd =
    1.39          CreateWindow(SDL_Appname, TEXT(""), style, x, y, w, h, parent, NULL,
    1.40 @@ -331,7 +332,7 @@
    1.41          return -1;
    1.42      }
    1.43  
    1.44 -    // Inform Windows of the frame change so we can respond to WM_NCCALCSIZE
    1.45 +    /* Inform Windows of the frame change so we can respond to WM_NCCALCSIZE */
    1.46      SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
    1.47  
    1.48      if (!(window->flags & SDL_WINDOW_OPENGL)) {