aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-05-24 18:37:02 +0100
committerPeter Maydell <peter.maydell@linaro.org>2018-05-24 18:37:02 +0100
commitcd47880c4067a26f32ce7306b9a66bee0f587f3d (patch)
treeaa765a3a14921d1a402b3eac8d18350f84df8653
parent5ff2a4b97f6dd57e855b713aca9f8ebdb1965a8b (diff)
ui/cocoa: Suppress NSFileHandlingPanelOKButton deprecation warningosx-deprecated
OSX 10.13 deprecates the NSFileHandlingPanelOKButton constant, and would rather you use NSModalResponseOK, which was introduced in OS 10.9. Use the recommended new constant name, with a backward compatibility define if we're building on an older OSX. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--ui/cocoa.m9
1 files changed, 8 insertions, 1 deletions
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 110b393e4e..f5ecd66fd3 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -79,6 +79,13 @@
#define NSWindowStyleMaskMiniaturizable NSMiniaturizableWindowMask
#define NSWindowStyleMaskTitled NSTitledWindowMask
#endif
+/* 10.13 deprecates NSFileHandlingPanelOKButton in favour of
+ * NSModalResponseOK, which was introduced in 10.9. Define
+ * it for older versions.
+ */
+#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_9
+#define NSModalResponseOK NSFileHandlingPanelOKButton
+#endif
//#define DEBUG
@@ -1218,7 +1225,7 @@ QemuCocoaView *cocoaView;
[openPanel setCanChooseFiles: YES];
[openPanel setAllowsMultipleSelection: NO];
[openPanel setAllowedFileTypes: supportedImageFileTypes];
- if([openPanel runModal] == NSFileHandlingPanelOKButton) {
+ if([openPanel runModal] == NSModalResponseOK) {
NSString * file = [[[openPanel URLs] objectAtIndex: 0] path];
if(file == nil) {
NSBeep();