cocoa: Fix recreated windows that are both borderless and resizable.

These would accidentally get a titlebar because the "borderless" style mask
is zero but the resizable attribute adds a bit. I assume this happens because
you used to need window decoration to resize a window in macOS, but this
changed in later releases.

This only caused problems when recreating a window (you had an
SDL_WINDOW_OPENGL window and tried to create a Metal SDL_Renderer on it, etc).

Fixes #4324.
This commit is contained in:
Ryan C. Gordon 2021-04-27 01:36:23 -04:00
parent 40210f8945
commit 8527c583f4

View File

@ -1405,7 +1405,10 @@ SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, NSView *nsview,
{
unsigned long style = [nswindow styleMask];
if (style == NSWindowStyleMaskBorderless) {
/* NSWindowStyleMaskBorderless is zero, and it's possible to be
Resizeable _and_ borderless, so we can't do a simple bitwise AND
of NSWindowStyleMaskBorderless here. */
if ((style & ~NSWindowStyleMaskResizable) == NSWindowStyleMaskBorderless) {
window->flags |= SDL_WINDOW_BORDERLESS;
} else {
window->flags &= ~SDL_WINDOW_BORDERLESS;