xserver: Branch 'xorg-server-1.4-apple' - 3 commits

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Mon Apr 28 11:47:56 PDT 2008


 hw/xquartz/X11Application.h                         |    2 
 hw/xquartz/X11Application.m                         |    7 --
 hw/xquartz/X11Controller.h                          |    2 
 hw/xquartz/X11Controller.m                          |    4 -
 hw/xquartz/bundle/English.lproj/Localizable.strings |binary
 hw/xquartz/quartz.h                                 |    1 
 hw/xquartz/quartzStartup.c                          |   50 ++++++++------------
 hw/xquartz/xpr/Makefile.am                          |    1 
 8 files changed, 29 insertions(+), 38 deletions(-)

New commits:
commit 72653c24c00dfba64ce35a3d400598bcd77defc1
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Mon Apr 28 11:47:49 2008 -0700

    XQuartz: More startup / threading house cleaning.

diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h
index 3869df9..8e7fed2 100644
--- a/hw/xquartz/X11Application.h
+++ b/hw/xquartz/X11Application.h
@@ -71,7 +71,7 @@ void X11ApplicationSetCanQuit (int state);
 void X11ApplicationServerReady (void);
 void X11ApplicationShowHideMenubar (int state);
 
-void X11ApplicationMain(int argc, const char **argv);
+void X11ApplicationMain(int argc, char **argv, char **envp);
 
 extern int X11EnableKeyEquivalents;
 extern int quartzHasRoot, quartzEnableRootless;
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 12ebe94..7a43bfc 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -47,9 +47,6 @@
 #include <mach/mach.h>
 #include <unistd.h>
 
-#include <pthread.h>
-extern pthread_cond_t server_can_start_cond;
-
 #define DEFAULTS_FILE "/usr/X11/lib/X11/xserver/Xquartz.plist"
 
 #ifndef XSERVER_VERSION
@@ -783,7 +780,7 @@ environment?", @"Startup xinitrc dialog");
     [X11App prefs_synchronize];
 }
 
