xserver: Branch 'xorg-server-1.5-apple' - 5 commits

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Fri Nov 21 10:59:50 PST 2008


 hw/xquartz/X11Controller.m   |   11 +++++++++--
 hw/xquartz/darwin.c          |    4 ++--
 hw/xquartz/darwin.h          |    4 ++--
 hw/xquartz/pbproxy/main.m    |    2 --
 hw/xquartz/pbproxy/pbproxy.h |   11 +++++++++++
 hw/xquartz/pbproxy/x-input.m |   33 ++++++++++++++++++++++++++++++++-
 hw/xquartz/quartzAudio.c     |    5 +++++
 hw/xquartz/quartzKeyboard.c  |    8 ++++++--
 hw/xquartz/threadSafety.c    |   12 ++++++++++--
 9 files changed, 77 insertions(+), 13 deletions(-)

New commits:
commit bf699f0ae7a27711f21e5371e76918b0cc4234b5
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Fri Nov 21 10:57:31 2008 -0800

    XQuartz: spewCallStack is noop on Tiger now...
    (cherry picked from commit 56c469a68b92c6cf003802f418ea00bd596a41c3)

diff --git a/hw/xquartz/threadSafety.c b/hw/xquartz/threadSafety.c
index b5a4ecf..85f85bd 100644
--- a/hw/xquartz/threadSafety.c
+++ b/hw/xquartz/threadSafety.c
@@ -31,11 +31,14 @@
 #include "threadSafety.h"
 #include "os.h"
 
-#include <execinfo.h>
-
 pthread_t APPKIT_THREAD_ID;
 pthread_t SERVER_THREAD_ID;
 
+#include <AvailabilityMacros.h>
+
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
+#include <execinfo.h>
+
 void spewCallStack(void) {
     void* callstack[128];
     int i, frames = backtrace(callstack, 128);
@@ -47,6 +50,11 @@ void spewCallStack(void) {
     
     free(strs);
 }
+#else
+void spewCallStack(void) {
+	return;
+}
+#endif
 
 void _threadSafetyAssert(pthread_t tid, const char *file, const char *fun, int line) {
     if(pthread_equal(pthread_self(), tid))
commit c589c30e379f3f427e4bf7c2cd5aae28217ec097
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Fri Nov 21 10:54:55 2008 -0800

    XQuartz: pbproxy: Added some typedefs for types not available on Tiger
    (cherry picked from commit 0947aa7911f1de44bfe16e505a757b659c5ab2a8)

diff --git a/hw/xquartz/pbproxy/pbproxy.h b/hw/xquartz/pbproxy/pbproxy.h
index c8321b3..eb1f3ba 100644
--- a/hw/xquartz/pbproxy/pbproxy.h
+++ b/hw/xquartz/pbproxy/pbproxy.h
@@ -32,6 +32,17 @@
 
 #import  <Foundation/Foundation.h>
 
+#include <AvailabilityMacros.h>
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+#if __LP64__ || NS_BUILD_32_LIKE_64
+typedef long NSInteger;
+typedef unsigned long NSUInteger;
+#else
+typedef int NSInteger;
+typedef unsigned int NSUInteger;
+#endif
+#endif
+
 #define  Cursor X_Cursor
 #undef _SHAPE_H_
 #include <X11/Xlib.h>
commit fc01b09acf8f0904f37e9fbc4796acdaa7dbbadf
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Fri Nov 21 10:53:39 2008 -0800

    XQuartz: More Tiger ifdefs
    (cherry picked from commit 803509072f2c039e5cd555c4ac14d672f0e698c5)

diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m
index 2668e1e..76fbb57 100644
--- a/hw/xquartz/X11Controller.m
+++ b/hw/xquartz/X11Controller.m
@@ -28,6 +28,7 @@
    prior written authorization. */
 
 #include "sanitizedCarbon.h"
+#include <AvailabilityMacros.h>
 
 #ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
@@ -152,8 +153,11 @@
 
       item = (NSMenuItem *) [menu addItemWithTitle:name action:@selector
 				  (item_selected:) keyEquivalent:shortcut];
-
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
       [item setKeyEquivalentModifierMask:(NSUInteger) windowItemModMask];
+#else
+      [item setKeyEquivalentModifierMask:windowItemModMask];
+#endif
       [item setTarget:self];
       [item setTag:i];
       [item setEnabled:YES];
@@ -162,8 +166,11 @@
 				       action:@selector
 				       (item_selected:) keyEquivalent:shortcut
 				       atIndex:i];
-
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
       [item setKeyEquivalentModifierMask:(NSUInteger) windowItemModMask];
+#else
+      [item setKeyEquivalentModifierMask:windowItemModMask];
+#endif
       [item setTarget:self];
       [item setTag:i];
       [item setEnabled:YES];
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 547698c..daf56bf 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -115,10 +115,10 @@ int                     darwinFakeMouse3Mask = NX_COMMANDMASK;
 #endif
 
 // Modifier mask for overriding event delivery to appkit (might be useful to set this to rcommand for input menu
-int                     darwinAppKitModMask = 0; // Any of these bits
+unsigned int            darwinAppKitModMask = 0; // Any of these bits
 
 // Modifier mask for items in the Window menu (0 and -1 cause shortcuts to be disabled)
-int                     windowItemModMask = NX_COMMANDMASK;
+unsigned int            windowItemModMask = NX_COMMANDMASK;
 
 // devices
 DeviceIntPtr            darwinKeyboard = NULL;
diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h
index da5ad74..7fb9396 100644
--- a/hw/xquartz/darwin.h
+++ b/hw/xquartz/darwin.h
@@ -82,8 +82,8 @@ extern int              darwinMouseAccelChange;
 extern int              darwinFakeButtons;
 extern int              darwinFakeMouse2Mask;
 extern int              darwinFakeMouse3Mask;
-extern int              darwinAppKitModMask;
-extern int              windowItemModMask;
+extern unsigned int     darwinAppKitModMask;
+extern unsigned int     windowItemModMask;
 extern int              darwinSyncKeymap;
 extern unsigned int     darwinDesiredWidth, darwinDesiredHeight;
 extern int              darwinDesiredDepth;
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 2eb5fee..9aa9ece 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -753,6 +753,11 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
     }
 #endif
 
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
+    if(currentKeyLayoutRef)
+        CFRelease(currentKeyLayoutRef);
+#endif
+    
     if (chr_data == NULL) {
       ErrorF ( "Couldn't get uchr or kchr resource\n");
       return FALSE;
@@ -856,7 +861,6 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
                 k[0] = known_numeric_keys[i].keypad;
         }
     }
