cocoa: Make SDL_MinimizeWindow() work with borderless windows.

Fixes #6046.
This commit is contained in:
Ryan C. Gordon 2022-08-15 20:09:09 -04:00
parent 650612fdcb
commit 26948f01a3

View file

@ -299,12 +299,14 @@ GetHintCtrlClickEmulateRightClick()
static NSUInteger static NSUInteger
GetWindowWindowedStyle(SDL_Window * window) GetWindowWindowedStyle(SDL_Window * window)
{ {
NSUInteger style = 0; /* always allow miniaturization, otherwise you can't programatically
minimize the window, whether there's a title bar or not */
NSUInteger style = NSWindowStyleMaskMiniaturizable;
if (window->flags & SDL_WINDOW_BORDERLESS) { if (window->flags & SDL_WINDOW_BORDERLESS) {
style = NSWindowStyleMaskBorderless; style |= NSWindowStyleMaskBorderless;
} else { } else {
style = (NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskMiniaturizable); style |= (NSWindowStyleMaskTitled|NSWindowStyleMaskClosable);
} }
if (window->flags & SDL_WINDOW_RESIZABLE) { if (window->flags & SDL_WINDOW_RESIZABLE) {
style |= NSWindowStyleMaskResizable; style |= NSWindowStyleMaskResizable;