diff options
author | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-11-25 01:13:35 -0800 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-11-25 11:52:59 -0800 |
commit | 0b314c50a2a0ca1afbdc06663c3b719b05ebb851 (patch) | |
tree | bc32e3ffd0ee15d754e0bbeac2194531dfe3563d /hw | |
parent | 065d2afb0ca34f89806e0936c51cd27805bc5123 (diff) |
XQuartz: Removed hardcoded org.x.X11 from MachIPC as well
(cherry picked from commit b4add7826d485600a13eba6a9c7be533f2c02d51)
Diffstat (limited to 'hw')
-rw-r--r-- | hw/xquartz/mach-startup/bundle-main.c | 17 | ||||
-rw-r--r-- | hw/xquartz/mach-startup/mach_startup_types.h | 1 | ||||
-rw-r--r-- | hw/xquartz/mach-startup/stub.c | 13 |
3 files changed, 23 insertions, 8 deletions
diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c index fa19eab9a..c1138be99 100644 --- a/hw/xquartz/mach-startup/bundle-main.c +++ b/hw/xquartz/mach-startup/bundle-main.c @@ -73,6 +73,8 @@ const char *__crashreporter_info__base = "X.Org X Server " XSERVER_VERSION " Bui char __crashreporter_info__buf[4096]; char *__crashreporter_info__ = __crashreporter_info__buf; +static char *server_bootstrap_name = "org.x.X11"; + #define DEBUG 1 /* This is in quartzStartup.c */ @@ -370,7 +372,7 @@ int startup_trigger(int argc, char **argv, char **envp) { strlcpy(newenvp[i], envp[i], STRING_T_SIZE); } - kr = bootstrap_look_up(bootstrap_port, SERVER_BOOTSTRAP_NAME, &mp); + kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp); if (kr != KERN_SUCCESS) { #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 fprintf(stderr, "bootstrap_look_up(): %s\n", bootstrap_strerror(kr)); @@ -426,14 +428,19 @@ int main(int argc, char **argv, char **envp) { /* Setup the initial crasherporter info */ strlcpy(__crashreporter_info__, __crashreporter_info__base, __crashreporter_info__len); - /* Pass on our prefs domain to startx and its inheritors (mainly for quartz-wm) */ + /* Pass on our prefs domain to startx and its inheritors (mainly for + * quartz-wm and the Xquartz stub's MachIPC) + */ CFBundleRef bundle = CFBundleGetMainBundle(); if(bundle) { CFStringRef pd = CFBundleGetIdentifier(bundle); if(pd) { const char *pds = CFStringGetCStringPtr(pd, 0); - if(pds) + if(pds) { + server_bootstrap_name = malloc(sizeof(char) * (strlen(pds) + 1)); + strcpy(server_bootstrap_name, pds); setenv("X11_PREFS_DOMAIN", pds, 1); + } } } @@ -445,9 +452,9 @@ int main(int argc, char **argv, char **envp) { } } - mp = checkin_or_register(SERVER_BOOTSTRAP_NAME); + mp = checkin_or_register(server_bootstrap_name); if(mp == MACH_PORT_NULL) { - fprintf(stderr, "NULL mach service: %s", SERVER_BOOTSTRAP_NAME); + fprintf(stderr, "NULL mach service: %s", server_bootstrap_name); return EXIT_FAILURE; } diff --git a/hw/xquartz/mach-startup/mach_startup_types.h b/hw/xquartz/mach-startup/mach_startup_types.h index 97ac147cd..459c750db 100644 --- a/hw/xquartz/mach-startup/mach_startup_types.h +++ b/hw/xquartz/mach-startup/mach_startup_types.h @@ -1,7 +1,6 @@ #ifndef _MACH_STARTUP_TYPES_H_ #define _MACH_STARTUP_TYPES_H_ -#define SERVER_BOOTSTRAP_NAME "org.x.X11" #define STRING_T_SIZE 1024 typedef char string_t[STRING_T_SIZE]; diff --git a/hw/xquartz/mach-startup/stub.c b/hw/xquartz/mach-startup/stub.c index aa0505a32..893d19c8d 100644 --- a/hw/xquartz/mach-startup/stub.c +++ b/hw/xquartz/mach-startup/stub.c @@ -40,6 +40,12 @@ #include <sys/socket.h> #include <sys/un.h> +static char *server_bootstrap_name = "org.x.X11"; + +/* The launchd startup is only designed for the primary X11.app that is + * org.x.X11... server_bootstrap_name might be differnet if we were triggered to + * start by another X11.app. + */ #define kX11AppBundleId "org.x.X11" #define kX11AppBundlePath "/Contents/MacOS/X11" @@ -222,6 +228,9 @@ int main(int argc, char **argv, char **envp) { return EXIT_SUCCESS; } + if(getenv("X11_PREFS_DOMAIN")) + server_bootstrap_name = getenv("X11_PREFS_DOMAIN"); + /* We don't have a mechanism in place to handle this interrupt driven * server-start notification, so just send the signal now, so xinit doesn't * time out waiting for it and will just poll for the server. @@ -238,7 +247,7 @@ int main(int argc, char **argv, char **envp) { /* Get the $DISPLAY FD */ launchd_fd = launchd_display_fd(); - kr = bootstrap_look_up(bootstrap_port, SERVER_BOOTSTRAP_NAME, &mp); + kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp); if(kr != KERN_SUCCESS) { set_x11_path(); @@ -261,7 +270,7 @@ int main(int argc, char **argv, char **envp) { /* Try connecting for 10 seconds */ for(i=0; i < 80; i++) { usleep(250000); - kr = bootstrap_look_up(bootstrap_port, SERVER_BOOTSTRAP_NAME, &mp); + kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp); if(kr == KERN_SUCCESS) break; } |