From patchwork Mon Mar 25 22:31:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 15636 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 2014E23E39 for ; Mon, 25 Mar 2013 22:31:41 +0000 (UTC) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by fiordland.canonical.com (Postfix) with ESMTP id D48FEA195EC for ; Mon, 25 Mar 2013 22:31:40 +0000 (UTC) Received: by mail-ve0-f174.google.com with SMTP id jz10so2626645veb.19 for ; Mon, 25 Mar 2013 15:31:40 -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=Ahjxe6o+gsl6UqlVd5+/h+5G4hg08LpQNy87vNJgJwA=; b=QDeYRvIIMtQIVDWxWElRFlBT8I6oWXg62rI03q2Bu5zHDTJMgrOm8RRf7/n0JwgUXm FC0SdGZcmjRSSTWtDESO7K+1TRfE7imkOPIlhrglH+NlQkwKHOT4CoZRcBRpOtBGke6Q bxywRt3ohug7Aq3zdTtqifEDqAGcyGRFcTFe9pGbTDlKo+sc/aerd0Tfj7tNAoq2/9jI u2FSR00tM/1letOjrP2ufQ4aGS0tjQ3XhP6golEQhIFJbDwc66bAnh3utf6yL7qCYznq G/JuogmDa2RjdWFUJk2yNnJlsEJEKPi+9UzwBHvMsa/sBMxDvT8YOoKe+7zDtgC+tMne LWtQ== X-Received: by 10.220.153.143 with SMTP id k15mr17898346vcw.33.1364250700385; Mon, 25 Mar 2013 15:31:40 -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.59.4.204 with SMTP id cg12csp45844ved; Mon, 25 Mar 2013 15:31:39 -0700 (PDT) X-Received: by 10.204.201.1 with SMTP id ey1mr1760920bkb.110.1364250697221; Mon, 25 Mar 2013 15:31:37 -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 gi14si4749214bkc.9.2013.03.25.15.31.36 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 25 Mar 2013 15:31:37 -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 1UKFvT-00024Y-0q; Mon, 25 Mar 2013 22:31:35 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [PATCH v2 2/4] ui/cocoa.m: Avoid deprecated CPS* functions Date: Mon, 25 Mar 2013 22:31:32 +0000 Message-Id: <1364250694-7939-3-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1364250694-7939-1-git-send-email-peter.maydell@linaro.org> References: <1364250694-7939-1-git-send-email-peter.maydell@linaro.org> X-Gm-Message-State: ALoCoQmXn6rGn8nRy19vPYNJvy/kZpXUaFubNthPf0PfNhEQrVq0sJFnzBOH6ESDkusFmhHJwMp6 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 e9120e4..e768b05 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -851,22 +851,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 */ @@ -890,12 +878,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;