From patchwork Sun Dec 13 02:55:35 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 41014 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 19D26B6F1B for ; Sun, 13 Dec 2009 14:06:54 +1100 (EST) Received: from localhost ([127.0.0.1]:37215 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NJenL-0002da-4n for incoming@patchwork.ozlabs.org; Sat, 12 Dec 2009 22:06:51 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NJed6-0007Jz-A6 for qemu-devel@nongnu.org; Sat, 12 Dec 2009 21:56:16 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NJecx-0007G9-Fk for qemu-devel@nongnu.org; Sat, 12 Dec 2009 21:56:12 -0500 Received: from [199.232.76.173] (port=45237 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NJecx-0007Fv-6R for qemu-devel@nongnu.org; Sat, 12 Dec 2009 21:56:07 -0500 Received: from fmmailgate02.web.de ([217.72.192.227]:32777) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NJecw-0000fG-Df for qemu-devel@nongnu.org; Sat, 12 Dec 2009 21:56:06 -0500 Received: from smtp07.web.de (fmsmtp07.dlan.cinetic.de [172.20.5.215]) by fmmailgate02.web.de (Postfix) with ESMTP id A8A58147CCF13; Sun, 13 Dec 2009 03:56:03 +0100 (CET) Received: from [84.148.98.194] (helo=localhost.localdomain) by smtp07.web.de with asmtp (WEB.DE 4.110 #314) id 1NJect-0000uu-00; Sun, 13 Dec 2009 03:56:03 +0100 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Sun, 13 Dec 2009 03:55:35 +0100 Message-Id: <1260672941-9365-6-git-send-email-andreas.faerber@web.de> X-Mailer: git-send-email 1.6.5.3 In-Reply-To: <1260672941-9365-5-git-send-email-andreas.faerber@web.de> References: <1260672941-9365-1-git-send-email-andreas.faerber@web.de> <1260672941-9365-2-git-send-email-andreas.faerber@web.de> <1260672941-9365-3-git-send-email-andreas.faerber@web.de> <1260672941-9365-4-git-send-email-andreas.faerber@web.de> <1260672941-9365-5-git-send-email-andreas.faerber@web.de> MIME-Version: 1.0 X-Sender: Andreas.Faerber@web.de X-Provags-ID: V01U2FsdGVkX19sie/R96xbAKJ45bK7Ng8BTmktZYLwnn3Hynzy qEoDb5vfz26xU7nDbR/qegiBfw2KmPpRUGZeGiILpuENb1UVVB mOKIIEGADwyC2e9c5skw== X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 Cc: John Arbuckle , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Ryan Schmidt , Mike Kronenberg Subject: [Qemu-devel] [PATCH 05/11] Cocoa: Fix compilation on Mac OS X v10.4 and earlier X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org NSView's enterFullScreenMode:withOptions: and exitFullScreenModeWithOptions: are available on v10.5 and later only. Undefined methods raise warnings and undefined constants result in errors. Reported by Ryan Schmidt. While at it, avoid a warning on v10.3.9, where MAC_OS_X_VERSION_10_4 is not defined. Spotted by John Arbuckle. Fix associated comments. Signed-off-by: Andreas Färber Cc: John Arbuckle Cc: Ryan Schmidt Cc: Mike Kronenberg --- cocoa.m | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-) diff --git a/cocoa.m b/cocoa.m index 0a95c77..6f8b674 100644 --- a/cocoa.m +++ b/cocoa.m @@ -28,6 +28,9 @@ #include "console.h" #include "sysemu.h" +#ifndef MAC_OS_X_VERSION_10_4 +#define MAC_OS_X_VERSION_10_4 1040 +#endif #ifndef MAC_OS_X_VERSION_10_5 #define MAC_OS_X_VERSION_10_5 1050 #endif @@ -331,7 +334,7 @@ static int cocoa_keycode_to_qemu(int keycode) 0, //interpolate kCGRenderingIntentDefault //intent ); -// test if host support "CGImageCreateWithImageInRect" at compiletime +// test if host supports "CGImageCreateWithImageInRect" at compile time #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) if (CGImageCreateWithImageInRect == NULL) { // test if "CGImageCreateWithImageInRect" is supported on host at runtime #endif @@ -428,8 +431,8 @@ static int cocoa_keycode_to_qemu(int keycode) isFullscreen = FALSE; [self ungrabMouse]; [self setContentDimensions]; -// test if host support "enterFullScreenMode:withOptions" at compiletime -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) +// test if host supports "exitFullScreenModeWithOptions" at compile time +#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) if ([NSView respondsToSelector:@selector(exitFullScreenModeWithOptions:)]) { // test if "exitFullScreenModeWithOptions" is supported on host at runtime [self exitFullScreenModeWithOptions:nil]; } else { @@ -438,15 +441,15 @@ static int cocoa_keycode_to_qemu(int keycode) [normalWindow setContentView: self]; [normalWindow makeKeyAndOrderFront: self]; [NSMenu setMenuBarVisible:YES]; -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) +#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) } #endif } else { // switch from desktop to fullscreen isFullscreen = TRUE; [self grabMouse]; [self setContentDimensions]; -// test if host support "enterFullScreenMode:withOptions" at compiletime -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) +// test if host supports "enterFullScreenMode:withOptions" at compile time +#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) if ([NSView respondsToSelector:@selector(enterFullScreenMode:withOptions:)]) { // test if "enterFullScreenMode:withOptions" is supported on host at runtime [self enterFullScreenMode:[NSScreen mainScreen] withOptions:[NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:NO], NSFullScreenModeAllScreens, @@ -462,7 +465,7 @@ static int cocoa_keycode_to_qemu(int keycode) [fullScreenWindow setHasShadow:NO]; [fullScreenWindow setContentView:self]; [fullScreenWindow makeKeyAndOrderFront:self]; -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) +#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) } #endif }