From patchwork Tue Mar 12 12:48:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 15285 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id C919023E10 for ; Tue, 12 Mar 2013 12:48:26 +0000 (UTC) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by fiordland.canonical.com (Postfix) with ESMTP id 885BFA18099 for ; Tue, 12 Mar 2013 12:48:26 +0000 (UTC) Received: by mail-ve0-f169.google.com with SMTP id 15so3493604vea.28 for ; Tue, 12 Mar 2013 05:48:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=EkLmnGtQ8TlJ1K/fSBUswQU6gPGAz4I5XBTLshVqTRo=; b=NY3vLFK9pi9rWPyJxFKFbixM6lXUGsaDoQ3RvJRcc1ROfVdB1yRACYhkORENiRVkpt QOggJ6zaZbSjzdSIj3G3UbO2HnEkiGxgdfhxlqcwT6IjCiGQqW+SkxdEJZoG1a9mGMYY wyZgHq1f7vD70u0DPH3vdrP5txzZewYArTYejSTgwYb5uDXEAz8Ctz2Wo8RVCdWy2W7V V9UCGuAttaifSFWy1a3zSn8Z6jgTjcLzKL5mBH8pbATt/2UTSBbVpFkvLcvc2S541H+s GDb5AQmYjPmMFi0I7Ch1AwYjXQxJlzg2/m3bOt8BRytzM87TNftDCTtCSKiDnkkaZCOe /krw== X-Received: by 10.58.181.201 with SMTP id dy9mr6647861vec.34.1363092505988; Tue, 12 Mar 2013 05:48:25 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp126136veb; Tue, 12 Mar 2013 05:48:25 -0700 (PDT) X-Received: by 10.194.109.35 with SMTP id hp3mr26466983wjb.15.1363092498219; Tue, 12 Mar 2013 05:48:18 -0700 (PDT) Received: from mnementh.archaic.org.uk (1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id 3si34689731eeb.170.2013.03.12.05.48.17 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 12 Mar 2013 05:48:18 -0700 (PDT) Received-SPF: neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) client-ip=2001:8b0:1d0::1; Authentication-Results: mx.google.com; spf=neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1UFOcq-0005Cj-8W; Tue, 12 Mar 2013 12:48:16 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [PATCH 2/4] ui/cocoa.m: Avoid deprecated CPS* functions Date: Tue, 12 Mar 2013 12:48:14 +0000 Message-Id: <1363092496-19978-3-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1363092496-19978-1-git-send-email-peter.maydell@linaro.org> References: <1363092496-19978-1-git-send-email-peter.maydell@linaro.org> X-Gm-Message-State: ALoCoQlHPLJPIRBwwLi3Zus57Bzwo8uFkpDBHUX+p1dX5gdULVRUeLAtk2eWEY5HuslN8CxGKLXr The functions CPSGetCurrentProcess and CPSEnableForegroundOperation are deprecated in newer versions of MacOSX and cause warning messages to be logged to the system log. Instead, use the new preferred method of promoting our console process up to a graphical app with menubar and Dock icon, which is TransformProcessType. (This function came in with MacOSX 10.3, so there's no need to retain the old method as we don't support anything earlier than 10.3 anyway.) Signed-off-by: Peter Maydell --- ui/cocoa.m | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 6e9f751..b40af59 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -863,22 +863,10 @@ QemuCocoaView *cocoaView; -// Dock Connection -typedef struct CPSProcessSerNum -{ - UInt32 lo; - UInt32 hi; -} CPSProcessSerNum; - -OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn); -OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5); -OSErr CPSSetFrontProcess( CPSProcessSerNum *psn); - int main (int argc, const char * argv[]) { gArgc = argc; gArgv = (char **)argv; - CPSProcessSerNum PSN; int i; /* In case we don't need to display a window, let's not do that */ @@ -902,12 +890,13 @@ int main (int argc, const char * argv[]) { } NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - [NSApplication sharedApplication]; - if (!CPSGetCurrentProcess(&PSN)) - if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103)) - if (!CPSSetFrontProcess(&PSN)) - [NSApplication sharedApplication]; + // Pull this console process up to being a fully-fledged graphical + // app with a menubar and Dock icon + ProcessSerialNumber psn = { 0, kCurrentProcess }; + TransformProcessType(&psn, kProcessTransformToForegroundApplication); + + [NSApplication sharedApplication]; // Add menus NSMenu *menu;