qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] ui/cocoa: Suppress NSFileHandlingPanelOKButton


From: Programmingkid
Subject: Re: [Qemu-devel] [PATCH] ui/cocoa: Suppress NSFileHandlingPanelOKButton deprecation warning
Date: Tue, 29 May 2018 13:52:49 -0400

> On May 25, 2018, at 6:26 AM, Peter Maydell <address@hidden> wrote:
> 
> 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 <address@hidden>
> ---
> Tested on 10.13; I don't hvae anything older to test on.
> 
> ui/cocoa.m | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
> 
> 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();
> -- 
> 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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]