diff --git a/BasiliskII/src/MacOSX/BasiliskII.xcodeproj/project.pbxproj b/BasiliskII/src/MacOSX/BasiliskII.xcodeproj/project.pbxproj index f51fe002..52bebbe5 100644 --- a/BasiliskII/src/MacOSX/BasiliskII.xcodeproj/project.pbxproj +++ b/BasiliskII/src/MacOSX/BasiliskII.xcodeproj/project.pbxproj @@ -100,6 +100,8 @@ 7539E2A81F23CB9B006B2DF2 /* cpustbl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7539E2A31F23CB9B006B2DF2 /* cpustbl.cpp */; }; 7539E2A91F23CB9B006B2DF2 /* defs68k.c in Sources */ = {isa = PBXBuildFile; fileRef = 7539E2A41F23CB9B006B2DF2 /* defs68k.c */; }; 7539E2AB1F23CDB7006B2DF2 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 7539E2AA1F23CDB7006B2DF2 /* Info.plist */; }; + 756C1B341F252FC100620917 /* utils_macosx.mm in Sources */ = {isa = PBXBuildFile; fileRef = 756C1B331F252FC100620917 /* utils_macosx.mm */; }; + 756C1B391F25306A00620917 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 756C1B381F25306A00620917 /* AppKit.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -316,6 +318,9 @@ 7539E2A31F23CB9B006B2DF2 /* cpustbl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cpustbl.cpp; sourceTree = ""; }; 7539E2A41F23CB9B006B2DF2 /* defs68k.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = defs68k.c; sourceTree = ""; }; 7539E2AA1F23CDB7006B2DF2 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 756C1B321F252FC100620917 /* utils_macosx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utils_macosx.h; sourceTree = ""; }; + 756C1B331F252FC100620917 /* utils_macosx.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = utils_macosx.mm; sourceTree = ""; }; + 756C1B381F25306A00620917 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -323,6 +328,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 756C1B391F25306A00620917 /* AppKit.framework in Frameworks */, 752F27141F251B5C001032B4 /* SDL2.framework in Frameworks */, 752F26FB1F240E69001032B4 /* IOKit.framework in Frameworks */, 752F26F91F240E51001032B4 /* Foundation.framework in Frameworks */, @@ -335,6 +341,7 @@ 752F26F71F240E51001032B4 /* Frameworks */ = { isa = PBXGroup; children = ( + 756C1B381F25306A00620917 /* AppKit.framework */, 752F26FA1F240E69001032B4 /* IOKit.framework */, 752F26F81F240E51001032B4 /* Foundation.framework */, ); @@ -456,6 +463,8 @@ 7539E0141F23B25A006B2DF2 /* HowTo.html */, 7539E29C1F23C83F006B2DF2 /* sys_darwin.cpp */, 7539E02B1F23B25A006B2DF2 /* ToDo.html */, + 756C1B321F252FC100620917 /* utils_macosx.h */, + 756C1B331F252FC100620917 /* utils_macosx.mm */, 7539E02E1F23B25A006B2DF2 /* Versions.html */, ); name = MacOSX; @@ -831,6 +840,7 @@ 7539E1711F23B25A006B2DF2 /* rom_patches.cpp in Sources */, 7539E1281F23B25A006B2DF2 /* sigsegv.cpp in Sources */, 7539E1A21F23B25A006B2DF2 /* readcpu.cpp in Sources */, + 756C1B341F252FC100620917 /* utils_macosx.mm in Sources */, 7539E2701F23B32A006B2DF2 /* tinyxml2.cpp in Sources */, 7539E28F1F23C56F006B2DF2 /* ether_dummy.cpp in Sources */, 7539E1721F23B25A006B2DF2 /* rsrc_patches.cpp in Sources */, diff --git a/BasiliskII/src/MacOSX/utils_macosx.mm b/BasiliskII/src/MacOSX/utils_macosx.mm index b653638d..4dd359b2 100644 --- a/BasiliskII/src/MacOSX/utils_macosx.mm +++ b/BasiliskII/src/MacOSX/utils_macosx.mm @@ -28,3 +28,15 @@ void NSAutoReleasePool_wrap(void (*fn)(void)) fn(); [pool release]; } + +void disable_SDL2_macosx_menu_bar_keyboard_shortcuts() { + for (NSMenuItem * menu_item in [NSApp mainMenu].itemArray) { + if (menu_item.hasSubmenu) { + for (NSMenuItem * sub_item in menu_item.submenu.itemArray) { + sub_item.keyEquivalent = @""; + sub_item.keyEquivalentModifierMask = 0; + } + } + } +} + diff --git a/BasiliskII/src/Unix/main_unix.cpp b/BasiliskII/src/Unix/main_unix.cpp index f8dc7431..c80f95f4 100644 --- a/BasiliskII/src/Unix/main_unix.cpp +++ b/BasiliskII/src/Unix/main_unix.cpp @@ -522,6 +522,18 @@ int main(int argc, char **argv) QuitEmulator(); } atexit(SDL_Quit); + +#if __MACOSX__ + // On Mac OS X hosts, SDL2 will create its own menu bar. This is mostly OK, + // except that it will also install keyboard shortcuts, such as Command + Q, + // which can interfere with keyboard shortcuts in the guest OS. + // + // HACK: disable these shortcuts, while leaving all other pieces of SDL2's + // menu bar in-place. + extern void disable_SDL2_macosx_menu_bar_keyboard_shortcuts(); + disable_SDL2_macosx_menu_bar_keyboard_shortcuts(); +#endif + #endif // Init system routines