Commit 5abd7d16d7482049a51ad94f7d4f500834bd2970

Sam Lantinga 2018-02-13T22:58:20

Don't attempt WM_NCCALCSIZE adjustment when in fullscreen window transition

diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c
index 7bcfd6b..a5fd006 100644
--- a/src/video/windows/SDL_windowsevents.c
+++ b/src/video/windows/SDL_windowsevents.c
@@ -967,12 +967,14 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
     case WM_NCCALCSIZE:
         {
-            if (wParam == TRUE && SDL_GetWindowFlags(data->window) & SDL_WINDOW_BORDERLESS) {
+            Uint32 window_flags = SDL_GetWindowFlags(data->window);
+            if (wParam == TRUE && (window_flags & SDL_WINDOW_BORDERLESS) && !(window_flags & SDL_WINDOW_FULLSCREEN)) {
                 /* When borderless, need to tell windows that the size of the non-client area is 0 */
-                if (!(SDL_GetWindowFlags(data->window) & SDL_WINDOW_RESIZABLE)) {
+                if (!(window_flags & SDL_WINDOW_RESIZABLE)) {
                     int w, h;
                     NCCALCSIZE_PARAMS *params = (NCCALCSIZE_PARAMS *)lParam;
-                    SDL_GetWindowSize(data->window, &w, &h);
+                    w = data->window->windowed.w;
+                    h = data->window->windowed.h;
                     params->rgrc[0].right = params->rgrc[0].left + w;
                     params->rgrc[0].bottom = params->rgrc[0].top + h;
                 }