1 When the X / Xquartz server initializes, it starts the XQuartz.app and
2 hands-off the display FD. To start the XQuartz.app, Xquartz normally uses some
3 system calls to get the path of the application by app bundle id, and then
4 executes the Contents/MacOS/X11 script contained inside, which in turn executes
5 Contents/MacOS/X11.bin (the actual app).
7 This patch replaces that discovery technique with a simple call to
8 `getenv' and a hardcoded default. In order to make Xquartz work if the
9 app is moved, we'll need another wrapper that sets the `XQUARTZ_X11'
10 environment variable to point to the `X11' script.
12 diff --git a/hw/xquartz/mach-startup/stub.c b/hw/xquartz/mach-startup/stub.c
13 index 83252e805..f1974215b 100644
14 --- a/hw/xquartz/mach-startup/stub.c
15 +++ b/hw/xquartz/mach-startup/stub.c
18 #include "launchd_fd.h"
20 -static CFURLRef x11appURL;
21 static FSRef x11_appRef;
22 static pid_t x11app_pid = 0;
24 @@ -60,29 +59,21 @@ aslclient aslc;
28 - OSStatus osstatus = LSFindApplicationForInfo(kLSUnknownCreator, CFSTR(kX11AppBundleId),
29 - nil, &x11_appRef, &x11appURL);
30 + unsigned char *xquartzApp = getenv("XQUARTZ_APP");
32 + xquartzApp = "@XQUARTZ_APP@";
35 + OSStatus osstatus = FSPathMakeRef(xquartzApp, &x11_appRef, NULL);
39 - if (x11appURL == NULL) {
40 - asl_log(aslc, NULL, ASL_LEVEL_ERR,
41 - "Xquartz: Invalid response from LSFindApplicationForInfo(%s)",
47 - case kLSApplicationNotFoundErr:
48 - asl_log(aslc, NULL, ASL_LEVEL_ERR,
49 - "Xquartz: Unable to find application for %s",
54 asl_log(aslc, NULL, ASL_LEVEL_ERR,
55 - "Xquartz: Unable to find application for %s, error code = %d",
56 - kX11AppBundleId, (int)osstatus);
57 + "Xquartz: Unable to find FSRef for %s, error code = %d",
58 + xquartzApp, (int)osstatus);