win32: Use the current flags to determine if NCCALCSIZE is required
Build (All) / Create test plan (push) Has been cancelled
Build (All) / level1 (push) Has been cancelled
Build (All) / level2 (push) Has been cancelled

SDL_GetWindowFlags() also ORs in pending flags, whereas the current state is needed here, particularly when creating/showing a window.
This commit is contained in:
Frank Praznik
2025-08-05 17:24:10 -04:00
parent 90a023007f
commit cd0c660dea
2 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -2175,7 +2175,7 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
case WM_NCCALCSIZE: case WM_NCCALCSIZE:
{ {
SDL_WindowFlags window_flags = SDL_GetWindowFlags(data->window); SDL_WindowFlags window_flags = data->window->flags;
if (wParam == TRUE && (window_flags & SDL_WINDOW_BORDERLESS) && !(window_flags & SDL_WINDOW_FULLSCREEN)) { 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 // When borderless, need to tell windows that the size of the non-client area is 0
NCCALCSIZE_PARAMS *params = (NCCALCSIZE_PARAMS *)lParam; NCCALCSIZE_PARAMS *params = (NCCALCSIZE_PARAMS *)lParam;
+6 -6
View File
@@ -1071,16 +1071,16 @@ void WIN_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
WIN_SetWindowPosition(_this, window); WIN_SetWindowPosition(_this, window);
} }
/* If the window will immediately become fullscreen, use the borderless style to hide the initial borders. // If the window isn't borderless and will be fullscreen, use the borderless style to hide the initial borders.
*
* Note: The combination of flags used in STYLE_BORDERLESS_WINDOWED will still briefly show the borders if
* the initial window size exactly matches the desktop, so STYLE_BORDERLESS must be used instead.
*/
if (window->pending_flags & SDL_WINDOW_FULLSCREEN) { if (window->pending_flags & SDL_WINDOW_FULLSCREEN) {
if (!(window->flags & SDL_WINDOW_BORDERLESS)) {
window->flags |= SDL_WINDOW_BORDERLESS;
style = GetWindowLong(hwnd, GWL_STYLE); style = GetWindowLong(hwnd, GWL_STYLE);
style &= ~STYLE_MASK; style &= ~STYLE_MASK;
style |= STYLE_BORDERLESS; style |= GetWindowStyle(window);
SetWindowLong(hwnd, GWL_STYLE, style); SetWindowLong(hwnd, GWL_STYLE, style);
window->flags &= ~SDL_WINDOW_BORDERLESS;
}
} }
style = GetWindowLong(hwnd, GWL_EXSTYLE); style = GetWindowLong(hwnd, GWL_EXSTYLE);
if (style & WS_EX_NOACTIVATE) { if (style & WS_EX_NOACTIVATE) {