So, I don't have much experience with launch-services, open-step, or cocoa... so I'm going to be needing some crutches for a while... I think I figured out what I need to do to eliminate the second dock icon. I need to manage the foreground/background-ness of the application such that the launcher behaves as if LSBackgroundOnly=true and the server behaves as if LSBackgroundOnly=false. How does one go about changing this at runtime to push a background app into the foreground or visa-versa? It looks like NSApplication.hide() isn't right... that just causes the windows to hide, not push the app into the background... any help? Thanks, Jeremy
Jeremy Huddleston wrote:
So, I don't have much experience with launch-services, open-step, or cocoa... so I'm going to be needing some crutches for a while...
I think I figured out what I need to do to eliminate the second dock icon. I need to manage the foreground/background-ness of the application such that the launcher behaves as if LSBackgroundOnly=true and the server behaves as if LSBackgroundOnly=false. How does one go about changing this at runtime to push a background app into the foreground or visa-versa? It looks like NSApplication.hide() isn't right... that just causes the windows to hide, not push the app into the background... any help?
Pretty sure that Ben posted code to do that: + ProcessSerialNumber psn = { 0, kCurrentProcess }; + fprintf(stderr, "Calling TransformProcessType\n"); + TransformProcessType(&psn, kProcessTransformToForegroundApplication); + SetFrontProcess(&psn); So, I guess you'd need to look at the docs for TransformProcessType(). Peter -- Peter O'Gorman http://pogma.com
On Dec 4, 2007, at 18:26, Peter O'Gorman wrote:
Pretty sure that Ben posted code to do that:
+ ProcessSerialNumber psn = { 0, kCurrentProcess }; + fprintf(stderr, "Calling TransformProcessType\n"); + TransformProcessType(&psn, kProcessTransformToForegroundApplication); + SetFrontProcess(&psn);
Thanks. I thought I saw that before but for the life of me couldn't find the email. I'm glad someone is more on the ball than me. Thanks, Jeremy
Peter O'Gorman wrote:
So, I guess you'd need to look at the docs for TransformProcessType().
Or not :( http://developer.apple.com/documentation/Carbon/Reference/Process_Manager/Re... http://www.cocoadev.com/index.pl?TransformProcessType Peter -- Peter O'Gorman http://pogma.com
It looks like it can work. Instead of making it always foreground and pushing to the background for the launcher case, I'll make it background and push to the foreground in the server case. --Jeremy On Dec 4, 2007, at 19:45, Peter O'Gorman wrote:
Peter O'Gorman wrote:
So, I guess you'd need to look at the docs for TransformProcessType().
Or not :(
http://developer.apple.com/documentation/Carbon/Reference/Process_Manager/Re... /apple_ref/c/func/TransformProcessType http://www.cocoadev.com/index.pl?TransformProcessType
Peter -- Peter O'Gorman http://pogma.com _______________________________________________ Xquartz-dev mailing list Xquartz-dev@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo/xquartz-dev
Hrm... I tried this (needs to be in a separate C file due to type conflicts): #include <ApplicationServices/ApplicationServices.h> int moveToForeground() { ProcessSerialNumber psn = { 0, kCurrentProcess }; OSStatus returnCode = TransformProcessType(& psn, kProcessTransformToForegroundApplication); if( returnCode == 0) { //SetFrontProcess(&psn); } return (int)returnCode; } and called moveToForeground() before server_main(). this was added to Info.plist: <key>LSBackgroundOnly</key> <true/> returnCode was 0 (success), but the app didn't show up in the dock. I'm thinking this just won't work and I'm willing to settle with the current situation for now (since it's still better than before)... but still not optimal... --Jeremy On Dec 4, 2007, at 19:48, Jeremy Huddleston wrote:
It looks like it can work. Instead of making it always foreground and pushing to the background for the launcher case, I'll make it background and push to the foreground in the server case.
--Jeremy
On Dec 4, 2007, at 19:45, Peter O'Gorman wrote:
Peter O'Gorman wrote:
So, I guess you'd need to look at the docs for TransformProcessType().
Or not :(
http://developer.apple.com/documentation/Carbon/Reference/Process_Manager/Re... /apple_ref/c/func/TransformProcessType http://www.cocoadev.com/index.pl?TransformProcessType
Peter -- Peter O'Gorman http://pogma.com _______________________________________________ Xquartz-dev mailing list Xquartz-dev@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo/xquartz-dev
_______________________________________________ Xquartz-dev mailing list Xquartz-dev@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo/xquartz-dev
participants (3)
-
Jeremy Huddleston
-
Jeremy Huddleston
-
Peter O'Gorman