From: "Andreas Färber" <andreas.faerber@web.de>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Andreas Färber" <andreas.faerber@web.de>,
"Anthony Liguori" <aliguori@us.ibm.com>
Subject: [Qemu-devel] [PULL 2/4] cocoa: Avoid deprecated CPS* functions
Date: Wed, 29 May 2013 01:51:19 +0200 [thread overview]
Message-ID: <1369785081-4838-3-git-send-email-andreas.faerber@web.de> (raw)
In-Reply-To: <1369785081-4838-1-git-send-email-andreas.faerber@web.de>
From: Peter Maydell <peter.maydell@linaro.org>
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 <peter.maydell@linaro.org>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
---
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
next prev parent reply other threads:[~2013-05-28 23:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-28 23:51 [Qemu-devel] [PULL 0/4] Cocoa patch queue 2013-05-29 Andreas Färber
2013-05-28 23:51 ` [Qemu-devel] [PULL 1/4] cocoa: Fix leaks of NSScreen and NSConcreteMapTable Andreas Färber
2013-05-28 23:51 ` Andreas Färber [this message]
2013-05-28 23:51 ` [Qemu-devel] [PULL 3/4] cocoa: Avoid deprecated NSOpenPanel filename method Andreas Färber
2013-05-28 23:51 ` [Qemu-devel] [PULL 4/4] cocoa: Avoid deprecated NSOpenPanel beginSheetForDirectory Andreas Färber
2013-06-17 21:18 ` [Qemu-devel] [PULL 0/4] Cocoa patch queue 2013-05-29 Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1369785081-4838-3-git-send-email-andreas.faerber@web.de \
--to=andreas.faerber@web.de \
--cc=aliguori@us.ibm.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).