aboutsummaryrefslogtreecommitdiff
path: root/ui/cocoa.m
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-05-29 19:15:23 +0100
committerPeter Maydell <peter.maydell@linaro.org>2018-05-29 19:39:02 +0100
commitb5725385d17c876a12aa176a4a436d32d34ed06d (patch)
tree46d85e394a380e79dc4af2d9e80cc9aef5ea2bd5 /ui/cocoa.m
parente609fa71e89c81fbe2670411be62da95dfb093e0 (diff)
downloadqemu-b5725385d17c876a12aa176a4a436d32d34ed06d.zip
qemu-b5725385d17c876a12aa176a4a436d32d34ed06d.tar.gz
qemu-b5725385d17c876a12aa176a4a436d32d34ed06d.tar.bz2
ui/cocoa: Suppress NSFileHandlingPanelOKButton deprecation warning
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> Reviewed-by: John Arbuckle <programmingkidx@gmail.com> Message-id: 20180529181523.19185-1-peter.maydell@linaro.org
Diffstat (limited to 'ui/cocoa.m')
-rw-r--r--ui/cocoa.m12
1 files changed, 11 insertions, 1 deletions
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 110b393..2991ed4 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -44,6 +44,9 @@
#ifndef MAC_OS_X_VERSION_10_6
#define MAC_OS_X_VERSION_10_6 1060
#endif
+#ifndef MAC_OS_X_VERSION_10_9
+#define MAC_OS_X_VERSION_10_9 1090
+#endif
#ifndef MAC_OS_X_VERSION_10_10
#define MAC_OS_X_VERSION_10_10 101000
#endif
@@ -79,6 +82,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 +1228,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();