-void X11ApplicationMain (int argc, const char **argv) {
+void X11ApplicationMain (int argc, char **argv, char **envp) {
     NSAutoreleasePool *pool;
 
 #ifdef DEBUG
@@ -811,7 +808,7 @@ void X11ApplicationMain (int argc, const char **argv) {
     NSMaxY([[NSScreen mainScreen] visibleFrame]);
 
     /* Tell the server thread that it can proceed */
-    pthread_cond_broadcast(&server_can_start_cond);
+    QuartzInitServer(argc, argv, envp);
 
     [NSApp run];
     /* not reached */
diff --git a/hw/xquartz/X11Controller.h b/hw/xquartz/X11Controller.h
index d33752e..7942bc4 100644
--- a/hw/xquartz/X11Controller.h
+++ b/hw/xquartz/X11Controller.h
@@ -100,6 +100,6 @@
 
 #endif /* __OBJC__ */
 
-void X11ControllerMain(int argc, const char **argv);
+void X11ControllerMain(int argc, char **argv, char **envp);
 
 #endif /* X11CONTROLLER_H */
diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m
index 01470e5..df328f3 100644
--- a/hw/xquartz/X11Controller.m
+++ b/hw/xquartz/X11Controller.m
@@ -756,6 +756,6 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
 
 @end
 
-void X11ControllerMain(int argc, const char **argv) {
-    X11ApplicationMain (argc, argv);
+void X11ControllerMain(int argc, char **argv, char **envp) {
+    X11ApplicationMain (argc, argv, envp);
 }
diff --git a/hw/xquartz/quartz.h b/hw/xquartz/quartz.h
index e116023..1b6d71f 100644
--- a/hw/xquartz/quartz.h
+++ b/hw/xquartz/quartz.h
@@ -128,6 +128,7 @@ Bool QuartzAddScreen(int index, ScreenPtr pScreen);
 Bool QuartzSetupScreen(int index, ScreenPtr pScreen);
 void QuartzInitOutput(int argc,char **argv);
 void QuartzInitInput(int argc, char **argv);
+void QuartzInitServer(int argc, char **argv, char **envp);
 void QuartzGiveUp(void);
 void QuartzProcessEvent(xEvent *xe);
 void QuartzDisplayChangedHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents);
diff --git a/hw/xquartz/quartzStartup.c b/hw/xquartz/quartzStartup.c
index d541330..7dab50b 100644
--- a/hw/xquartz/quartzStartup.c
+++ b/hw/xquartz/quartzStartup.c
@@ -64,19 +64,10 @@ struct arg {
     char **envp;
 };
 
-pthread_cond_t server_can_start_cond = PTHREAD_COND_INITIALIZER;
-
 static void server_thread (void *arg) {
-    struct arg *args = (struct arg *)arg;
-
-    /* Wait to be told we can continue */
-    pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-    pthread_mutex_lock(&mutex);
-    pthread_cond_wait(&server_can_start_cond, &mutex);
-    pthread_mutex_unlock(&mutex);
-    pthread_mutex_destroy(&mutex);
-
-    exit (dix_main(args->argc, args->argv, args->envp));
+    struct arg args = *((struct arg *)arg);
+    free(arg);
+    exit (dix_main(args.argc, args.argv, args.envp));
 }
 
 static pthread_t create_thread (void *func, void *arg) {
@@ -92,16 +83,27 @@ static pthread_t create_thread (void *func, void *arg) {
     return tid;
 }
 
+void QuartzInitServer(int argc, char **argv, char **envp) {
+    struct arg *args = (struct arg*)malloc(sizeof(struct arg));
+    if(!args)
+        FatalError("Could not allocate memory.\n");
+    
+    args->argc = argc;
+    args->argv = argv;
+    args->envp = envp;
+    
+    APPKIT_THREAD_ID = pthread_self();
+    SERVER_THREAD_ID = create_thread(server_thread, args);
+
+    if (!SERVER_THREAD_ID) {
+        FatalError("can't create secondary thread\n");
+    }
+}
+
 int main(int argc, char **argv, char **envp) {
     int         i;
     int         fd[2];
 
-    /* Store the args to pass to dix_main() */
-    struct arg  args;
-    args.argc = argc;
-    args.argv = argv;
-    args.envp = envp;
-
     // Make a pipe to pass events
     assert( pipe(fd) == 0 );
     darwinEventReadFD = fd[0];
@@ -118,18 +120,8 @@ int main(int argc, char **argv, char **envp) {
 
     /* Create the audio mutex */
     QuartzAudioInit();
-    
-    pthread_cond_init(&server_can_start_cond, NULL); 
-    
-    APPKIT_THREAD_ID = pthread_self();
-    SERVER_THREAD_ID = create_thread(server_thread, &args);
-
-    if (!SERVER_THREAD_ID) {
-        ErrorF("can't create secondary thread\n");
-        exit (1);
-    }
 
     QuartzMoveToForeground();
-    X11ControllerMain(argc, (const char **)argv);
+    X11ControllerMain(argc, argv, envp);
     exit(0);
 }
commit d8d9c866b90fb24c93bd6e25fa90f8f2bf58ad34
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Mon Apr 28 10:50:51 2008 -0700

    XQuartz: Updated Localizable.strings

diff --git a/hw/xquartz/bundle/English.lproj/Localizable.strings b/hw/xquartz/bundle/English.lproj/Localizable.strings
index c83b085..63a1352 100644
Binary files a/hw/xquartz/bundle/English.lproj/Localizable.strings and b/hw/xquartz/bundle/English.lproj/Localizable.strings differ
commit 03e707987f7f32e47dd0355c6d16bfb9169a379b
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Sun Apr 27 00:01:14 2008 -0700

    XQuartz: Added missing Xquartz.man.pre to EXTRA_DIST

diff --git a/hw/xquartz/xpr/Makefile.am b/hw/xquartz/xpr/Makefile.am
index 12009fb..41f2b86 100644
--- a/hw/xquartz/xpr/Makefile.am
+++ b/hw/xquartz/xpr/Makefile.am
@@ -47,6 +47,7 @@ include $(top_srcdir)/cpprules.in
 	cp $< $@
 
 EXTRA_DIST = \
+	Xquartz.man.pre \
 	dri.h \
 	dristruct.h \
 	appledri.h \


More information about the xorg-commit mailing list