aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/sdl
diff options
context:
space:
mode:
authorColin Snover2017-09-10 17:26:25 -0500
committerColin Snover2017-09-10 22:17:16 -0500
commit56810b5598458ce04dee4647a4044e9ca07a8577 (patch)
treef92729150e63a238a258f0b6a681efff4d7458bd /backends/platform/sdl
parentb91a48f279d0df368019266f138dfca7895b75bf (diff)
downloadscummvm-rg350-56810b5598458ce04dee4647a4044e9ca07a8577.tar.gz
scummvm-rg350-56810b5598458ce04dee4647a4044e9ca07a8577.tar.bz2
scummvm-rg350-56810b5598458ce04dee4647a4044e9ca07a8577.zip
MACOS: Fix deprecation warnings in macOS 10.12
Diffstat (limited to 'backends/platform/sdl')
-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);