Navigation Menu

Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed bug 1141
Browse files Browse the repository at this point in the history
Rebuild the window with the new style on older versions of Mac OS X.
  • Loading branch information
slouken committed Feb 26, 2011
1 parent 4e860c0 commit 881fa5f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/video/cocoa/SDL_cocoawindow.m
Expand Up @@ -787,6 +787,24 @@ - (void)rightMouseDown:(NSEvent *)theEvent
[pool release];
}

static NSWindow *
Cocoa_RebuildWindow(SDL_WindowData * data, NSWindow * nswindow, unsigned style)
{
if (!data->created) {
/* Don't mess with other people's windows... */
return nswindow;
}

[data->listener close];
data->nswindow = [[SDLWindow alloc] initWithContentRect:[[nswindow contentView] frame] styleMask:style backing:NSBackingStoreBuffered defer:YES screen:[nswindow screen]];
[data->nswindow setContentView:[nswindow contentView]];
[data->listener listen:data];

[nswindow close];

return data->nswindow;
}

void
Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen)
{
Expand All @@ -807,6 +825,8 @@ - (void)rightMouseDown:(NSEvent *)theEvent

if ([nswindow respondsToSelector: @selector(setStyleMask:)]) {
[nswindow performSelector: @selector(setStyleMask:) withObject: (id)NSBorderlessWindowMask];
} else {
nswindow = Cocoa_RebuildWindow(data, nswindow, NSBorderlessWindowMask);
}
} else {
rect.origin.x = window->windowed.x;
Expand All @@ -817,6 +837,8 @@ - (void)rightMouseDown:(NSEvent *)theEvent

if ([nswindow respondsToSelector: @selector(setStyleMask:)]) {
[nswindow performSelector: @selector(setStyleMask:) withObject: (id)(uintptr_t)GetWindowStyle(window)];
} else {
nswindow = Cocoa_RebuildWindow(data, nswindow, GetWindowStyle(window));
}
}

Expand Down

0 comments on commit 881fa5f

Please sign in to comment.