[Xquartz-dev] Re: RFC: Combining both X11.apps into one

Jeremy Huddleston jeremyhu at berkeley.edu
Mon Dec 3 17:19:49 PST 2007

> I have not looked at it, but what does it do in the event that a user
> launches X11 by double-clicking on the X11.app icon

Assuming they haven't done anything wonky, this just causes 'xterm' to  
be executed (like currently).  Launchd then executed '/A/U/X11.app/C/M/ 
X11 --launchd' instead of '/u/X/X11.app/C/M/X11'.

Additionally, if the user disables launchd support, double clicking /A/ 
U/X11.app will behave as Tiger did.

> and then, in a
> Terminal.app window does ssh -X <somewhere>?

same as it does now.  This didn't change.

> I believe that the original
> problem was that another instance of X11.app would then launch with a
> different DISPLAY.

Ok, I see what you're getting at here.  That will only be the case if  
the user disables launchd support.  This just rolls /u/X/X11.app into / 
A/U/X11.app and executes the /u/X version if command line arguments  
are given (like launchd or people starting it via command line for  
various reasons) or if it can't connect to a DISPLAY (such as when you  
disable launchd support for the "Tiger Way").  Here's the core of  
it... pretty straightforward:

int main(int argc, char **argv) {
     Display *display;

     /* If we have command line arguments, assume we want a server */
     if(argc > 1) {
         if(strncmp(argv[1], "--launchd", 9) == 0) {
             argv[1] = argv[0];
         return server_main(argc, argv);

     /* Now, try to open a display, if so, run the launcher */
     display = XOpenDisplay(NULL);
     if(display) {
         /* Could open the display, start the launcher */

         /* Give 2 seconds for the server to start...
          * TODO: *Really* fix this race condition
         return launcher_main(argc, argv);

     /* Couldn't open the display, assume we just want to start a  
server */
     return server_main(argc, argv);
-------------- 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/20071203/b95c79bb/smime.bin

More information about the Xquartz-dev mailing list