one last SDL fix: restore menu bar if we destroy a fullscreen window without transitioning it back to a non-fullscreen window first
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m
index f6417db..fad9971 100644
--- a/src/video/cocoa/SDL_cocoawindow.m
+++ b/src/video/cocoa/SDL_cocoawindow.m
@@ -641,7 +641,11 @@ SetWindowStyle(SDL_Window * window, unsigned int style)
- (void)windowDidFailToEnterFullScreen:(NSNotification *)aNotification
{
SDL_Window *window = _data->window;
-
+
+ if (window->is_destroying) {
+ return;
+ }
+
SetWindowStyle(window, GetWindowStyle(window));
isFullscreenSpace = NO;
@@ -688,6 +692,10 @@ SetWindowStyle(SDL_Window * window, unsigned int style)
{
SDL_Window *window = _data->window;
+ if (window->is_destroying) {
+ return;
+ }
+
SetWindowStyle(window, (NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask));
isFullscreenSpace = YES;
@@ -1648,6 +1656,9 @@ Cocoa_DestroyWindow(_THIS, SDL_Window * window)
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
if (data) {
+ if ([data->listener isInFullscreenSpace]) {
+ [NSMenu setMenuBarVisible:YES];
+ }
[data->listener close];
[data->listener release];
if (data->created) {