Skip to content

Commit ecccf6f

Browse files
committed
windows: Don't allow non-resizable windows to be maximized.
Fixes libsdl-org#6346. (cherry picked from commit d275851)
1 parent 52b73d4 commit ecccf6f

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/video/windows/SDL_windowswindow.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -928,11 +928,16 @@ void WIN_RaiseWindow(SDL_VideoDevice *_this, SDL_Window *window)
928928

929929
void WIN_MaximizeWindow(SDL_VideoDevice *_this, SDL_Window *window)
930930
{
931-
SDL_WindowData *data = window->driverdata;
932-
HWND hwnd = data->hwnd;
933-
data->expected_resize = SDL_TRUE;
934-
ShowWindow(hwnd, SW_MAXIMIZE);
935-
data->expected_resize = SDL_FALSE;
931+
/* Other platforms refuse to maximize a non-resizable window, and with win32,
932+
the OS resizes the window weirdly (covering the taskbar) if you don't have
933+
the STYLE_RESIZABLE flag set. So just forbid it for now. */
934+
if (window->flags & SDL_WINDOW_RESIZABLE) {
935+
SDL_WindowData *data = window->driverdata;
936+
HWND hwnd = data->hwnd;
937+
data->expected_resize = SDL_TRUE;
938+
ShowWindow(hwnd, SW_MAXIMIZE);
939+
data->expected_resize = SDL_FALSE;
940+
}
936941
}
937942

938943
void WIN_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window)

0 commit comments

Comments
 (0)