From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49722) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhTfv-0004r5-Aq for qemu-devel@nongnu.org; Tue, 28 May 2013 19:51:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UhTfu-00039X-29 for qemu-devel@nongnu.org; Tue, 28 May 2013 19:51:31 -0400 Received: from mout.web.de ([212.227.17.12]:51848) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhTft-00039E-Og for qemu-devel@nongnu.org; Tue, 28 May 2013 19:51:29 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Wed, 29 May 2013 01:51:19 +0200 Message-Id: <1369785081-4838-3-git-send-email-andreas.faerber@web.de> In-Reply-To: <1369785081-4838-1-git-send-email-andreas.faerber@web.de> References: <1369785081-4838-1-git-send-email-andreas.faerber@web.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PULL 2/4] cocoa: Avoid deprecated CPS* functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Anthony Liguori From: Peter Maydell 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 Signed-off-by: Andreas Färber --- ui/cocoa.m | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 5d7a1e0..ec09728 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; -- 1.8.1.4