src/video/cocoa/SDL_cocoawindow.m
changeset 5400 1df8b8a20191
parent 5399 1e2a82a66df8
child 5401 ccaccc76a196
     1.1 --- a/src/video/cocoa/SDL_cocoawindow.m	Sat Feb 26 10:15:13 2011 -0800
     1.2 +++ b/src/video/cocoa/SDL_cocoawindow.m	Sat Feb 26 11:29:23 2011 -0800
     1.3 @@ -787,6 +787,24 @@
     1.4      [pool release];
     1.5  }
     1.6  
     1.7 +static NSWindow *
     1.8 +Cocoa_RebuildWindow(SDL_WindowData * data, NSWindow * nswindow, unsigned style)
     1.9 +{
    1.10 +    if (!data->created) {
    1.11 +        /* Don't mess with other people's windows... */
    1.12 +        return nswindow;
    1.13 +    }
    1.14 +
    1.15 +    [data->listener close];
    1.16 +    data->nswindow = [[SDLWindow alloc] initWithContentRect:[[nswindow contentView] frame] styleMask:style backing:NSBackingStoreBuffered defer:YES screen:[nswindow screen]];
    1.17 +    [data->nswindow setContentView:[nswindow contentView]];
    1.18 +    [data->listener listen:data];
    1.19 +
    1.20 +    [nswindow close];
    1.21 +
    1.22 +    return data->nswindow;
    1.23 +}
    1.24 +
    1.25  void
    1.26  Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen)
    1.27  {
    1.28 @@ -807,6 +825,8 @@
    1.29  
    1.30          if ([nswindow respondsToSelector: @selector(setStyleMask:)]) {
    1.31              [nswindow performSelector: @selector(setStyleMask:) withObject: (id)NSBorderlessWindowMask];
    1.32 +        } else {
    1.33 +            nswindow = Cocoa_RebuildWindow(data, nswindow, NSBorderlessWindowMask);
    1.34          }
    1.35      } else {
    1.36          rect.origin.x = window->windowed.x;
    1.37 @@ -817,6 +837,8 @@
    1.38  
    1.39          if ([nswindow respondsToSelector: @selector(setStyleMask:)]) {
    1.40              [nswindow performSelector: @selector(setStyleMask:) withObject: (id)(uintptr_t)GetWindowStyle(window)];
    1.41 +        } else {
    1.42 +            nswindow = Cocoa_RebuildWindow(data, nswindow, GetWindowStyle(window));
    1.43          }
    1.44      }
    1.45