[Xcb-commit] 2 commits - configure.ac src

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Sun Nov 23 17:25:38 PST 2008


 configure.ac   |    9 +++++++++
 src/xcb_util.c |   44 ++++++++++++++++++++++++++------------------
 2 files changed, 35 insertions(+), 18 deletions(-)

New commits:
commit f896ae8c53e99f39b347f9f0ac2b4a8cc12cad6f
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Sun Nov 23 17:25:21 2008 -0800

    Shutup compiler warning about unused variable...

diff --git a/src/xcb_util.c b/src/xcb_util.c
index 5bad16a..4ae9097 100644
--- a/src/xcb_util.c
+++ b/src/xcb_util.c
@@ -130,7 +130,9 @@ static int _xcb_open_abstract(char *protocol, const char *file);
 
 static int _xcb_open(char *host, char *protocol, const int display)
 {
+#ifdef HAVE_ABSTRACT_SOCKETS
     int fd;
+#endif
     static const char base[] = "/tmp/.X11-unix/X";
     char file[sizeof(base) + 20];
 
commit d79621b25ba6784135b1a3aa51e9561fcf72fe7f
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Sun Nov 23 17:23:17 2008 -0800

    Apple: Apple launchd cleanup
    Added --with-launchd option instead of just using __APPLE__
    Fixed opening launchd fd when displayname=NULL

diff --git a/configure.ac b/configure.ac
index e16d70d..8390c26 100644
--- a/configure.ac
+++ b/configure.ac
@@ -139,6 +139,15 @@ XCB_EXTENSION(XTest, "yes")
 XCB_EXTENSION(Xv, "yes")
 XCB_EXTENSION(XvMC, "yes")
 
+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])
+fi
 
 AC_CONFIG_FILES([
 Makefile
diff --git a/src/xcb_util.c b/src/xcb_util.c
index f5c9431..5bad16a 100644
--- a/src/xcb_util.c
+++ b/src/xcb_util.c
@@ -315,19 +315,22 @@ xcb_connection_t *xcb_connect(const char *displayname, int *screenp)
     char *protocol;
     xcb_connection_t *c;
     xcb_auth_info_t auth;
+    
+    int parsed = _xcb_parse_display(displayname, &host, &protocol, &display, screenp);
 
-#ifdef __APPLE__
+#ifdef HAVE_LAUNCHD
+    if(!displayname)
+        displayname = getenv("DISPLAY");
     if(displayname && strlen(displayname)>11 && !strncmp(displayname, "/tmp/launch", 11))
-        fd = _xcb_open_unix(protocol, displayname);
-    else {
-#endif        
-    if(!_xcb_parse_display(displayname, &host, &protocol, &display, screenp))
+        fd = _xcb_open_unix(NULL, displayname);
+    else
+#endif
+    if(!parsed)
         return (xcb_connection_t *) &error_connection;
-    fd = _xcb_open(host, protocol, display);
+    else
+        fd = _xcb_open(host, protocol, display);
     free(host);
-#ifdef __APPLE__
-    }
-#endif
+
     if(fd == -1)
         return (xcb_connection_t *) &error_connection;
 
@@ -348,18 +351,21 @@ xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *displayname,
     char *host;
     char *protocol;
 
-#ifdef __APPLE__
+    int parsed = _xcb_parse_display(displayname, &host, &protocol, &display, screenp);
+    
+#ifdef HAVE_LAUNCHD
+    if(!displayname)
+        displayname = getenv("DISPLAY");
     if(displayname && strlen(displayname)>11 && !strncmp(displayname, "/tmp/launch", 11))
-        fd = _xcb_open_unix(protocol, displayname);
-    else {
-#endif        
-    if(!_xcb_parse_display(displayname, &host, &protocol, &display, screenp))
+        fd = _xcb_open_unix(NULL, displayname);
+    else
+#endif
+    if(!parsed)
         return (xcb_connection_t *) &error_connection;
-    fd = _xcb_open(host, protocol, display);
+    else
+        fd = _xcb_open(host, protocol, display);
     free(host);
-#ifdef __APPLE__
-    }
-#endif    
+
     if(fd == -1)
         return (xcb_connection_t *) &error_connection;
 


More information about the xcb-commit mailing list