From 56810b5598458ce04dee4647a4044e9ca07a8577 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Sun, 10 Sep 2017 17:26:25 -0500 Subject: MACOS: Fix deprecation warnings in macOS 10.12 --- backends/platform/sdl/macosx/appmenu_osx.mm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'backends/platform/sdl/macosx') 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 +// 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); -- cgit v1.2.3