Skip to content

Commit

Permalink
windows: Don't allow non-resizable windows to be maximized.
Browse files Browse the repository at this point in the history
Fixes libsdl-org#6346.

(cherry picked from commit d275851)
  • Loading branch information
icculus committed May 29, 2023
1 parent 52b73d4 commit ecccf6f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/video/windows/SDL_windowswindow.c
Original file line number Diff line number Diff line change
Expand Up @@ -928,11 +928,16 @@ void WIN_RaiseWindow(SDL_VideoDevice *_this, SDL_Window *window)

void WIN_MaximizeWindow(SDL_VideoDevice *_this, SDL_Window *window)
{
SDL_WindowData *data = 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 = window->driverdata;
HWND hwnd = data->hwnd;
data->expected_resize = SDL_TRUE;
ShowWindow(hwnd, SW_MAXIMIZE);
data->expected_resize = SDL_FALSE;
}
}

void WIN_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window)
Expand Down

0 comments on commit ecccf6f

Please sign in to comment.