one last SDL fix: restore menu bar if we destroy a fullscreen window without transitioning it back to a non-fullscreen window first
authorSam Lantinga <slouken@libsdl.org>
Mon, 09 Nov 2015 08:55:07 -0800
changeset 9907 2048ad756970
parent 9906 49c432b1897b
child 9908 b63158b01a7d
one last SDL fix: restore menu bar if we destroy a fullscreen window without transitioning it back to a non-fullscreen window first
src/video/cocoa/SDL_cocoawindow.m
--- a/src/video/cocoa/SDL_cocoawindow.m	Mon Nov 09 08:55:01 2015 -0800
+++ b/src/video/cocoa/SDL_cocoawindow.m	Mon Nov 09 08:55:07 2015 -0800
@@ -641,7 +641,11 @@
 - (void)windowDidFailToEnterFullScreen:(NSNotification *)aNotification
 {
     SDL_Window *window = _data->window;
-    
+
+    if (window->is_destroying) {
+        return;
+    }
+
     SetWindowStyle(window, GetWindowStyle(window));
 
     isFullscreenSpace = NO;
@@ -688,6 +692,10 @@
 {
     SDL_Window *window = _data->window;
     
+    if (window->is_destroying) {
+        return;
+    }
+
     SetWindowStyle(window, (NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask));
     
     isFullscreenSpace = YES;
@@ -1648,6 +1656,9 @@
     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) {