-    if(currentKeyLayoutRef)	CFRelease(currentKeyLayoutRef);
-    
+
     return TRUE;
 }
commit d03f4b176431a88aa26aaf0d4f4892e095fb3e99
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Fri Nov 21 10:44:11 2008 -0800

    XQuartz: Resurrect the old audio path for Tiger
    (cherry picked from commit a61a8d9047e8765faf3892f4f2148c8553fd192c)

diff --git a/hw/xquartz/quartzAudio.c b/hw/xquartz/quartzAudio.c
index ac9f820..2123266 100644
--- a/hw/xquartz/quartzAudio.c
+++ b/hw/xquartz/quartzAudio.c
@@ -47,6 +47,7 @@
 
 #include <CoreAudio/CoreAudio.h>
 #include <pthread.h>
+#include <AvailabilityMacros.h>
 
 #include "inputstr.h"
 #include <X11/extensions/XI.h>
@@ -337,8 +338,12 @@ void QuartzAudioInit(void)
     // fixme assert fadeLength<framesPerBuffer
 
     // Prepare for playback
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
     AudioDeviceIOProcID sInputIOProcID = NULL;
     status = AudioDeviceCreateIOProcID( outputDevice, QuartzAudioIOProc, &data, &sInputIOProcID );
+#else
+    status = AudioDeviceAddIOProc(outputDevice, QuartzAudioIOProc, &data);
+#endif
     if (status) {
         ErrorF("QuartzAudioInit: AddIOProc returned %ld\n", (long)status);
         return;
commit fc4426650279ac5fb61a9cc7b4b40b489c6ec350
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Wed Nov 19 11:42:59 2008 -0800

    XQuartz: pbproxy: Push the pbproxy Xevent processing into its own thread
    and just have the AppKit thread wake it up.
    (cherry picked from commit 799715b8f3327c8da59ab45706e85af2d2c438e4)

diff --git a/hw/xquartz/pbproxy/main.m b/hw/xquartz/pbproxy/main.m
index e23956e..efa42e3 100644
--- a/hw/xquartz/pbproxy/main.m
+++ b/hw/xquartz/pbproxy/main.m
@@ -97,8 +97,6 @@ BOOL xpbproxy_init (void) {
         return FALSE;
     }
 
-    xpbproxy_input_run();
-
     [pool release];
     
     return TRUE;
diff --git a/hw/xquartz/pbproxy/x-input.m b/hw/xquartz/pbproxy/x-input.m
index a03240f..ca7c30d 100644
--- a/hw/xquartz/pbproxy/x-input.m
+++ b/hw/xquartz/pbproxy/x-input.m
@@ -39,12 +39,39 @@
 
 #include <unistd.h>
 
+#include <pthread.h>
+
 static CFRunLoopSourceRef xpbproxy_dpy_source;
 
 #ifdef STANDALONE_XPBPROXY
 BOOL xpbproxy_prefs_reload = NO;
 #endif
 
+static pthread_mutex_t xpbproxy_dpy_lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_cond_t xpbproxy_dpy_cond = PTHREAD_COND_INITIALIZER;
+
+static inline pthread_t create_thread(void *func, void *arg) {
+    pthread_attr_t attr;
+    pthread_t tid;
+    
+    pthread_attr_init(&attr);
+    pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
+    pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+    pthread_create(&tid, &attr, func, arg);
+    pthread_attr_destroy(&attr);
+    
+    return tid;
+}
+
+static void *xpbproxy_input_thread(void *args) {
+    pthread_mutex_lock(&xpbproxy_dpy_lock);
+    while(true) {
+        xpbproxy_input_run();
+        pthread_cond_wait(&xpbproxy_dpy_cond, &xpbproxy_dpy_lock);
+    }
+}
+
+
 /* Timestamp when the X server last told us it's active */
 static Time last_activation_time;
 
@@ -164,10 +191,14 @@ static void x_input_callback (CFSocketRef sock, CFSocketCallBackType type,
     }
 #endif
 
-    xpbproxy_input_run();
+    pthread_mutex_lock(&xpbproxy_dpy_lock);
+    pthread_cond_broadcast(&xpbproxy_dpy_cond);
+    pthread_mutex_unlock(&xpbproxy_dpy_lock);
 }
 
 BOOL xpbproxy_input_register(void) {
+    create_thread(xpbproxy_input_thread, NULL);
+
     return add_input_socket(ConnectionNumber(xpbproxy_dpy), kCFSocketReadCallBack,
                             x_input_callback, NULL, &xpbproxy_dpy_source);
 }


More information about the xorg-commit mailing list