Skip to content

Commit

Permalink
win32: Use the pending size during NCCALCSIZE
Browse files Browse the repository at this point in the history
Non-resizable windows still need to apply the pending size, as they can be resized programmatically.

Fixes programmatically resizing windows without the WS_THICKFRAME style.
  • Loading branch information
Kontrabant committed Jan 9, 2025
1 parent e8916b2 commit 037cd25
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/video/windows/SDL_windowsevents.c
Original file line number Diff line number Diff line change
Expand Up @@ -2020,10 +2020,15 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
params->rgrc[0] = info.rcWork;
}
}
} else if (!(window_flags & SDL_WINDOW_RESIZABLE)) {
} else if (!(window_flags & SDL_WINDOW_RESIZABLE) && !data->force_resizable) {
int w, h;
w = data->window->floating.w;
h = data->window->floating.h;
if (data->window->last_size_pending) {
w = data->window->pending.w;
h = data->window->pending.h;
} else {
w = data->window->floating.w;
h = data->window->floating.h;
}
params->rgrc[0].right = params->rgrc[0].left + w;
params->rgrc[0].bottom = params->rgrc[0].top + h;
}
Expand Down
2 changes: 1 addition & 1 deletion src/video/windows/SDL_windowswindow.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ static DWORD GetWindowStyle(SDL_Window *window)
DWORD style = 0;

if (SDL_WINDOW_IS_POPUP(window)) {
style |= WS_POPUP | WS_THICKFRAME;
style |= WS_POPUP;
} else if (window->flags & SDL_WINDOW_FULLSCREEN) {
style |= STYLE_FULLSCREEN;
} else {
Expand Down

0 comments on commit 037cd25

Please sign in to comment.