diff options
author | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-08-05 12:54:51 -0700 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-08-05 12:54:51 -0700 |
commit | 30851efdd4313506e92aeb6d3e5099dea99ab99c (patch) | |
tree | ec155a0a1a7a045b1426a9212e2e1f8d358ff7b3 /hw | |
parent | 277a74bcbb7d0a93c4f2e1de11daabd8c5f93ee8 (diff) |
XQuartz: Fixed first-client-can't-connect bug
Readded the old exec() server startup path for regression testing.
Don't use the dynamic fd addition code since it's not quite working correctly.
(cherry picked from commit 08f3fe153edc5ab4ca010e8ce82d5c3fc0ddb72c)
Diffstat (limited to 'hw')
-rw-r--r-- | hw/xquartz/X11Application.m | 6 | ||||
-rw-r--r-- | hw/xquartz/darwinEvents.c | 6 | ||||
-rw-r--r-- | hw/xquartz/mach-startup/Makefile.am | 5 | ||||
-rw-r--r-- | hw/xquartz/mach-startup/bundle-main.c | 28 | ||||
-rw-r--r-- | hw/xquartz/mach-startup/stub.c | 13 |
5 files changed, 46 insertions, 12 deletions
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index 1f90b240c..c6c9c59ab 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -202,12 +202,6 @@ static void message_kit_thread (SEL selector, NSObject *arg) { for_appkit = YES; for_x = YES; -// fprintf(stderr, "fd_add_count: %d\n", fd_add_count); - if(fd_add_count) { - DarwinProcessFDAdditionQueue(); - fprintf(stderr, "ran it - fd_add_count: %d\n", fd_add_count); - } - switch (type) { case NSLeftMouseDown: case NSRightMouseDown: case NSOtherMouseDown: case NSLeftMouseUp: case NSRightMouseUp: case NSOtherMouseUp: diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c index 900ee4387..da10e208e 100644 --- a/hw/xquartz/darwinEvents.c +++ b/hw/xquartz/darwinEvents.c @@ -327,9 +327,12 @@ static void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, in } } +int xquartz_launchd_fd = -1; + void DarwinListenOnOpenFD(int fd) { ErrorF("DarwinListenOnOpenFD: %d\n", fd); +#if 0 pthread_mutex_lock(&fd_add_lock); if(fd_add_count < FD_ADD_MAX) fd_add[fd_add_count++] = fd; @@ -337,6 +340,9 @@ void DarwinListenOnOpenFD(int fd) { ErrorF("FD Addition buffer at max. Dropping fd addition request.\n"); pthread_mutex_unlock(&fd_add_lock); +#else + xquartz_launchd_fd = fd; +#endif } void DarwinProcessFDAdditionQueue() { diff --git a/hw/xquartz/mach-startup/Makefile.am b/hw/xquartz/mach-startup/Makefile.am index 2da30625f..9b2619dd9 100644 --- a/hw/xquartz/mach-startup/Makefile.am +++ b/hw/xquartz/mach-startup/Makefile.am @@ -1,12 +1,13 @@ AM_CPPFLAGS = \ -DBUILD_DATE=\"$(BUILD_DATE)\" \ - -DXSERVER_VERSION=\"$(VERSION)\" + -DXSERVER_VERSION=\"$(VERSION)\" \ + -DMACHO_STARTUP x11appdir = $(APPLE_APPLICATIONS_DIR)/X11.app/Contents/MacOS x11app_PROGRAMS = X11 dist_X11_SOURCES = \ - bundle-main.c + bundle-main.c # launchd_fd.c nodist_X11_SOURCES = \ diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c index 9894ae8b2..7c4d52cc5 100644 --- a/hw/xquartz/mach-startup/bundle-main.c +++ b/hw/xquartz/mach-startup/bundle-main.c @@ -82,6 +82,7 @@ static pthread_t create_thread(void *func, void *arg) { return tid; } +#ifdef MACHO_STARTUP /*** Mach-O IPC Stuffs ***/ union MaxMsgSize { @@ -293,13 +294,18 @@ kern_return_t do_start_x11_server(mach_port_t port, string_array_t argv, } int startup_trigger(int argc, char **argv, char **envp) { +#else +void *add_launchd_display_thread(void *data); + +int main(int argc, char **argv, char **envp) { +#endif Display *display; const char *s; - size_t i; - /* Take care of the case where we're called like a normal DDX */ if(argc > 1 && argv[1][0] == ':') { +#ifdef MACHO_STARTUP + size_t i; kern_return_t kr; mach_port_t mp; string_array_t newenvp; @@ -339,6 +345,10 @@ int startup_trigger(int argc, char **argv, char **envp) { exit(EXIT_FAILURE); } exit(EXIT_SUCCESS); +#else + create_thread(add_launchd_display_thread, NULL); + return server_main(argc, argv, envp); +#endif } /* If we have a process serial number and it's our only arg, act as if @@ -368,6 +378,7 @@ int startup_trigger(int argc, char **argv, char **envp) { return execute(command_from_prefs("startx_script", DEFAULT_STARTX)); } +#ifdef MACHO_STARTUP /*** Main ***/ int main(int argc, char **argv, char **envp) { Bool listenOnly = FALSE; @@ -412,6 +423,17 @@ int main(int argc, char **argv, char **envp) { return EXIT_SUCCESS; } +#else + +void *add_launchd_display_thread(void *data) { + /* Start listening on the launchd fd */ + int launchd_fd = launchd_display_fd(); + if(launchd_fd != -1) { + DarwinListenOnOpenFD(launchd_fd); + } + return NULL; +} +#endif static int execute(const char *command) { const char *newargv[7]; @@ -427,7 +449,7 @@ static int execute(const char *command) { fprintf(stderr, "X11.app: Launching %s:\n", command); for(s=newargv; *s; s++) { - fprintf(stderr, "\targv[%d] = %s\n", s - newargv, *s); + fprintf(stderr, "\targv[%ld] = %s\n", (long int)(s - newargv), *s); } execvp (newargv[0], (char * const *) newargv); diff --git a/hw/xquartz/mach-startup/stub.c b/hw/xquartz/mach-startup/stub.c index 9928aa9ae..003c4dd28 100644 --- a/hw/xquartz/mach-startup/stub.c +++ b/hw/xquartz/mach-startup/stub.c @@ -115,6 +115,7 @@ static void set_x11_path() { } } +#ifdef MACHO_STARTUP static int create_socket(char *filename_out) { struct sockaddr_un servaddr_un; struct sockaddr *servaddr; @@ -218,7 +219,10 @@ static void send_fd_handoff(int handoff_fd, int launchd_fd) { #endif } +#endif + int main(int argc, char **argv, char **envp) { +#ifdef MACHO_STARTUP int envpc; kern_return_t kr; mach_port_t mp; @@ -227,6 +231,7 @@ int main(int argc, char **argv, char **envp) { size_t i; int launchd_fd; string_t handoff_socket_filename; +#endif sig_t handler; if(argc == 2 && !strcmp(argv[1], "-version")) { @@ -244,7 +249,8 @@ int main(int argc, char **argv, char **envp) { if(handler == SIG_IGN) kill(getppid(), SIGUSR1); signal(SIGUSR1, handler); - + +#ifdef MACHO_STARTUP /* Get the $DISPLAY FD */ launchd_fd = launchd_display_fd(); @@ -325,4 +331,9 @@ int main(int argc, char **argv, char **envp) { return EXIT_FAILURE; } return EXIT_SUCCESS; +#else + set_x11_path(); + argv[0] = x11_path; + return execvp(x11_path, argv); +#endif } |