XQuartz: Removed hardcoded org.x.X11 from MachIPC as well

(cherry picked from commit b4add7826d485600a13eba6a9c7be533f2c02d51)
This commit is contained in:
Jeremy Huddleston 2008-11-25 01:13:35 -08:00
parent 065d2afb0c
commit 0b314c50a2
3 changed files with 23 additions and 8 deletions

View File

@ -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;
}

View File

@ -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];

View File

@ -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;
}