Added launchd support.

This commit is contained in:
Jeremy Huddleston 2007-12-10 23:00:44 -08:00
parent 13ac80469f
commit e8d4cefa08
3 changed files with 38 additions and 6 deletions

View file

@ -144,6 +144,17 @@ AC_SUBST(WCHAR32)
AM_CONDITIONAL(OS2, test x$os2 = xtrue)
AC_ARG_WITH(launchd, AS_HELP_STRING([--with-launchd], [Build with support for Apple's launchd (default: auto)]), [LAUNCHD=$withval], [LAUNCHD=auto])
if test "x$LAUNCHD" = xauto; then
unset LAUNCHD
AC_CHECK_PROG(LAUNCHD, [launchd], [yes], [no])
fi
if test "x$LAUNCHD" = xyes ; then
AC_DEFINE(HAVE_LAUNCHD, 1, [launchd support available])
AC_DEFINE(TRANS_REOPEN, 1, [launchd support available])
fi
AC_ARG_ENABLE(xthreads,
AC_HELP_STRING([--disable-xthreads],
[Disable Xlib support for Multithreading]),

View file

@ -303,7 +303,11 @@ _X11TransConnectDisplay (
#if defined(TCPCONN) || defined(UNIXCONN) || defined(LOCALCONN) || defined(MNX_TCPCONN) || defined(OS2PIPECONN)
if (!pprotocol) {
#ifdef HAVE_LAUNCHD
if (!phostname || phostname[0]=='/') {
#else
if (!phostname) {
#endif
#if defined(UNIXCONN) || defined(LOCALCONN) || defined(OS2PIPECONN)
pprotocol = copystring ("local", 5);
#if defined(TCPCONN)
@ -449,6 +453,14 @@ _X11TransConnectDisplay (
*fullnamep = (char *) Xmalloc (len);
if (!*fullnamep) goto bad;
#ifdef HAVE_LAUNCHD
if (phostname && strlen(phostname) > 11 && !strncmp(phostname, "/tmp/launch", 11))
sprintf (*fullnamep, "%s%s%d",
(phostname ? phostname : ""),
(dnet ? "::" : ":"),
idisplay);
else
#endif
sprintf (*fullnamep, "%s%s%d.%d",
(phostname ? phostname : ""),
(dnet ? "::" : ":"),

View file

@ -63,13 +63,22 @@ int _XConnectXCB(Display *dpy, _Xconst char *display, char **fullnamep, int *scr
if(!dpy->xcb)
return 0;
if(!xcb_parse_display(display, &host, &n, screenp))
return 0;
#ifdef HAVE_LAUNCHD
if(!display || !*display) display = getenv("DISPLAY");
if(display && strlen(display)>11 && !strncmp(display, "/tmp/launch", 11)) {
/* do nothing -- the magic happens inside of xcb_connect */
} else
#endif
{
if(!xcb_parse_display(display, &host, &n, screenp))
return 0;
len = strlen(host) + (1 + 20 + 1 + 20 + 1);
*fullnamep = Xmalloc(len);
snprintf(*fullnamep, len, "%s:%d.%d", host, n, *screenp);
free(host);
len = strlen(host) + (1 + 20 + 1 + 20 + 1);
*fullnamep = Xmalloc(len);
snprintf(*fullnamep, len, "%s:%d.%d", host, n, *screenp);
free(host);
}
_XLockMutex(_Xglobal_lock);
if(xauth.name && xauth.data)