[Xquartz-changes] xserver: Branch 'server-1.10-apple' - 6 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Fri Apr 22 01:25:25 PDT 2011


 configure.ac                          |   10 +++-
 hw/xquartz/X11Application.m           |   74 +++++++++++++++++++++++++---------
 hw/xquartz/darwin.c                   |    3 -
 hw/xquartz/darwin.h                   |    1 
 hw/xquartz/darwinEvents.c             |   48 ++++++++++++++++------
 hw/xquartz/darwinEvents.h             |    3 -
 hw/xquartz/mach-startup/bundle-main.c |   47 ++++++++++++---------
 include/dix-config.h.in               |    3 +
 8 files changed, 131 insertions(+), 58 deletions(-)

New commits:
commit 917040422f3f85aba69d10f0750da88f937b815f
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Apr 22 01:23:09 2011 -0700

    XQuartz: Do translation and handoff of NSEvent to X11 in a separate serial queue
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 1e36436..4131075 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -385,7 +385,22 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
     
     if (for_appkit) [super sendEvent:e];
     
-    if (for_x) [self sendX11NSEvent:e];
+    if (for_x) {
+#ifdef HAVE_LIBDISPATCH
+        static dispatch_queue_t eventTranslationQueue;
+        static dispatch_once_t pred;
+        dispatch_once(&pred, ^{
+            eventTranslationQueue = dispatch_queue_create(LAUNCHD_ID_PREFIX".X11.NSEventsToX11EventsQueue", NULL);
+            if(eventTranslationQueue == NULL)
+                FatalError("Error creating a dispatch queue\n");
+        });
+        dispatch_async(eventTranslationQueue, ^{
+#endif
+            [self sendX11NSEvent:e];
+#ifdef HAVE_LIBDISPATCH
+        });
+#endif
+    }
 }
 
 - (void) set_window_menu:(NSArray *)list {
commit b0ea3a1c2bb61695bece18b62fc794069935feff
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Apr 22 00:39:12 2011 -0700

    XQuartz: Send tablet proximity events with tilt and pressure
    
    <rdar://problem/6257569>
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 988a86b..1e36436 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -1079,13 +1079,29 @@ static const char *untrusted_str(NSEvent *e) {
 #endif
 
 - (void) sendX11NSEvent:(NSEvent *)e {
-    NSPoint location = NSZeroPoint, tilt = NSZeroPoint;
+    NSPoint location = NSZeroPoint;
     int ev_button, ev_type;
-    float pressure = 0.0;
+    static float pressure = 0.0;       // static so ProximityOut will have the value from the previous tablet event
+    static NSPoint tilt;               // static so ProximityOut will have the value from the previous tablet event
+    static DeviceIntPtr darwinTabletCurrent = NULL;
+    static BOOL needsProximityIn = NO; // Do we do need to handle a pending ProximityIn once we have pressure/tilt?
     DeviceIntPtr pDev;
     int modifierFlags;
     BOOL isMouseOrTabletEvent, isTabletEvent;
 
+#ifdef HAVE_LIBDISPATCH
+    static dispatch_once_t once_pred;
+    dispatch_once(&once_pred, ^{
+        tilt = NSZeroPoint;
+        darwinTabletCurrent = darwinTabletStylus;
+    });
+#else
+    if(!darwinTabletCurrent) {
+        tilt = NSZeroPoint;
+        darwinTabletCurrent = darwinTabletStylus;
+    }
+#endif
+    
     isMouseOrTabletEvent =  [e type] == NSLeftMouseDown    ||  [e type] == NSOtherMouseDown    ||  [e type] == NSRightMouseDown    ||
                             [e type] == NSLeftMouseUp      ||  [e type] == NSOtherMouseUp      ||  [e type] == NSRightMouseUp      ||
                             [e type] == NSLeftMouseDragged ||  [e type] == NSOtherMouseDragged ||  [e type] == NSRightMouseDragged ||
@@ -1207,19 +1223,14 @@ static const char *untrusted_str(NSEvent *e) {
                         darwinTabletCurrent=darwinTabletCursor;
                         break;
                 }
-                
-                /* NSTabletProximityEventSubtype doesn't encode pressure ant tilt
-                 * So we just pretend the motion was caused by the mouse.  Hopefully
-                 * we'll have a better solution for this in the future (like maybe
-                 * NSTabletProximityEventSubtype will come from NSTabletPoint
-                 * rather than NSMouseMoved.
-                pressure = [e pressure];
-                tilt     = [e tilt];
-                pDev = darwinTabletCurrent;                
-                 */
 
-                DarwinSendProximityEvents([e isEnteringProximity] ? ProximityIn : ProximityOut,
-                                          location.x, location.y);
+                if([e isEnteringProximity])
+                    needsProximityIn = YES;
+                else
+                    DarwinSendProximityEvents(darwinTabletCurrent, ProximityOut,
+                                              location.x, location.y, pressure,
+                                              tilt.x, tilt.y);
+                return;
             }
 
 			if ([e type] == NSTabletPoint || [e subtype] == NSTabletPointEventSubtype) {
@@ -1227,6 +1238,14 @@ static const char *untrusted_str(NSEvent *e) {
                 tilt     = [e tilt];
                 
                 pDev = darwinTabletCurrent;
+                
+                if(needsProximityIn) {
+                    DarwinSendProximityEvents(darwinTabletCurrent, ProximityIn,
+                                              location.x, location.y, pressure,
+                                              tilt.x, tilt.y);
+
+                    needsProximityIn = NO;
+                }
             }
 
             if(!XQuartzServerVisible && noTestExtensions) {
@@ -1280,8 +1299,12 @@ static const char *untrusted_str(NSEvent *e) {
                     break;
             }
             
-			DarwinSendProximityEvents([e isEnteringProximity] ? ProximityIn : ProximityOut,
-                                      location.x, location.y);
+            if([e isEnteringProximity])
+                needsProximityIn = YES;
+            else
+                DarwinSendProximityEvents(darwinTabletCurrent, ProximityOut,
+                                          location.x, location.y, pressure,
+                                          tilt.x, tilt.y);
             break;
             
 		case NSScrollWheel:
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 93697a9..5fb36cd 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -117,7 +117,6 @@ unsigned int            windowItemModMask = NX_COMMANDMASK;
 // devices
 DeviceIntPtr            darwinKeyboard = NULL;
 DeviceIntPtr            darwinPointer = NULL;
-DeviceIntPtr            darwinTabletCurrent = NULL;
 DeviceIntPtr            darwinTabletStylus = NULL;
 DeviceIntPtr            darwinTabletCursor = NULL;
 DeviceIntPtr            darwinTabletEraser = NULL;
@@ -494,8 +493,6 @@ void InitInput( int argc, char **argv )
     darwinTabletEraser = AddInputDevice(serverClient, DarwinTabletProc, TRUE);
     darwinTabletEraser->name = strdup("eraser");
 
-    darwinTabletCurrent = darwinTabletStylus;
-
     DarwinEQInit();
 
     QuartzInitInput(argc, argv);
diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h
index 350eade..b6d563a 100644
--- a/hw/xquartz/darwin.h
+++ b/hw/xquartz/darwin.h
@@ -57,7 +57,6 @@ extern io_connect_t     darwinParamConnect;
 extern int              darwinEventReadFD;
 extern int              darwinEventWriteFD;
 extern DeviceIntPtr     darwinPointer;
-extern DeviceIntPtr     darwinTabletCurrent;
 extern DeviceIntPtr     darwinTabletCursor;
 extern DeviceIntPtr     darwinTabletStylus;
 extern DeviceIntPtr     darwinTabletEraser;
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index edf60c8..dc0b842 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -489,7 +489,7 @@ void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, floa
     DarwinPrepareValuators(pDev, valuators, screen, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
     darwinEvents_lock(); {
         ValuatorMask mask;
-        valuator_mask_set_range(&mask, 0, (pDev == darwinTabletCurrent) ? 5 : 2, valuators);
+        valuator_mask_set_range(&mask, 0, (pDev == darwinPointer) ? 2 : 5, valuators);
         num_events = GetPointerEvents(darwinEvents, pDev, ev_type, ev_button, 
                                       POINTER_ABSOLUTE, &mask);
         for(i=0; i<num_events; i++) mieqEnqueue (pDev, (InternalEvent*)darwinEvents[i].event);
@@ -512,18 +512,18 @@ void DarwinSendKeyboardEvents(int ev_type, int keycode) {
     } darwinEvents_unlock();
 }
 
-void DarwinSendProximityEvents(int ev_type, float pointer_x, float pointer_y) {
-	int i, num_events;
+void DarwinSendProximityEvents(DeviceIntPtr pDev, int ev_type, float pointer_x, float pointer_y,  
+                               float pressure, float tilt_x, float tilt_y) {
+    int i, num_events;
     ScreenPtr screen;
-    DeviceIntPtr pDev = darwinTabletCurrent;
     int valuators[5];
 
-	DEBUG_LOG("DarwinSendProximityEvents(%d, %f, %f)\n", ev_type, pointer_x, pointer_y);
+    DEBUG_LOG("DarwinSendProximityEvents: %d l:%f,%f p:%f t:%f,%f\n", ev_type, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
 
-	if(!darwinEvents) {
-		DEBUG_LOG("DarwinSendProximityEvents called before darwinEvents was initialized\n");
-		return;
-	}
+    if(!darwinEvents) {
+        DEBUG_LOG("DarwinSendProximityEvents called before darwinEvents was initialized\n");
+        return;
+    }
     
     screen = miPointerGetScreen(pDev);
     if(!screen) {
@@ -531,7 +531,7 @@ void DarwinSendProximityEvents(int ev_type, float pointer_x, float pointer_y) {
         return;
     }    
 
-    DarwinPrepareValuators(pDev, valuators, screen, pointer_x, pointer_y, 0.0f, 0.0f, 0.0f);
+    DarwinPrepareValuators(pDev, valuators, screen, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
     darwinEvents_lock(); {
         ValuatorMask mask;
         valuator_mask_set_range(&mask, 0, 5, valuators);
diff --git a/hw/xquartz/darwinEvents.h b/hw/xquartz/darwinEvents.h
index 590305f..6769c8b 100644
--- a/hw/xquartz/darwinEvents.h
+++ b/hw/xquartz/darwinEvents.h
@@ -37,7 +37,8 @@ void DarwinEQPointerPost(DeviceIntPtr pDev, xEventPtr e);
 void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
 void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, float pointer_x, float pointer_y,
 			     float pressure, float tilt_x, float tilt_y);
-void DarwinSendProximityEvents(int ev_type, float pointer_x, float pointer_y);
+void DarwinSendProximityEvents(DeviceIntPtr pDev, int ev_type, float pointer_x, float pointer_y,
+                               float pressure, float tilt_x, float tilt_y);
 void DarwinSendKeyboardEvents(int ev_type, int keycode);
 void DarwinSendScrollEvents(float count_x, float count_y, float pointer_x, float pointer_y,
 			    float pressure, float tilt_x, float tilt_y);
commit d220dba156dfc3a9adc3eeb947abce047dbf4d8d
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Thu Apr 21 16:31:58 2011 -0700

    XQuartz: Use dispatch_async to handoff the FD
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index d55d1ed..6a6c01c 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -40,10 +40,15 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include <pthread.h>
 #include <stdbool.h>
 #include <signal.h>
 
+#ifdef HAVE_LIBDISPATCH
+#include <dispatch/dispatch.h>
+#else
+#include <pthread.h>
+#endif
+
 #include <sys/socket.h>
 #include <sys/un.h>
 
@@ -94,6 +99,7 @@ int server_main(int argc, char **argv, char **envp);
 static int execute(const char *command);
 static char *command_from_prefs(const char *key, const char *default_value);
 
+#ifndef HAVE_LIBDISPATCH
 /*** Pthread Magics ***/
 static pthread_t create_thread(void *(*func)(void *), void *arg) {
     pthread_attr_t attr;
@@ -107,6 +113,7 @@ static pthread_t create_thread(void *(*func)(void *), void *arg) {
 	
     return tid;
 }
+#endif
 
 /*** Mach-O IPC Stuffs ***/
 
@@ -199,8 +206,13 @@ typedef struct {
 /* This thread accepts an incoming connection and hands off the file
  * descriptor for the new connection to accept_fd_handoff()
  */
+#ifdef HAVE_LIBDISPATCH
+static void socket_handoff(socket_handoff_t *handoff_data) {
+#else
 static void *socket_handoff_thread(void *arg) {
     socket_handoff_t *handoff_data = (socket_handoff_t *)arg;
+#endif
+
     int launchd_fd = -1;
     int connected_fd;
 
@@ -229,7 +241,9 @@ static void *socket_handoff_thread(void *arg) {
     fprintf(stderr, "X11.app Handing off fd to server thread via DarwinListenOnOpenFD(%d)\n", launchd_fd);
     DarwinListenOnOpenFD(launchd_fd);
 
+#ifndef HAVE_LIBDISPATCH
     return NULL;
+#endif
 }
 
 static int create_socket(char *filename_out) {
@@ -298,8 +312,14 @@ kern_return_t do_request_fd_handoff_socket(mach_port_t port, string_t filename)
     }
 
     strlcpy(filename, handoff_data->filename, STRING_T_SIZE);
-    
+
+#ifdef HAVE_LIBDISPATCH
+    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0), ^{
+        socket_handoff(handoff_data);
+    });
+#else
     create_thread(socket_handoff_thread, handoff_data);
+#endif
     
 #ifdef DEBUG
     fprintf(stderr, "X11.app: Thread created for handoff.  Returning success to tell caller to connect and push the fd.\n");
commit 3ed9142f83b860883591b28f8739b171cc9126ad
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Thu Apr 21 15:51:32 2011 -0700

    configure.ac: Add check for libdispatch when building for darwin
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/configure.ac b/configure.ac
index 72fc979..12eae56 100644
--- a/configure.ac
+++ b/configure.ac
@@ -746,9 +746,9 @@ case $host_os in
 		 		save_LDFLAGS=$LDFLAGS
 				LDFLAGS="$LDFLAGS -framework Carbon"
 				AC_LINK_IFELSE([char FSFindFolder(); int main() { FSFindFolder(); return 0;}],
-				[xorg_cv_Carbon_framework=yes],
-				[xorg_cv_Carbon_framework=no])
-			LDFLAGS=$save_LDFLAGS])
+				               [xorg_cv_Carbon_framework=yes],
+				               [xorg_cv_Carbon_framework=no])
+			        LDFLAGS=$save_LDFLAGS])
                 
 			if test "X$xorg_cv_Carbon_framework" = Xyes; then
 				XQUARTZ=yes
@@ -757,6 +757,10 @@ case $host_os in
 			fi
 		fi
 
+		AC_CHECK_FUNC(dispatch_async,
+		              AC_DEFINE([HAVE_LIBDISPATCH], 1, [Define to 1 if you have the libdispatch (GCD) available]),
+		              [])
+
 		if test "x$XQUARTZ" = xyes ; then
 			XQUARTZ=yes
 			XVFB=no
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index d81264d..436aab0 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -136,6 +136,9 @@
 /* Define to 1 if you have the `m' library (-lm). */
 #undef HAVE_LIBM
 
+/* Define to 1 if you have the libdispatch (GCD) available */
+#undef HAVE_LIBDISPATCH
+
 /* Define to 1 if you have the `link' function. */
 #undef HAVE_LINK
 
commit 7c86ed49a14e0bc4b891fb3e0bc1acaa0a7ddcb2
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Thu Apr 21 15:19:12 2011 -0700

    XQuartz: Fix prototypes for thread functions
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 3521517..988a86b 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -950,7 +950,7 @@ environment the next time you start X11?", @"Startup xinitrc dialog");
     [X11App prefs_synchronize];
 }
 
-static inline pthread_t create_thread(void *func, void *arg) {
+static inline pthread_t create_thread(void *(*func)(void *), void *arg) {
     pthread_attr_t attr;
     pthread_t tid;
     
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 0853b71..edf60c8 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -94,7 +94,7 @@ static pthread_mutex_t mieq_lock = PTHREAD_MUTEX_INITIALIZER;
 static pthread_cond_t mieq_ready_cond = PTHREAD_COND_INITIALIZER;
 
 /*** Pthread Magics ***/
-static pthread_t create_thread(void *func, void *arg) {
+static pthread_t create_thread(void *(*func)(void *), void *arg) {
     pthread_attr_t attr;
     pthread_t tid;
 
@@ -305,7 +305,7 @@ void DarwinListenOnOpenFD(int fd) {
     pthread_mutex_unlock(&fd_add_lock);
 }
 
-static void DarwinProcessFDAdditionQueue_thread(void *args) {
+static void *DarwinProcessFDAdditionQueue_thread(void *args) {
     /* TODO: Possibly adjust this to no longer be a race... maybe trigger this
      *       once a client connects and claims to be the WM.
      *
@@ -334,6 +334,8 @@ static void DarwinProcessFDAdditionQueue_thread(void *args) {
         }
         pthread_cond_wait(&fd_add_ready_cond, &fd_add_lock);
     }
+
+    return NULL;
 }
 
 Bool DarwinEQInit(void) { 
diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index 4c79cfb..d55d1ed 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -95,7 +95,7 @@ static int execute(const char *command);
 static char *command_from_prefs(const char *key, const char *default_value);
 
 /*** Pthread Magics ***/
-static pthread_t create_thread(void *func, void *arg) {
+static pthread_t create_thread(void *(*func)(void *), void *arg) {
     pthread_attr_t attr;
     pthread_t tid;
 	
@@ -199,7 +199,7 @@ typedef struct {
 /* This thread accepts an incoming connection and hands off the file
  * descriptor for the new connection to accept_fd_handoff()
  */
-static void socket_handoff_thread(void *arg) {
+static void *socket_handoff_thread(void *arg) {
     socket_handoff_t *handoff_data = (socket_handoff_t *)arg;
     int launchd_fd = -1;
     int connected_fd;
@@ -228,6 +228,8 @@ static void socket_handoff_thread(void *arg) {
         
     fprintf(stderr, "X11.app Handing off fd to server thread via DarwinListenOnOpenFD(%d)\n", launchd_fd);
     DarwinListenOnOpenFD(launchd_fd);
+
+    return NULL;
 }
 
 static int create_socket(char *filename_out) {
commit ce7e6b1af67bc84ec3b2c4ca58a0138e9fe27836
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Thu Apr 21 15:11:52 2011 -0700

    XQuartz: Make the DarwinProcessFDAdditionQueue_thread wait 3 seconds to allow xinitrc to catch up
    
    Previously, we weren't always waiting the full three seconds.  This should
    be better, but is still sub-optimal.  We really want to start processing
    these once a WM has been started.
    
    http://xquartz.macosforge.org/trac/ticket/416
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 16fec4a..0853b71 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -61,6 +61,7 @@ in this Software without prior written authorization from The Open Group.
 #include <unistd.h>
 #include <pthread.h>
 #include <errno.h>
+#include <time.h>
 
 #include <IOKit/hidsystem/IOLLEvent.h>
 
@@ -305,6 +306,27 @@ void DarwinListenOnOpenFD(int fd) {
 }
 
 static void DarwinProcessFDAdditionQueue_thread(void *args) {
+    /* TODO: Possibly adjust this to no longer be a race... maybe trigger this
+     *       once a client connects and claims to be the WM.
+     *
+     * From ajax:
+     * There's already an internal callback chain for setting selection [in 1.5]
+     * ownership.  See the CallSelectionCallback at the bottom of
+     * ProcSetSelectionOwner, and xfixes/select.c for an example of how to hook
+     * into it.
+     */
+
+    struct timespec sleep_for;
+    struct timespec sleep_remaining;
+
+    sleep_for.tv_sec = 3;
+    sleep_for.tv_nsec = 0;
+
+    ErrorF("X11.app: DarwinProcessFDAdditionQueue_thread: Sleeping to allow xinitrc to catchup.\n");
+    while(nanosleep(&sleep_for, &sleep_remaining) != 0) {
+        sleep_for = sleep_remaining;
+    }
+
     pthread_mutex_lock(&fd_add_lock);
     while(true) {
         while(fd_add_count) {
diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index 75b3939..4c79cfb 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -47,7 +47,6 @@
 #include <sys/socket.h>
 #include <sys/un.h>
 
-#include <sys/time.h>
 #include <fcntl.h>
 
 #include <mach/mach.h>
@@ -204,7 +203,6 @@ static void socket_handoff_thread(void *arg) {
     socket_handoff_t *handoff_data = (socket_handoff_t *)arg;
     int launchd_fd = -1;
     int connected_fd;
-    unsigned remain;
 
     /* Now actually get the passed file descriptor from this connection
      * If we encounter an error, keep listening.
@@ -227,20 +225,7 @@ static void socket_handoff_thread(void *arg) {
     close(handoff_data->fd);
     unlink(handoff_data->filename);
     free(handoff_data);
-    
-    /* TODO: Clean up this race better... giving xinitrc time to run... need to wait for 1.5 branch:
-     *
-     * From ajax:
-     * There's already an internal callback chain for setting selection [in 1.5]
-     * ownership.  See the CallSelectionCallback at the bottom of
-     * ProcSetSelectionOwner, and xfixes/select.c for an example of how to hook
-     * into it.
-     */
-    
-    remain = 3000000;
-    fprintf(stderr, "X11.app: Received new $DISPLAY fd: %d ... sleeping to allow xinitrc to catchup.\n", launchd_fd);
-    while((remain = usleep(remain)) > 0);
-    
+        
     fprintf(stderr, "X11.app Handing off fd to server thread via DarwinListenOnOpenFD(%d)\n", launchd_fd);
     DarwinListenOnOpenFD(launchd_fd);
 }


More information about the Xquartz-changes mailing list