[Commits] SDL: Fixed bug 3985 - SDL_CreateWindow() has stopped changing sc...

libsdl.org revision control commits-owner at libsdl.org
Thu Jan 25 11:12:24 PST 2018


details:   https://hg.libsdl.org/SDL/rev/f622a4457a25
changeset: 11835:f622a4457a25
user:      Sam Lantinga <slouken at libsdl.org>
date:      Thu Jan 25 11:12:20 2018 -0800
description:
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.

diffstat:

 src/video/windows/SDL_windowswindow.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (49 lines):

diff -r b359333bdc52 -r f622a4457a25 src/video/windows/SDL_windowswindow.c
--- a/src/video/windows/SDL_windowswindow.c	Mon Jan 22 09:46:48 2018 -0500
+++ b/src/video/windows/SDL_windowswindow.c	Thu Jan 25 11:12:20 2018 -0800
@@ -111,8 +111,9 @@
     rect.right = (use_current ? window->w : window->windowed.w);
     rect.bottom = (use_current ? window->h : window->windowed.h);
 
-    // 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
-    // expanding the window client area to the previous window + chrome size, so shouldn't need to adjust the window size for the set styles.
+    /* 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
+       expanding the window client area to the previous window + chrome size, so shouldn't need to adjust the window size for the set styles.
+     */
     if (!(window->flags & SDL_WINDOW_BORDERLESS))
         AdjustWindowRectEx(&rect, style, menu, 0);
 
@@ -211,13 +212,13 @@
         if (GetClientRect(hwnd, &rect)) {
             int w = rect.right;
             int h = rect.bottom;
-            if ((window->w && window->w != w) || (window->h && window->h != h)) {
+            if ((window->windowed.w && window->windowed.w != w) || (window->windowed.h && window->windowed.h != h)) {
                 /* We tried to create a window larger than the desktop and Windows didn't allow it.  Override! */
                 int x, y;
                 int w, h;
 
                 /* Figure out what the window area will be */
-                WIN_AdjustWindowRect(window, &x, &y, &w, &h, SDL_TRUE);
+                WIN_AdjustWindowRect(window, &x, &y, &w, &h, SDL_FALSE);
                 SetWindowPos(hwnd, HWND_NOTOPMOST, x, y, w, h, SWP_NOCOPYBITS | SWP_NOZORDER | SWP_NOACTIVATE);
             } else {
                 window->w = w;
@@ -312,7 +313,7 @@
     style |= GetWindowStyle(window);
 
     /* Figure out what the window area will be */
-    WIN_AdjustWindowRectWithStyle(window, style, FALSE, &x, &y, &w, &h, SDL_TRUE);
+    WIN_AdjustWindowRectWithStyle(window, style, FALSE, &x, &y, &w, &h, SDL_FALSE);
 
     hwnd =
         CreateWindow(SDL_Appname, TEXT(""), style, x, y, w, h, parent, NULL,
@@ -331,7 +332,7 @@
         return -1;
     }
 
-    // Inform Windows of the frame change so we can respond to WM_NCCALCSIZE
+    /* Inform Windows of the frame change so we can respond to WM_NCCALCSIZE */
     SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
 
     if (!(window->flags & SDL_WINDOW_OPENGL)) {


More information about the commits mailing list