cocoa: Don't change the NSWindow background color.
authorRyan C. Gordon <icculus@icculus.org>
Wed, 25 Oct 2017 18:02:11 -0400
changeset 1165464ae77236054
parent 11653 4130b92b6be4
child 11655 ccf47d584003
cocoa: Don't change the NSWindow background color.

Changing the background color causes the titlebar to blend against it on
modern macOS releases, making all SDL windows look wrong by default. This was
set to make the window not flash white before a GL context is ready, but we
can accomplish this in our window's view's drawRect implementation, too.
src/video/cocoa/SDL_cocoawindow.m
     1.1 --- a/src/video/cocoa/SDL_cocoawindow.m	Tue Oct 24 00:17:07 2017 -0700
     1.2 +++ b/src/video/cocoa/SDL_cocoawindow.m	Wed Oct 25 18:02:11 2017 -0400
     1.3 @@ -1152,6 +1152,11 @@
     1.4  
     1.5  - (void)drawRect:(NSRect)dirtyRect
     1.6  {
     1.7 +    /* Force the graphics context to clear to black so we don't get a flash of
     1.8 +       white until the app is ready to draw. In practice on modern macOS, this
     1.9 +       only gets called for window creation and other extraordinary events. */
    1.10 +    [[NSColor blackColor] setFill];
    1.11 +    NSRectFill(dirtyRect);
    1.12      SDL_SendWindowEvent(_sdlWindow, SDL_WINDOWEVENT_EXPOSED, 0, 0);
    1.13  }
    1.14  
    1.15 @@ -1316,7 +1321,6 @@
    1.16      @catch (NSException *e) {
    1.17          return SDL_SetError("%s", [[e reason] UTF8String]);
    1.18      }
    1.19 -    [nswindow setBackgroundColor:[NSColor blackColor]];
    1.20  
    1.21      if (videodata->allow_spaces) {
    1.22          SDL_assert(floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6);