aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/sdl/macosx
diff options
context:
space:
mode:
Diffstat (limited to 'backends/platform/sdl/macosx')
-rw-r--r--backends/platform/sdl/macosx/appmenu_osx.mm13
1 files changed, 12 insertions, 1 deletions
diff --git a/backends/platform/sdl/macosx/appmenu_osx.mm b/backends/platform/sdl/macosx/appmenu_osx.mm
index feea40bc06..452c386607 100644
--- a/backends/platform/sdl/macosx/appmenu_osx.mm
+++ b/backends/platform/sdl/macosx/appmenu_osx.mm
@@ -28,6 +28,17 @@
#include <Cocoa/Cocoa.h>
+// macOS 10.12 deprecated many constants, #define the new names we need for
+// older SDKs. (This approach was taken from qemu.)
+#ifndef MAC_OS_X_VERSION_10_12
+#define MAC_OS_X_VERSION_10_12 101200
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12
+#define NSEventModifierFlagCommand NSCommandKeyMask
+#define NSEventModifierFlagOption NSAlternateKeyMask
+#endif
+
// Apple added setAppleMenu in 10.5 and removed it in 10.6.
// But as the method still exists we declare it ourselves here.
// Yes, this works :)
@@ -92,7 +103,7 @@ void replaceApplicationMenuItems() {
// Add "Hide Others" menu item
nsString = constructNSStringFromCString(_("Hide Others"), stringEncoding);
menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:nsString action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
- [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];
+ [menuItem setKeyEquivalentModifierMask:(NSEventModifierFlagOption|NSEventModifierFlagCommand)];
// Add "Show All" menu item
nsString = constructNSStringFromCString(_("Show All"), stringEncoding);