From 45ce4ba877b965291d9d9209b6dda6fbfbf83bb7 Mon Sep 17 00:00:00 2001 From: Akemi Date: Sat, 20 Jan 2018 15:40:18 +0100 Subject: [PATCH] osx: fix macOS 10.13 deprecation warning NSFileHandlingPanelOKButton is deprecated with macOS 10.13, but the replacement NSModalResponseOK is not available on 10.8 and earlier. added a declaration for 10.8 and earlier since i only officially dropped support for 10.7 and earlier. this is untested. --- osdep/macosx_compat.h | 6 ++++++ osdep/macosx_menubar.m | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/osdep/macosx_compat.h b/osdep/macosx_compat.h index 0c2e87d14c..747aa159af 100644 --- a/osdep/macosx_compat.h +++ b/osdep/macosx_compat.h @@ -52,6 +52,12 @@ static const NSEventModifierFlags NSEventModifierFlagShift = NSShiftKeyMask; static const NSEventModifierFlags NSEventModifierFlagControl = NSControlKeyMask; static const NSEventModifierFlags NSEventModifierFlagCommand = NSCommandKeyMask; static const NSEventModifierFlags NSEventModifierFlagOption = NSAlternateKeyMask; + +#if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_9) +typedef NSUInteger NSModalResponse; +static const NSModalResponse NSModalResponseOK = NSFileHandlingPanelOKButton +#endif + #endif #endif /* MPV_MACOSX_COMPAT */ diff --git a/osdep/macosx_menubar.m b/osdep/macosx_menubar.m index 3a5c5a76c2..8081ed202e 100644 --- a/osdep/macosx_menubar.m +++ b/osdep/macosx_menubar.m @@ -660,7 +660,7 @@ [panel setCanChooseDirectories:YES]; [panel setAllowsMultipleSelection:YES]; - if ([panel runModal] == NSFileHandlingPanelOKButton){ + if ([panel runModal] == NSModalResponseOK){ NSMutableArray *fileArray = [[NSMutableArray alloc] init]; for (id url in [panel URLs]) [fileArray addObject:[url path]];