windows: Don't allow non-resizable windows to be maximized.

Fixes #6346.
This commit is contained in:
Ryan C. Gordon 2023-05-29 14:46:58 -04:00
parent a9ded76dff
commit d275851dfb
No known key found for this signature in database
GPG Key ID: 3C62BA43B5CCC412
1 changed files with 10 additions and 5 deletions

View File

@ -847,11 +847,16 @@ void WIN_RaiseWindow(_THIS, SDL_Window *window)
void WIN_MaximizeWindow(_THIS, SDL_Window *window)
{
SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
HWND hwnd = data->hwnd;
data->expected_resize = SDL_TRUE;
ShowWindow(hwnd, SW_MAXIMIZE);
data->expected_resize = SDL_FALSE;
/* Other platforms refuse to maximize a non-resizable window, and with win32,
the OS resizes the window weirdly (covering the taskbar) if you don't have
the STYLE_RESIZABLE flag set. So just forbid it for now. */
if (window->flags & SDL_WINDOW_RESIZABLE) {
SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
HWND hwnd = data->hwnd;
data->expected_resize = SDL_TRUE;
ShowWindow(hwnd, SW_MAXIMIZE);
data->expected_resize = SDL_FALSE;
}
}
void WIN_MinimizeWindow(_THIS, SDL_Window *window)