From 26948f01a3979840886428f21d7948f1a21a4a0a Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Mon, 15 Aug 2022 20:09:09 -0400
Subject: [PATCH] cocoa: Make SDL_MinimizeWindow() work with borderless
windows.
Fixes #6046.
---
src/video/cocoa/SDL_cocoawindow.m | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m
index ad56e7b94aa..ad7d9e2af0d 100644
--- a/src/video/cocoa/SDL_cocoawindow.m
+++ b/src/video/cocoa/SDL_cocoawindow.m
@@ -299,12 +299,14 @@ static void ConvertNSRect(NSScreen *screen, BOOL fullscreen, NSRect *r)
static NSUInteger
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) {
- style = NSWindowStyleMaskBorderless;
+ style |= NSWindowStyleMaskBorderless;
} else {
- style = (NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskMiniaturizable);
+ style |= (NSWindowStyleMaskTitled|NSWindowStyleMaskClosable);
}
if (window->flags & SDL_WINDOW_RESIZABLE) {
style |= NSWindowStyleMaskResizable;