* [Qemu-devel] [PATCH v2] ui/cocoa: Suppress NSFileHandlingPanelOKButton deprecation warning
@ 2018-05-29 18:15 Peter Maydell
2018-05-29 18:23 ` Programmingkid
0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2018-05-29 18:15 UTC (permalink / raw)
To: qemu-devel; +Cc: patches, John Arbuckle
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>
---
v1->v2: define MAC_OS_X_VERSION_10_9 if the system headers don't;
fixes compilation on versions before 10.9.
---
ui/cocoa.m | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 110b393e4e..2991ed4f19 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();
--
2.17.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v2] ui/cocoa: Suppress NSFileHandlingPanelOKButton deprecation warning
2018-05-29 18:15 [Qemu-devel] [PATCH v2] ui/cocoa: Suppress NSFileHandlingPanelOKButton deprecation warning Peter Maydell
@ 2018-05-29 18:23 ` Programmingkid
2018-05-31 8:40 ` Peter Maydell
0 siblings, 1 reply; 3+ messages in thread
From: Programmingkid @ 2018-05-29 18:23 UTC (permalink / raw)
To: Peter Maydell; +Cc: qemu-devel, patches
> On May 29, 2018, at 2:15 PM, Peter Maydell <peter.maydell@linaro.org> 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 <peter.maydell@linaro.org>
> ---
> v1->v2: define MAC_OS_X_VERSION_10_9 if the system headers don't;
> fixes compilation on versions before 10.9.
> ---
> ui/cocoa.m | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/ui/cocoa.m b/ui/cocoa.m
> index 110b393e4e..2991ed4f19 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();
> --
> 2.17.0
>
It works :)
Reviewed-by: John Arbuckle <programmingkidx@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v2] ui/cocoa: Suppress NSFileHandlingPanelOKButton deprecation warning
2018-05-29 18:23 ` Programmingkid
@ 2018-05-31 8:40 ` Peter Maydell
0 siblings, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2018-05-31 8:40 UTC (permalink / raw)
To: Programmingkid; +Cc: QEMU Developers, patches
On 29 May 2018 at 19:23, Programmingkid <programmingkidx@gmail.com> wrote:
>
>> On May 29, 2018, at 2:15 PM, Peter Maydell <peter.maydell@linaro.org> 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 <peter.maydell@linaro.org>
>> ---
>> v1->v2: define MAC_OS_X_VERSION_10_9 if the system headers don't;
>> fixes compilation on versions before 10.9.
>> ---
>> ui/cocoa.m | 12 +++++++++++-
>> 1 file changed, 11 insertions(+), 1 deletion(-)
>>
>> diff --git a/ui/cocoa.m b/ui/cocoa.m
>> index 110b393e4e..2991ed4f19 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();
>> --
>> 2.17.0
>>
>
> It works :)
>
> Reviewed-by: John Arbuckle <programmingkidx@gmail.com>
Thanks; applied this version to master.
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-05-31 8:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-29 18:15 [Qemu-devel] [PATCH v2] ui/cocoa: Suppress NSFileHandlingPanelOKButton deprecation warning Peter Maydell
2018-05-29 18:23 ` Programmingkid
2018-05-31 8:40 ` Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).