[Commits] SDL: Fixed min/max window size handling for borderless resizable...

libsdl.org revision control commits-owner at libsdl.org
Thu Feb 8 18:07:39 PST 2018


details:   https://hg.libsdl.org/SDL/rev/9e521a040926
changeset: 11857:9e521a040926
user:      Sam Lantinga <slouken at libsdl.org>
date:      Thu Feb 08 18:07:14 2018 -0800
description:
Fixed min/max window size handling for borderless resizable windows

diffstat:

 src/video/windows/SDL_windowsevents.c |  32 ++++++++++++++++----------------
 1 files changed, 16 insertions(+), 16 deletions(-)

diffs (50 lines):

diff -r 713fd3ac3c9b -r 9e521a040926 src/video/windows/SDL_windowsevents.c
--- a/src/video/windows/SDL_windowsevents.c	Thu Feb 08 17:07:47 2018 +0300
+++ b/src/video/windows/SDL_windowsevents.c	Thu Feb 08 18:07:14 2018 -0800
@@ -697,8 +697,6 @@
             int w, h;
             int min_w, min_h;
             int max_w, max_h;
-            int style;
-            BOOL menu;
             BOOL constrain_max_size;
 
             if (SDL_IsShapedWindow(data->window))
@@ -731,21 +729,23 @@
                 constrain_max_size = FALSE;
             }
 
-            size.top = 0;
-            size.left = 0;
-            size.bottom = h;
-            size.right = w;
+            if (!(SDL_GetWindowFlags(data->window) & SDL_WINDOW_BORDERLESS)) {
+                LONG style = GetWindowLong(hwnd, GWL_STYLE);
+                /* DJM - according to the docs for GetMenu(), the
+                   return value is undefined if hwnd is a child window.
+                   Apparently it's too difficult for MS to check
+                   inside their function, so I have to do it here.
+                 */
+                BOOL menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL);
+                size.top = 0;
+                size.left = 0;
+                size.bottom = h;
+                size.right = w;
 
-            style = GetWindowLong(hwnd, GWL_STYLE);
-            /* DJM - according to the docs for GetMenu(), the
-               return value is undefined if hwnd is a child window.
-               Apparently it's too difficult for MS to check
-               inside their function, so I have to do it here.
-             */
-            menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL);
-            AdjustWindowRectEx(&size, style, menu, 0);
-            w = size.right - size.left;
-            h = size.bottom - size.top;
+                AdjustWindowRectEx(&size, style, menu, 0);
+                w = size.right - size.left;
+                h = size.bottom - size.top;
+            }
 
             /* Fix our size to the current size */
             info = (MINMAXINFO *) lParam;


More information about the commits mailing list