From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37850) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrZZN-00055A-NV for qemu-devel@nongnu.org; Sun, 10 May 2015 18:19:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YrZZM-0007iv-MH for qemu-devel@nongnu.org; Sun, 10 May 2015 18:19:33 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:34107) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrZZM-0007dd-FT for qemu-devel@nongnu.org; Sun, 10 May 2015 18:19:32 -0400 From: Peter Maydell Date: Sun, 10 May 2015 23:19:21 +0100 Message-Id: <1431296361-16981-7-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1431296361-16981-1-git-send-email-peter.maydell@linaro.org> References: <1431296361-16981-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH 6/6] ui/cocoa: Avoid deprecated NSOKButton/NSCancelButton constants List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Programmingkid , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Alexander Graf , patches@linaro.org 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 --- 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); -- 2.2.1