cocoa: Fix new windows setting SDL_WINDOW_BORDERLESS flag incorrectly.

Fixes #6172.
This commit is contained in:
Ryan C. Gordon 2022-09-27 14:23:42 -04:00
parent 77c7836c26
commit 57b20e7b9e
1 changed files with 4 additions and 1 deletions

View File

@ -299,6 +299,9 @@ GetHintCtrlClickEmulateRightClick()
static NSUInteger static NSUInteger
GetWindowWindowedStyle(SDL_Window * window) GetWindowWindowedStyle(SDL_Window * window)
{ {
/* IF YOU CHANGE ANY FLAGS IN HERE, PLEASE READ
the NSWindowStyleMaskBorderless comments in SetupWindowData()! */
/* always allow miniaturization, otherwise you can't programatically /* always allow miniaturization, otherwise you can't programatically
minimize the window, whether there's a title bar or not */ minimize the window, whether there's a title bar or not */
NSUInteger style = NSWindowStyleMaskMiniaturizable; NSUInteger style = NSWindowStyleMaskMiniaturizable;
@ -1641,7 +1644,7 @@ SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, NSView *nsview,
/* NSWindowStyleMaskBorderless is zero, and it's possible to be /* NSWindowStyleMaskBorderless is zero, and it's possible to be
Resizeable _and_ borderless, so we can't do a simple bitwise AND Resizeable _and_ borderless, so we can't do a simple bitwise AND
of NSWindowStyleMaskBorderless here. */ of NSWindowStyleMaskBorderless here. */
if ((style & ~NSWindowStyleMaskResizable) == NSWindowStyleMaskBorderless) { if ((style & ~(NSWindowStyleMaskResizable|NSWindowStyleMaskMiniaturizable)) == NSWindowStyleMaskBorderless) {
window->flags |= SDL_WINDOW_BORDERLESS; window->flags |= SDL_WINDOW_BORDERLESS;
} else { } else {
window->flags &= ~SDL_WINDOW_BORDERLESS; window->flags &= ~SDL_WINDOW_BORDERLESS;