diff --git a/src/video/cocoa/SDL_cocoaevents.m b/src/video/cocoa/SDL_cocoaevents.m index 76d235e3b..212e617d0 100644 --- a/src/video/cocoa/SDL_cocoaevents.m +++ b/src/video/cocoa/SDL_cocoaevents.m @@ -275,7 +275,6 @@ CreateApplicationMenus(void) NSMenu *appleMenu; NSMenu *serviceMenu; NSMenu *windowMenu; - NSMenu *viewMenu; NSMenuItem *menuItem; NSMenu *mainMenu; @@ -342,9 +341,22 @@ CreateApplicationMenus(void) windowMenu = [[NSMenu alloc] initWithTitle:@"Window"]; /* Add menu items */ + [windowMenu addItemWithTitle:@"Close" action:@selector(performClose:) keyEquivalent:@"w"]; + [windowMenu addItemWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"]; [windowMenu addItemWithTitle:@"Zoom" action:@selector(performZoom:) keyEquivalent:@""]; + + /* Add the fullscreen toggle menu option, if supported */ + if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) { + /* Cocoa should update the title to Enter or Exit Full Screen automatically. + * But if not, then just fallback to Toggle Full Screen. + */ + menuItem = [[NSMenuItem alloc] initWithTitle:@"Toggle Full Screen" action:@selector(toggleFullScreen:) keyEquivalent:@"f"]; + [menuItem setKeyEquivalentModifierMask:NSEventModifierFlagControl | NSEventModifierFlagCommand]; + [windowMenu addItem:menuItem]; + [menuItem release]; + } /* Put menu into the menubar */ menuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""]; @@ -355,25 +367,6 @@ CreateApplicationMenus(void) /* Tell the application object that this is now the window menu */ [NSApp setWindowsMenu:windowMenu]; [windowMenu release]; - - - /* Add the fullscreen view toggle menu option, if supported */ - if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) { - /* Create the view menu */ - viewMenu = [[NSMenu alloc] initWithTitle:@"View"]; - - /* Add menu items */ - menuItem = [viewMenu addItemWithTitle:@"Toggle Full Screen" action:@selector(toggleFullScreen:) keyEquivalent:@"f"]; - [menuItem setKeyEquivalentModifierMask:NSEventModifierFlagControl | NSEventModifierFlagCommand]; - - /* Put menu into the menubar */ - menuItem = [[NSMenuItem alloc] initWithTitle:@"View" action:nil keyEquivalent:@""]; - [menuItem setSubmenu:viewMenu]; - [[NSApp mainMenu] addItem:menuItem]; - [menuItem release]; - - [viewMenu release]; - } } void diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index a3b056d34..c5b441644 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -1356,6 +1356,11 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window) return SDL_SetError("%s", [[e reason] UTF8String]); } + /* By default, don't allow users to make our window tabbed in 10.12 or later */ + if ([nswindow respondsToSelector:@selector(setTabbingMode:)]) { + [nswindow setTabbingMode:NSWindowTabbingModeDisallowed]; + } + if (videodata->allow_spaces) { SDL_assert(floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6); SDL_assert([nswindow respondsToSelector:@selector(toggleFullScreen:)]);