Pārlūkot izejas kodu

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.
Ryan C. Gordon 4 gadi atpakaļ
vecāks
revīzija
8527c583f4
1 mainītis faili ar 4 papildinājumiem un 1 dzēšanām
  1. 4 1
      src/video/cocoa/SDL_cocoawindow.m

+ 4 - 1
src/video/cocoa/SDL_cocoawindow.m

@@ -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;