[Xquartz-dev] LSBackgroundOnly at runtime

Jeremy Huddleston jeremyhu at berkeley.edu
Tue Dec 4 23:04:27 PST 2007


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/Reference/reference.html#/ 
>> /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 at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo/xquartz-dev
>
> _______________________________________________
> Xquartz-dev mailing list
> Xquartz-dev at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo/xquartz-dev

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3040 bytes
Desc: not available
Url : http://lists.macosforge.org/pipermail/xquartz-dev/attachments/20071204/813e0cd7/smime.bin


More information about the Xquartz-dev mailing list