From 499f928c33d7f05c8d7a795b71d4bd45a3d7eb08 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 22 Sep 2017 07:15:41 -0700 Subject: [PATCH] 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. --- src/video/windows/SDL_windowswindow.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index adbbe5367..50fdec9a1 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -94,7 +94,11 @@ WIN_AdjustWindowRectWithStyle(SDL_Window *window, DWORD style, BOOL menu, int *x rect.top = 0; rect.right = (use_current ? window->w : window->windowed.w); rect.bottom = (use_current ? window->h : window->windowed.h); - AdjustWindowRectEx(&rect, style, menu, 0); + + // 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 ); *x = (use_current ? window->x : window->windowed.x) + rect.left; *y = (use_current ? window->y : window->windowed.y) + rect.top;