[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/10] ui/cocoa: Avoid deprecated NSOKButton/NSCancel
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PULL 09/10] ui/cocoa: Avoid deprecated NSOKButton/NSCancelButton constants |
Date: |
Tue, 19 May 2015 09:23:54 +0100 |
In OSX 10.10, the NSOKButton and NSCancelButton constants are deprecated
and provoke compiler warnings. Avoid them by using the
NSFileHandlingPanelCancelButton and NSFileHandlingPanelOKButton constants
instead. These are the documented correct constants for the 10.6-and-up
beginSheetModalForWindow API we use. We also use the same method for
the pre-10.6 compatibility code path, but conveniently the constant
values are the same and the constant names have been present since 10.0.
Preferring the constant names that match the non-legacy API makes more
sense anyway.
Signed-off-by: Peter Maydell <address@hidden>
Message-id: address@hidden
---
ui/cocoa.m | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/ui/cocoa.m b/ui/cocoa.m
index fade0fd..0a51fbc 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -902,9 +902,15 @@ QemuCocoaView *cocoaView;
{
COCOA_DEBUG("QemuCocoaAppController: openPanelDidEnd\n");
- if(returnCode == NSCancelButton) {
+ /* The NSFileHandlingPanelOKButton/NSFileHandlingPanelCancelButton values
for
+ * returnCode strictly only apply for the 10.6-and-up
beginSheetModalForWindow
+ * API. For the legacy pre-10.6 beginSheetForDirectory API they are
NSOKButton
+ * and NSCancelButton. However conveniently the values are the same.
+ * We use the non-legacy names because the others are deprecated in OSX
10.10.
+ */
+ if (returnCode == NSFileHandlingPanelCancelButton) {
exit(0);
- } else if(returnCode == NSOKButton) {
+ } else if (returnCode == NSFileHandlingPanelOKButton) {
char *img = (char*)[ [ [ sheet URL ] path ]
cStringUsingEncoding:NSASCIIStringEncoding];
char **argv = g_new(char *, 4);
--
1.9.1
- [Qemu-devel] [PULL 00/10] cocoa queue, Peter Maydell, 2015/05/19
- [Qemu-devel] [PULL 10/10] ui/cocoa: Add console items to the View menu, Peter Maydell, 2015/05/19
- [Qemu-devel] [PULL 09/10] ui/cocoa: Avoid deprecated NSOKButton/NSCancelButton constants,
Peter Maydell <=
- [Qemu-devel] [PULL 05/10] ui/cocoa: Remove compatibility ifdefs for OSX 10.4, Peter Maydell, 2015/05/19
- [Qemu-devel] [PULL 04/10] ui/cocoa: Drop tests for CGImageCreateWithImageInRect support, Peter Maydell, 2015/05/19
- [Qemu-devel] [PULL 01/10] ui/cocoa: Fix several full screen issues on Mac OS X, Peter Maydell, 2015/05/19
- [Qemu-devel] [PULL 06/10] ui/cocoa: openPanelDidEnd returnCode should be NSInteger, not int, Peter Maydell, 2015/05/19
- [Qemu-devel] [PULL 07/10] ui/cocoa: Declare that QemuCocoaAppController implements NSApplicationDelegate, Peter Maydell, 2015/05/19
- [Qemu-devel] [PULL 08/10] ui/cocoa: Don't use NSWindow useOptimizedDrawing on OSX 10.10 and up, Peter Maydell, 2015/05/19
- [Qemu-devel] [PULL 02/10] ui/cocoa: Make -full-screen option work on Mac OS X, Peter Maydell, 2015/05/19
- [Qemu-devel] [PULL 03/10] Makefile.target: set icon for binary file on Mac OS X, Peter Maydell, 2015/05/19
- Re: [Qemu-devel] [PULL 00/10] cocoa queue, Peter Maydell, 2015/05/19