ui/cocoa: Suppress NSFileHandlingPanelOKButton deprecation warning
PATCH 1/1 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.
---
Tested on 10.13; I don't hvae anything older to test on.
ui/cocoa.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
ui/cocoa.m +8 -1
@@ -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();
Signature · 1 line
2.17.0
Quoted 45 lines · Peter Maydell
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 <[email protected]>---
Tested on 10.13; I don't hvae anything older to test on.ui/cocoa.m | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)ui/cocoa.m +8
-1@@ -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();Signature · 1 line
2.17.0
Sorry but this patch does not work with Mac OS 10.6. The MAC_OS_X_VERSION_10_9 constant is not defined. I did make a patch that does work. It will be sent shortly.
Quoted 8 lines · Programmingkid
Quoted 8 lines · Peter Maydell
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.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Peter Maydell <[email protected]>---
Tested on 10.13; I don't hvae anything older to test on.Sorry but this patch does not work with Mac OS 10.6. The
MAC_OS_X_VERSION_10_9constant is not defined. I did make a patch that does work. It will be sent shortly.
Oops, yes, we need to add the
#ifndef MAC_OS_X_VERSION_10_9
#define MAC_OS_X_VERSION_10_9 1090
#endif
I hadn't noticed that we only defined the ones of those we currently use.
Thanks for testing.
-- PMM