[Xquartz-changes] xserver: Branch 'master' - 29 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Sun Apr 24 20:04:12 PDT 2011


Rebased ref, commits from common ancestor:
commit 83f03de1e4504660b6688af7f1c643e71394da6d
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Apr 23 23:22:27 2011 -0700

    XQuartz: Silence clang static analyzer
    
    Call to 'malloc' has an allocation size of 0 bytes.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/mach-startup/stub.c b/hw/xquartz/mach-startup/stub.c
index ccf5ab4..1804560 100644
--- a/hw/xquartz/mach-startup/stub.c
+++ b/hw/xquartz/mach-startup/stub.c
@@ -300,8 +300,8 @@ int main(int argc, char **argv, char **envp) {
     /* We have fixed-size string lengths due to limitations in IPC,
      * so we need to copy our argv and envp.
      */
-    newargv = (string_array_t)malloc(argc * sizeof(string_t));
-    newenvp = (string_array_t)malloc(envpc * sizeof(string_t));
+    newargv = (string_array_t)calloc((1 + argc), sizeof(string_t));
+    newenvp = (string_array_t)calloc((1 + envpc), sizeof(string_t));
 
     if(!newargv || !newenvp) {
         fprintf(stderr, "Xquartz: Memory allocation failure\n");
commit 744089b2f077910f1ee4967fc177263669073c72
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Apr 23 23:15:49 2011 -0700

    XQuartz: xpr: Dead code removal
    
    Assigned value is always the same as the existing value.
    
    Found by clang static analyzer
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/xpr/dri.c b/hw/xquartz/xpr/dri.c
index 3474d27..8fef3b7 100644
--- a/hw/xquartz/xpr/dri.c
+++ b/hw/xquartz/xpr/dri.c
@@ -562,7 +562,6 @@ DRIWindowExposures(WindowPtr pWin, RegionPtr prgn, RegionPtr bsreg)
 
     (*pScreen->WindowExposures)(pWin, prgn, bsreg);
 
-    pDRIPriv->wrap.WindowExposures = pScreen->WindowExposures;
     pScreen->WindowExposures = DRIWindowExposures;
 }
 
@@ -587,7 +586,6 @@ DRICopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
     (*pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc);
 
     /* rewrap */
-    pDRIPriv->wrap.CopyWindow = pScreen->CopyWindow;
     pScreen->CopyWindow = DRICopyWindow;
 }
 
@@ -605,7 +603,6 @@ DRIValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind)
     returnValue = (*pScreen->ValidateTree)(pParent, pChild, kind);
 
     /* rewrap */
-    pDRIPriv->wrap.ValidateTree = pScreen->ValidateTree;
     pScreen->ValidateTree = DRIValidateTree;
 
     return returnValue;
@@ -632,7 +629,6 @@ DRIPostValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind)
         (*pScreen->PostValidateTree)(pParent, pChild, kind);
 
         /* rewrap */
-        pDRIPriv->wrap.PostValidateTree = pScreen->PostValidateTree;
         pScreen->PostValidateTree = DRIPostValidateTree;
     }
 }
@@ -653,7 +649,6 @@ DRIClipNotify(WindowPtr pWin, int dx, int dy)
 
         (*pScreen->ClipNotify)(pWin, dx, dy);
 
-        pDRIPriv->wrap.ClipNotify = pScreen->ClipNotify;
         pScreen->ClipNotify = DRIClipNotify;
     }
 }
commit 9f9bbcce8b772bcf5a9cd2ede57968b1a8c27ab3
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Apr 23 20:12:38 2011 -0700

    XQuartz: Silence warnings about deprecated functionality where it is an intended fallback
    
    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 6a6c01c..d70cfd4 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -144,7 +144,15 @@ static mach_port_t checkin_or_register(char *bname) {
         exit(EXIT_FAILURE);
     }
 
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations" // bootstrap_register
+#endif
     kr = bootstrap_register(bootstrap_port, bname, mp);
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
     if (kr != KERN_SUCCESS) {
         fprintf(stderr, "bootstrap_register(): %s\n", mach_error_string(kr));
         exit(EXIT_FAILURE);
diff --git a/hw/xquartz/pbproxy/x-selection.m b/hw/xquartz/pbproxy/x-selection.m
index ef84f8b..e3d5113 100644
--- a/hw/xquartz/pbproxy/x-selection.m
+++ b/hw/xquartz/pbproxy/x-selection.m
@@ -625,6 +625,10 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
 	/* TODO add the NSPICTPboardType back again, once we have conversion
 	 * functionality in send_image.
 	 */
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations" // NSPICTPboardType
+#endif
 
 	if ([pbtypes containsObject:NSPICTPboardType] 
 	    || [pbtypes containsObject:NSTIFFPboardType]) 
@@ -637,6 +641,10 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
 	    ++count;
 	} 
 
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
 	if (count)
 	{
 	    /* We have a list of ATOMs to send. */
@@ -925,7 +933,14 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
 	    if (NO == [self send_image_tiff_reply:e pasteboard:pb type:imagetype]) 
 	  	return;
 	} 
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations" // NSPICTPboardType
+#endif
      	else if ([pbtypes containsObject:NSPICTPboardType])
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
 	{
 	    if (NO == [self send_image_pict_reply:e pasteboard:pb type:imagetype]) 
 		return;
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 3ab5d52..af12de4 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -684,6 +684,11 @@ static Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
     }
 #endif
 
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations" // KLGetCurrentKeyboardLayout, KLGetKeyboardLayoutProperty
+#endif
+
 #if !defined(__LP64__) || MAC_OS_X_VERSION_MIN_REQUIRED < 1050
     if (chr_data == NULL) {
 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
@@ -717,6 +722,10 @@ static Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
     }
 #endif
 
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
     if(currentKeyLayoutRef)
         CFRelease(currentKeyLayoutRef);
@@ -773,10 +782,16 @@ static Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
                 }
 #if !defined(__LP64__) || MAC_OS_X_VERSION_MIN_REQUIRED < 1050
             } else { // kchr
-	      UInt32 c, state = 0, state2 = 0;
+                UInt32 c, state = 0, state2 = 0;
                 UInt16 code;
 
                 code = i | mods[j];
+
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations" // KeyTranslate
+#endif
+
                 c = KeyTranslate (chr_data, code, &state);
 
                 /* Dead keys are only processed on key-down, so ask
@@ -787,6 +802,10 @@ static Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
                 if (state != 0)
                     c = KeyTranslate (chr_data, code | 128, &state2);
 
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
                 /* Characters seem to be in MacRoman encoding. */
 
                 if (c != 0 && c != 0x0010) {
commit 4b0927a06c221c4aa2ffcaee48f0c9041328b0ea
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Apr 23 12:55:39 2011 -0700

    XQuartz: xpr: Use a serial queue rather than pthread mutexes for window_hash
    
    Additionally removes some dead code and fixes double-locking in
    xprIsX11Window.  xprIsX11Window doesn't need to do any locking because
    those resources are protected by the called functions themselves.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Daniel A. Steffen <dsteffen at apple.com>

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 83b5601..6f89437 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -236,8 +236,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
                 
                 if ([self isActive]) {
                     [self deactivate];
-                    if (!_x_active && quartzProcs->IsX11Window([e window],
-                                                               [e windowNumber]))
+                    if (!_x_active && quartzProcs->IsX11Window([e windowNumber]))
                         [self activateX:YES];
                 }
             }
diff --git a/hw/xquartz/quartz.h b/hw/xquartz/quartz.h
index 67a7919..0a9c47a 100644
--- a/hw/xquartz/quartz.h
+++ b/hw/xquartz/quartz.h
@@ -70,7 +70,7 @@ typedef void (*UpdateScreenProc)(ScreenPtr pScreen);
 /*
  * Rootless helper functions
  */
-typedef Bool (*IsX11WindowProc)(void *nsWindow, int windowNumber);
+typedef Bool (*IsX11WindowProc)(int windowNumber);
 typedef void (*HideWindowsProc)(Bool hide);
 
 /*
diff --git a/hw/xquartz/xpr/xpr.h b/hw/xquartz/xpr/xpr.h
index af1a90c..ebd89de 100644
--- a/hw/xquartz/xpr/xpr.h
+++ b/hw/xquartz/xpr/xpr.h
@@ -38,7 +38,7 @@ Bool QuartzModeBundleInit(void);
 void AppleDRIExtensionInit(void);
 void xprAppleWMInit(void);
 Bool xprInit(ScreenPtr pScreen);
-Bool xprIsX11Window(void *nsWindow, int windowNumber);
+Bool xprIsX11Window(int windowNumber);
 WindowPtr xprGetXWindow(xp_window_id wid);
 
 void xprHideWindows(Bool hide);
diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c
index f0e9a89..066cc0f 100644
--- a/hw/xquartz/xpr/xprFrame.c
+++ b/hw/xquartz/xpr/xprFrame.c
@@ -43,7 +43,11 @@
 #include "windowstr.h"
 #include "quartz.h"
 
+#ifdef HAVE_LIBDISPATCH
+#include <dispatch/dispatch.h>
+#else
 #include <pthread.h>
+#endif
 
 #define DEFINE_ATOM_HELPER(func,atom_name)                      \
 static Atom func (void) {                                       \
@@ -61,10 +65,12 @@ DEFINE_ATOM_HELPER(xa_native_window_id, "_NATIVE_WINDOW_ID")
 /* Maps xp_window_id -> RootlessWindowRec */
 static x_hash_table *window_hash;
 
-/* Need to guard window_hash since xprGetXWindowFromAppKit and xprIsX11Window
- * can be called from any thread.
- */
+/* Need to guard window_hash since xprIsX11Window can be called from any thread. */
+#ifdef HAVE_LIBDISPATCH
+static dispatch_queue_t window_hash_serial_q;
+#else
 static pthread_mutex_t window_hash_mutex;
+#endif
 
 /* Prototypes for static functions */
 static Bool xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
@@ -181,9 +187,15 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
         return FALSE;
     }
 
+#ifdef HAVE_LIBDISPATCH
+    dispatch_async(window_hash_serial_q, ^{
+        x_hash_table_insert(window_hash, pFrame->wid, pFrame);
+    });
+#else
     pthread_mutex_lock(&window_hash_mutex);
     x_hash_table_insert(window_hash, pFrame->wid, pFrame);
     pthread_mutex_unlock(&window_hash_mutex);
+#endif
 
     xprSetNativeProperty(pFrame);
 
@@ -199,9 +211,15 @@ xprDestroyFrame(RootlessFrameID wid)
 {
     xp_error err;
 
+#ifdef HAVE_LIBDISPATCH
+    dispatch_async(window_hash_serial_q, ^{
+        x_hash_table_remove(window_hash, wid);
+    });
+#else
     pthread_mutex_lock(&window_hash_mutex);
     x_hash_table_remove(window_hash, wid);
     pthread_mutex_unlock(&window_hash_mutex);
+#endif
 
     err = xp_destroy_window(x_cvt_vptr_to_uint(wid));
     if (err != Success)
@@ -253,6 +271,9 @@ xprResizeFrame(RootlessFrameID wid, ScreenPtr pScreen,
 static void xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) {
     xp_window_changes wc;
     unsigned int mask = XP_STACKING;
+#ifdef HAVE_LIBDISPATCH
+    __block
+#endif
     RootlessWindowRec *winRec;
 
     /* Stack frame below nextWid it if it exists, or raise
@@ -266,8 +287,16 @@ static void xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) {
         wc.sibling = x_cvt_vptr_to_uint(nextWid);
     }
 
+#ifdef HAVE_LIBDISPATCH
+    dispatch_sync(window_hash_serial_q, ^{
+        winRec = x_hash_table_lookup(window_hash, wid, NULL);
+    });
+#else
+    pthread_mutex_lock(&window_hash_mutex);
     winRec = x_hash_table_lookup(window_hash, wid, NULL);
-
+    pthread_mutex_unlock(&window_hash_mutex);
+#endif
+    
     if(winRec) {
         if(XQuartzIsRootless)
             wc.window_level = normal_window_levels[winRec->level];
@@ -447,8 +476,12 @@ xprInit(ScreenPtr pScreen)
     rootless_CopyWindow_threshold = xp_scroll_area_threshold;
 
     assert((window_hash = x_hash_table_new(NULL, NULL, NULL, NULL)));
+#ifdef HAVE_LIBDISPATCH
+    assert((window_hash_serial_q = dispatch_queue_create(LAUNCHD_ID_PREFIX".X11.xpr_window_hash", NULL)));
+#else
     assert(0 == pthread_mutex_init(&window_hash_mutex, NULL));
-
+#endif
+    
     return TRUE;
 }
 
@@ -460,60 +493,36 @@ xprInit(ScreenPtr pScreen)
 WindowPtr
 xprGetXWindow(xp_window_id wid)
 {
+#ifdef HAVE_LIBDISPATCH
+    RootlessWindowRec *winRec __block;
+    dispatch_sync(window_hash_serial_q, ^{
+        winRec = x_hash_table_lookup(window_hash, x_cvt_uint_to_vptr(wid), NULL);
+    });
+#else
     RootlessWindowRec *winRec;
-
-    winRec = x_hash_table_lookup(window_hash, x_cvt_uint_to_vptr(wid), NULL);
-
-    return winRec != NULL ? winRec->win : NULL;
-}
-
-#ifdef UNUSED_CODE
-/*
- * Given the id of a physical window, try to find the top-level (or root)
- * X window that it represents.
- */
-WindowPtr
-xprGetXWindowFromAppKit(int windowNumber)
-{
-    RootlessWindowRec *winRec;
-    Bool ret;
-    xp_window_id wid;
-
     pthread_mutex_lock(&window_hash_mutex);
-
-    if (xp_lookup_native_window(windowNumber, &wid))
-        ret = xprGetXWindow(wid) != NULL;
-    else
-        ret = FALSE;
-
-    pthread_mutex_unlock(&window_hash_mutex);
-
-    if (!ret) return NULL;
     winRec = x_hash_table_lookup(window_hash, x_cvt_uint_to_vptr(wid), NULL);
+    pthread_mutex_unlock(&window_hash_mutex);
+#endif
 
     return winRec != NULL ? winRec->win : NULL;
 }
-#endif
 
 /*
  * The windowNumber is an AppKit window number. Returns TRUE if xpr is
  * displaying a window with that number.
  */
 Bool
-xprIsX11Window(void *nsWindow, int windowNumber)
+xprIsX11Window(int windowNumber)
 {
     Bool ret;
     xp_window_id wid;
 
-    pthread_mutex_lock(&window_hash_mutex);
-
     if (xp_lookup_native_window(windowNumber, &wid))
         ret = xprGetXWindow(wid) != NULL;
     else
         ret = FALSE;
 
-    pthread_mutex_unlock(&window_hash_mutex);
-
     return ret;
 }
 
commit 388734b8ad54d0d7c414c61215a898d83d99d824
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Apr 23 12:11:39 2011 -0700

    XQuartz: xpr: Initialize window_hash in xprInit
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c
index efb3737..f0e9a89 100644
--- a/hw/xquartz/xpr/xprFrame.c
+++ b/hw/xquartz/xpr/xprFrame.c
@@ -1,7 +1,7 @@
 /*
  * Xplugin rootless implementation frame functions
  *
- * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2002-2011 Apple Computer, Inc. All rights reserved.
  * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -35,7 +35,6 @@
 #include "rootlessCommon.h"
 #include <Xplugin.h>
 #include "x-hash.h"
-#include "x-list.h"
 #include "applewmExt.h"
 
 #include "propertyst.h"
@@ -61,6 +60,10 @@ DEFINE_ATOM_HELPER(xa_native_window_id, "_NATIVE_WINDOW_ID")
 
 /* Maps xp_window_id -> RootlessWindowRec */
 static x_hash_table *window_hash;
+
+/* Need to guard window_hash since xprGetXWindowFromAppKit and xprIsX11Window
+ * can be called from any thread.
+ */
 static pthread_mutex_t window_hash_mutex;
 
 /* Prototypes for static functions */
@@ -178,12 +181,6 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
         return FALSE;
     }
 
-    if (window_hash == NULL)
-    {
-        window_hash = x_hash_table_new(NULL, NULL, NULL, NULL);
-        pthread_mutex_init(&window_hash_mutex, NULL);
-    }
-
     pthread_mutex_lock(&window_hash_mutex);
     x_hash_table_insert(window_hash, pFrame->wid, pFrame);
     pthread_mutex_unlock(&window_hash_mutex);
@@ -256,6 +253,7 @@ xprResizeFrame(RootlessFrameID wid, ScreenPtr pScreen,
 static void xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) {
     xp_window_changes wc;
     unsigned int mask = XP_STACKING;
+    RootlessWindowRec *winRec;
 
     /* Stack frame below nextWid it if it exists, or raise
        frame above everything otherwise. */
@@ -268,18 +266,16 @@ static void xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) {
         wc.sibling = x_cvt_vptr_to_uint(nextWid);
     }
 
-    if(window_hash) {
-        RootlessWindowRec *winRec = x_hash_table_lookup(window_hash, wid, NULL);
-
-        if(winRec) {
-            if(XQuartzIsRootless)
-                wc.window_level = normal_window_levels[winRec->level];
-            else if(XQuartzShieldingWindowLevel)
-                wc.window_level = XQuartzShieldingWindowLevel + 1;
-            else
-                wc.window_level = rooted_window_levels[winRec->level];
-            mask |= XP_WINDOW_LEVEL;
-        }
+    winRec = x_hash_table_lookup(window_hash, wid, NULL);
+
+    if(winRec) {
+        if(XQuartzIsRootless)
+            wc.window_level = normal_window_levels[winRec->level];
+        else if(XQuartzShieldingWindowLevel)
+            wc.window_level = XQuartzShieldingWindowLevel + 1;
+        else
+            wc.window_level = rooted_window_levels[winRec->level];
+        mask |= XP_WINDOW_LEVEL;
     }
 
     xprConfigureWindow(x_cvt_vptr_to_uint(wid), mask, &wc);
@@ -450,6 +446,9 @@ xprInit(ScreenPtr pScreen)
     rootless_CopyBytes_threshold = xp_copy_bytes_threshold;
     rootless_CopyWindow_threshold = xp_scroll_area_threshold;
 
+    assert((window_hash = x_hash_table_new(NULL, NULL, NULL, NULL)));
+    assert(0 == pthread_mutex_init(&window_hash_mutex, NULL));
+
     return TRUE;
 }
 
@@ -463,9 +462,6 @@ xprGetXWindow(xp_window_id wid)
 {
     RootlessWindowRec *winRec;
 
-    if (window_hash == NULL)
-        return NULL;
-
     winRec = x_hash_table_lookup(window_hash, x_cvt_uint_to_vptr(wid), NULL);
 
     return winRec != NULL ? winRec->win : NULL;
@@ -483,11 +479,6 @@ xprGetXWindowFromAppKit(int windowNumber)
     Bool ret;
     xp_window_id wid;
 
-    if (window_hash == NULL)
-        return FALSE;
-
-    /* need to lock, since this function can be called by any thread */
-
     pthread_mutex_lock(&window_hash_mutex);
 
     if (xp_lookup_native_window(windowNumber, &wid))
@@ -514,11 +505,6 @@ xprIsX11Window(void *nsWindow, int windowNumber)
     Bool ret;
     xp_window_id wid;
 
-    if (window_hash == NULL)
-        return FALSE;
-
-    /* need to lock, since this function can be called by any thread */
-
     pthread_mutex_lock(&window_hash_mutex);
 
     if (xp_lookup_native_window(windowNumber, &wid))
commit 823c1df58be4858b74e346fe0fa536dae232565e
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Apr 23 11:55:49 2011 -0700

    XQuartz: Use a lighter spinlock instead of a pthread_mutex_t in QuartzScreenSaver
    
    Currently, we only end up here through a call to QuartzShowFullscreen, and
    this is always on the same thread.  Future changes (such as further
    incorporating libdispatch) may allow this to change, but contention will
    remain minimal since the call is infrequent and it is short held.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Daniel A. Steffen <dsteffen at apple.com>

diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index 4b72a89..0e71d36 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -62,7 +62,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <IOKit/pwr_mgt/IOPMLib.h>
-#include <pthread.h>
+#include <libkern/OSAtomic.h>
 #include <signal.h>
 
 #include <rootlessCommon.h>
@@ -279,10 +279,10 @@ static void pokeActivityCallback(CFRunLoopTimerRef timer, void *info) {
 static void QuartzScreenSaver(int state) {
     static CFRunLoopTimerRef pokeActivityTimer = NULL;
     static CFRunLoopTimerContext pokeActivityContext = { 0, NULL, NULL, NULL, NULL };
-    static pthread_mutex_t pokeActivityMutex = PTHREAD_MUTEX_INITIALIZER;
+    static OSSpinLock pokeActivitySpinLock = OS_SPINLOCK_INIT;
+
+    OSSpinLockLock(&pokeActivitySpinLock);
 
-    pthread_mutex_lock(&pokeActivityMutex);
-    
     if(state) {
         if(pokeActivityTimer == NULL)
             goto QuartzScreenSaverEnd;
@@ -303,7 +303,7 @@ static void QuartzScreenSaver(int state) {
         CFRunLoopAddTimer(CFRunLoopGetMain(), pokeActivityTimer, kCFRunLoopCommonModes);
     }
 QuartzScreenSaverEnd:
-    pthread_mutex_unlock(&pokeActivityMutex);
+    OSSpinLockUnlock(&pokeActivitySpinLock);
 }
 
 void QuartzShowFullscreen(int state) {
commit 3b48b9ac747e9b1cd315be5c2e6296eb83bea784
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Apr 23 01:48:25 2011 -0700

    XQuartz: Remove the threadSafety dead-ish code
    
    It's been a few years now since we've needed this to debug thread
    boundaries, so punt it out to clean up the namespace polution.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/Makefile.am b/hw/xquartz/Makefile.am
index 61b04e0..76f624d 100644
--- a/hw/xquartz/Makefile.am
+++ b/hw/xquartz/Makefile.am
@@ -33,8 +33,7 @@ libXquartz_la_SOURCES = \
 	quartzCocoa.m \
 	quartzKeyboard.c \
 	quartzStartup.c \
-	quartzRandR.c \
-	threadSafety.c
+	quartzRandR.c
 
 EXTRA_DIST = \
 	X11Application.h \
@@ -50,5 +49,4 @@ EXTRA_DIST = \
 	quartzKeyboard.h \
 	quartzRandR.h \
 	sanitizedCarbon.h \
-	sanitizedCocoa.h \
-	threadSafety.h
+	sanitizedCocoa.h
diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h
index 3602257..3ba5d82 100644
--- a/hw/xquartz/darwin.h
+++ b/hw/xquartz/darwin.h
@@ -34,8 +34,6 @@
 #include <X11/extensions/XKB.h>
 #include <assert.h>
 
-#include "threadSafety.h"
-
 #include "darwinfb.h"
 
 // From darwin.c
@@ -80,7 +78,7 @@ extern int              darwinMainScreenY;
 #ifdef ENABLE_DEBUG_LOG
 extern FILE *debug_log_fp;
 #define DEBUG_LOG_NAME "x11-debug.txt"
-#define DEBUG_LOG(msg, args...) if (debug_log_fp) fprintf(debug_log_fp, "%s:%s:%s:%d " msg, threadSafetyID(pthread_self()), __FILE__, __FUNCTION__, __LINE__, ##args ); fflush(debug_log_fp);
+#define DEBUG_LOG(msg, args...) if (debug_log_fp) fprintf(debug_log_fp, "%s:%s:%d " msg, __FILE__, __FUNCTION__, __LINE__, ##args ); fflush(debug_log_fp);
 #else
 #define DEBUG_LOG(msg, args...) 
 #endif
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 5bcee04..f3e1225 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -197,8 +197,6 @@ static void DarwinUpdateModifiers(
 static void DarwinEventHandler(int screenNum, InternalEvent *ie, DeviceIntPtr dev) {
     XQuartzEvent *e = &(ie->xquartz_event);
 
-    TA_SERVER();
-
     switch(e->subtype) {
         case kXquartzControllerNotify:
             DEBUG_LOG("kXquartzControllerNotify\n");
@@ -381,8 +379,6 @@ void ProcessInputEvents(void) {
     char nullbyte;
 	int x = sizeof(nullbyte);
     
-    TA_SERVER();
-
     mieqProcessInputEvents();
 
     // Empty the signaling pipe
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 54f709a..3ab5d52 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -56,8 +56,6 @@
 
 #include "X11Application.h"
 
-#include "threadSafety.h"
-
 #ifdef NDEBUG
 #undef NDEBUG
 #include <assert.h>
diff --git a/hw/xquartz/quartzStartup.c b/hw/xquartz/quartzStartup.c
index 36c8182..00a9e48 100644
--- a/hw/xquartz/quartzStartup.c
+++ b/hw/xquartz/quartzStartup.c
@@ -84,10 +84,7 @@ void QuartzInitServer(int argc, char **argv, char **envp) {
     args->argv = argv;
     args->envp = envp;
     
-    APPKIT_THREAD_ID = pthread_self();
-    SERVER_THREAD_ID = create_thread(server_thread, args);
-
-    if (!SERVER_THREAD_ID) {
+    if (!create_thread(server_thread, args)) {
         FatalError("can't create secondary thread\n");
     }
 }
diff --git a/hw/xquartz/threadSafety.c b/hw/xquartz/threadSafety.c
deleted file mode 100644
index 85f85bd..0000000
--- a/hw/xquartz/threadSafety.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2008 Apple, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name(s) of the above copyright
- * holders shall not be used in advertising or otherwise to promote the sale,
- * use or other dealings in this Software without prior written authorization.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "threadSafety.h"
-#include "os.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);
-    char** strs = backtrace_symbols(callstack, frames);
-    
-    for (i = 0; i < frames; ++i) {
-        ErrorF("%s\n", strs[i]);
-    }
-    
-    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))
-        return;
-    
-    /* NOOOO! */
-    ErrorF("Thread Assertion Failed: self=%s, expected=%s\n%s:%s:%d\n",
-           threadSafetyID(pthread_self()), threadSafetyID(tid),
-           file, fun, line);
-    spewCallStack();
-}
-
-const char *threadSafetyID(pthread_t tid) {
-    if(pthread_equal(tid, APPKIT_THREAD_ID)) {
-        return "Appkit Thread";
-    } else if(pthread_equal(tid, SERVER_THREAD_ID)) {
-        return "Xserver Thread";
-    } else {        
-        return "Unknown Thread";
-    }
-}
diff --git a/hw/xquartz/threadSafety.h b/hw/xquartz/threadSafety.h
deleted file mode 100644
index 3ff9eaf..0000000
--- a/hw/xquartz/threadSafety.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2008 Apple, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name(s) of the above copyright
- * holders shall not be used in advertising or otherwise to promote the sale,
- * use or other dealings in this Software without prior written authorization.
- */
-
-#ifndef _XQ_THREAD_SAFETY_H_
-#define _XQ_THREAD_SAFETY_H_
-
-#define DEBUG_THREADS 1
-
-#include <pthread.h>
-
-extern pthread_t APPKIT_THREAD_ID;
-extern pthread_t SERVER_THREAD_ID;
-
-/* Dump the call stack */
-void spewCallStack(void);
-
-/* Print message to ErrorF if we're in the wrong thread */
-void _threadSafetyAssert(pthread_t tid, const char *file, const char *fun, int line);
-
-/* Get a string that identifies our thread nicely */
-const char *threadSafetyID(pthread_t tid);
-
-#define threadSafetyAssert(tid) _threadSafetyAssert(tid, __FILE__, __FUNCTION__, __LINE__)
-
-#ifdef DEBUG_THREADS
-#define TA_APPKIT() threadSafetyAssert(APPKIT_THREAD_ID)
-#define TA_SERVER() threadSafetyAssert(SERVER_THREAD_ID)
-#else
-#define TA_SERVER() 
-#define TA_APPKIT() 
-#endif
-
-#endif /* _XQ_THREAD_SAFETY_H_ */
diff --git a/hw/xquartz/xpr/xprEvent.c b/hw/xquartz/xpr/xprEvent.c
index 342b54c..cc86c47 100644
--- a/hw/xquartz/xpr/xprEvent.c
+++ b/hw/xquartz/xpr/xprEvent.c
@@ -57,8 +57,6 @@
 #include "xprEvent.h"
 
 Bool QuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev) {
-    TA_SERVER();
-    
     switch(e->subtype) {
         case kXquartzWindowState:
             DEBUG_LOG("kXquartzWindowState\n");
diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c
index 15598e9..efb3737 100644
--- a/hw/xquartz/xpr/xprFrame.c
+++ b/hw/xquartz/xpr/xprFrame.c
@@ -44,8 +44,6 @@
 #include "windowstr.h"
 #include "quartz.h"
 
-#include "threadSafety.h"
-
 #include <pthread.h>
 
 #define DEFINE_ATOM_HELPER(func,atom_name)                      \
@@ -93,8 +91,6 @@ static inline xp_error
 xprConfigureWindow(xp_window_id id, unsigned int mask,
                    const xp_window_changes *values)
 {
-    TA_SERVER();
-
     return xp_configure_window(id, mask, values);
 }
 
@@ -106,8 +102,6 @@ xprSetNativeProperty(RootlessWindowPtr pFrame)
     unsigned int native_id;
     long data;
 
-    TA_SERVER();
-    
     err = xp_get_native_window(x_cvt_vptr_to_uint(pFrame->wid), &native_id);
     if (err == Success)
     {
@@ -137,8 +131,6 @@ xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
     unsigned int mask = 0;
     xp_error err;
 
-    TA_SERVER();
-    
     wc.x = newX;
     wc.y = newY;
     wc.width = pFrame->width;
@@ -209,8 +201,7 @@ static void
 xprDestroyFrame(RootlessFrameID wid)
 {
     xp_error err;
-    TA_SERVER();
-    
+
     pthread_mutex_lock(&window_hash_mutex);
     x_hash_table_remove(window_hash, wid);
     pthread_mutex_unlock(&window_hash_mutex);
@@ -229,8 +220,6 @@ xprMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY)
 {
     xp_window_changes wc;
 
-    TA_SERVER();
-    
     wc.x = newX;
     wc.y = newY;
     //    ErrorF("xprMoveFrame(%d, %p, %d, %d)\n", wid, pScreen, newX, newY);
@@ -248,8 +237,6 @@ xprResizeFrame(RootlessFrameID wid, ScreenPtr pScreen,
 {
     xp_window_changes wc;
 
-    TA_SERVER();
-    
     wc.x = newX;
     wc.y = newY;
     wc.width = newW;
@@ -270,8 +257,6 @@ static void xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) {
     xp_window_changes wc;
     unsigned int mask = XP_STACKING;
 
-    TA_SERVER();
-    
     /* Stack frame below nextWid it if it exists, or raise
        frame above everything otherwise. */
 
@@ -309,8 +294,6 @@ xprReshapeFrame(RootlessFrameID wid, RegionPtr pShape)
 {
     xp_window_changes wc;
 
-    TA_SERVER();
-    
     if (pShape != NULL)
     {
         wc.shape_nrects = RegionNumRects(pShape);
@@ -336,8 +319,6 @@ xprUnmapFrame(RootlessFrameID wid)
 {
     xp_window_changes wc;
 
-    TA_SERVER();
-    
     wc.stack_mode = XP_UNMAPPED;
     wc.sibling = 0;
 
@@ -356,8 +337,6 @@ xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow)
     unsigned int rowbytes[2];
     xp_error err;
 
-    TA_SERVER();
-    
     err = xp_lock_window(x_cvt_vptr_to_uint(wid), NULL, NULL, data, rowbytes, NULL);
     if (err != Success)
         FatalError("Could not lock window %i for drawing.", (int)x_cvt_vptr_to_uint(wid));
@@ -374,8 +353,7 @@ static void
 xprStopDrawing(RootlessFrameID wid, Bool flush)
 {
     xp_error err;
-    TA_SERVER();
-    
+
     err = xp_unlock_window(x_cvt_vptr_to_uint(wid), flush);
     if(err != Success)
         FatalError("Could not unlock window %i after drawing.", (int)x_cvt_vptr_to_uint(wid));
@@ -388,8 +366,6 @@ xprStopDrawing(RootlessFrameID wid, Bool flush)
 static void
 xprUpdateRegion(RootlessFrameID wid, RegionPtr pDamage)
 {
-    TA_SERVER();
-    
     xp_flush_window(x_cvt_vptr_to_uint(wid));
 }
 
@@ -401,8 +377,6 @@ static void
 xprDamageRects(RootlessFrameID wid, int nrects, const BoxRec *rects,
                int shift_x, int shift_y)
 {
-    TA_SERVER();
-    
     xp_mark_window(x_cvt_vptr_to_uint(wid), nrects, rects, shift_x, shift_y);
 }
 
@@ -416,8 +390,6 @@ xprSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin)
 {
     DeleteProperty(serverClient, oldWin, xa_native_window_id());
 
-    TA_SERVER();
-    
     xprSetNativeProperty(pFrame);
 }
 
@@ -429,8 +401,6 @@ static Bool xprDoReorderWindow(RootlessWindowPtr pFrame)
 {
     WindowPtr pWin = pFrame->win;
 
-    TA_SERVER();
-    
     return AppleWMDoReorderWindow(pWin);
 }
 
@@ -443,8 +413,6 @@ static void
 xprCopyWindow(RootlessFrameID wid, int dstNrects, const BoxRec *dstRects,
               int dx, int dy)
 {
-    TA_SERVER();
-    
     xp_copy_window(x_cvt_vptr_to_uint(wid), x_cvt_vptr_to_uint(wid),
                    dstNrects, dstRects, dx, dy);
 }
@@ -479,8 +447,6 @@ xprInit(ScreenPtr pScreen)
 {
     RootlessInit(pScreen, &xprRootlessProcs);
 
-    TA_SERVER();
-    
     rootless_CopyBytes_threshold = xp_copy_bytes_threshold;
     rootless_CopyWindow_threshold = xp_scroll_area_threshold;
 
@@ -578,8 +544,6 @@ xprHideWindows(Bool hide)
     int screen;
     WindowPtr pRoot, pWin;
 
-    TA_SERVER();
-    
     for (screen = 0; screen < screenInfo.numScreens; screen++) {
         RootlessFrameID prevWid = NULL;
         pRoot = screenInfo.screens[screen]->root;
commit a711b3c15149b7f1f50829f70da6d90e32f25688
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Apr 23 01:39:16 2011 -0700

    XQuartz: Use xorg_backtrace() instead of spewCallStack()
    
    Now that xorg_backtrace() produces pretty backtraces, we can use
    it instead.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 40d8a4e..5bcee04 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -113,7 +113,7 @@ void darwinEvents_lock(void) {
     if((err = pthread_mutex_lock(&mieq_lock))) {
         ErrorF("%s:%s:%d: Failed to lock mieq_lock: %d\n",
                __FILE__, __FUNCTION__, __LINE__, err);
-        spewCallStack();
+        xorg_backtrace();
     }
     if(darwinEvents == NULL) {
         pthread_cond_wait(&mieq_ready_cond, &mieq_lock);
@@ -126,7 +126,7 @@ void darwinEvents_unlock(void) {
     if((err = pthread_mutex_unlock(&mieq_lock))) {
         ErrorF("%s:%s:%d: Failed to unlock mieq_lock: %d\n",
                __FILE__, __FUNCTION__, __LINE__, err);
-        spewCallStack();
+        xorg_backtrace();
     }
 }
 
commit 3ebd1e9459c96da599cc176a37403f74b16de08a
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Apr 23 01:12:17 2011 -0700

    os/backtrace: Use backtrace_symbols where available
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/os/backtrace.c b/os/backtrace.c
index 7ca6dab..5ddb15c 100644
--- a/os/backtrace.c
+++ b/os/backtrace.c
@@ -37,21 +37,16 @@
 
 void xorg_backtrace(void)
 {
-    void *array[64];
-    const char *mod;
+    void *callstack[64];
     int size, i;
-    Dl_info info;
+    char **strs;
+
     ErrorF("\nBacktrace:\n");
-    size = backtrace(array, 64);
+    size = backtrace(callstack, 64);
+    strs = backtrace_symbols(callstack, size);
+
     for (i = 0; i < size; i++) {
-	dladdr(array[i], &info);
-	mod = (info.dli_fname && *info.dli_fname) ? info.dli_fname : "(vdso)";
-	if (info.dli_saddr)
-	    ErrorF("%d: %s (%s+0x%lx) [%p]\n", i, mod,
-		   info.dli_sname, (long unsigned int)((char *) array[i] - (char *) info.dli_saddr), array[i]);
-	else
-	    ErrorF("%d: %s (%p+0x%lx) [%p]\n", i, mod,
-		   info.dli_fbase, (long unsigned int)((char *) array[i] - (char *) info.dli_fbase), array[i]);
+        ErrorF("%s\n", strs[i]);
     }
 }
 
commit ac45aacf2b1ab0c811fbe0d9610a32913d19731a
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Apr 22 12:05:32 2011 -0700

    XQuartz: Fix compilation warnings with XPLUGIN_VERSION >= 4
    
    xprAppleWM.c:143: warning: initialization from incompatible pointer type
    xprAppleWM.c:144: warning: initialization from incompatible pointer type
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/applewmExt.h b/hw/xquartz/applewmExt.h
index 5ef8b54..f622f79 100644
--- a/hw/xquartz/applewmExt.h
+++ b/hw/xquartz/applewmExt.h
@@ -32,10 +32,12 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define _APPLEWMEXT_H_
 
 #include "window.h"
+#include <Xplugin.h>
 
 typedef int (*DisableUpdateProc)(void);
 typedef int (*EnableUpdateProc)(void);
 typedef int (*SetWindowLevelProc)(WindowPtr pWin, int level);
+#if XPLUGIN_VERSION < 4
 typedef int (*FrameGetRectProc)(int type, int class, const BoxRec *outer,
                                 const BoxRec *inner, BoxRec *ret);
 typedef int (*FrameHitTestProc)(int class, int x, int y,
@@ -45,6 +47,17 @@ typedef int (*FrameDrawProc)(WindowPtr pWin, int class, unsigned int attr,
                              const BoxRec *outer, const BoxRec *inner,
                              unsigned int title_len,
                              const unsigned char *title_bytes);
+#else
+typedef int (*FrameGetRectProc)(xp_frame_rect type, xp_frame_class class, const BoxRec *outer,
+                                const BoxRec *inner, BoxRec *ret);
+typedef int (*FrameHitTestProc)(xp_frame_class class, int x, int y,
+                                const BoxRec *outer,
+                                const BoxRec *inner, int *ret);
+typedef int (*FrameDrawProc)(WindowPtr pWin, xp_frame_class class, xp_frame_attr attr,
+                             const BoxRec *outer, const BoxRec *inner,
+                             unsigned int title_len,
+                             const unsigned char *title_bytes);
+#endif
 typedef int (*SendPSNProc)(uint32_t hi, uint32_t lo);
 typedef int (*AttachTransientProc)(WindowPtr pWinChild, WindowPtr pWinParent);
 
diff --git a/hw/xquartz/xpr/xprAppleWM.c b/hw/xquartz/xpr/xprAppleWM.c
index 21e6f98..b6b9a5f 100644
--- a/hw/xquartz/xpr/xprAppleWM.c
+++ b/hw/xquartz/xpr/xprAppleWM.c
@@ -114,8 +114,8 @@ static int xprAttachTransient(WindowPtr pWinChild, WindowPtr pWinParent) {
 
 static int xprFrameDraw(
     WindowPtr pWin,
-    int class,
-    unsigned int attr,
+    xp_frame_class class,
+    xp_frame_attr attr,
     const BoxRec *outer,
     const BoxRec *inner,
     unsigned int title_len,
commit 7f09bf1ba1221e6c8a59ddb98abfb8df28a58ef1
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Apr 23 23:25:39 2011 -0700

    rootless: Fix a typo in RootlessGlyphs which resulted in a garbage value
    
    Found by clang static analyzer
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/miext/rootless/rootlessScreen.c b/miext/rootless/rootlessScreen.c
index df8d945..0801e72 100644
--- a/miext/rootless/rootlessScreen.c
+++ b/miext/rootless/rootlessScreen.c
@@ -325,7 +325,7 @@ RootlessGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
                 box.x1 = x - glyph->info.x;
                 box.y1 = y - glyph->info.y;
                 box.x2 = box.x1 + glyph->info.width;
-                box.y2 = box.y2 + glyph->info.height;
+                box.y2 = box.y1 + glyph->info.height;
 
                 x += glyph->info.xOff;
                 y += glyph->info.yOff;
commit 79b505380873f4988e69cb083681d0f6731dd629
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Apr 23 23:27:16 2011 -0700

    rootless: Dead code removal
    
    Found by clang static analyzer
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/miext/rootless/rootlessScreen.c b/miext/rootless/rootlessScreen.c
index 510d6fd..df8d945 100644
--- a/miext/rootless/rootlessScreen.c
+++ b/miext/rootless/rootlessScreen.c
@@ -453,7 +453,6 @@ RootlessMarkOverlappedWindows(WindowPtr pWin, WindowPtr pFirst,
                 pChild = pChild->nextSib;
             }
             anyMarked = TRUE;
-            pFirst = pFirst->nextSib;
         }
         if (anyMarked)
             (* MarkWindow)(pWin->parent);
diff --git a/miext/rootless/rootlessValTree.c b/miext/rootless/rootlessValTree.c
index d242600..9aa8814 100644
--- a/miext/rootless/rootlessValTree.c
+++ b/miext/rootless/rootlessValTree.c
@@ -200,7 +200,6 @@ RootlessComputeClips (WindowPtr pParent, ScreenPtr pScreen,
     RegionRec		childUnion;
     Bool		overlap;
     RegionPtr		borderVisible;
-    Bool		resized;
     /*
      * Figure out the new visibility of this window.
      * The extent of the universe should be the same as the extent of
@@ -340,7 +339,6 @@ RootlessComputeClips (WindowPtr pParent, ScreenPtr pScreen,
     }
 
     borderVisible = pParent->valdata->before.borderVisible;
-    resized = pParent->valdata->before.resized;
     RegionNull(&pParent->valdata->after.borderExposed);
     RegionNull(&pParent->valdata->after.exposed);
 
commit c3e5bb1a9b8c36b5fbdbd8f8425bb77e96d81742
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Sat Apr 23 21:24:27 2011 -0700

    glx: Silence warnings when building with clang
    
    In file included from glapi.c:46:
    In file included from ./glapi.h:51:
    ./glthread.h:237:20: error: unknown attribute 'tls_model' ignored [-Werror,-Wunknown-attributes]
        __attribute__((tls_model("initial-exec")));
                       ^
    In file included from glapi.c:46:
    ./glapi.h:92:20: error: unknown attribute 'tls_model' ignored [-Werror,-Wunknown-attributes]
        __attribute__((tls_model("initial-exec")));
                       ^
    glapi.c:82:20: error: unknown attribute 'tls_model' ignored [-Werror,-Wunknown-attributes]
        __attribute__((tls_model("initial-exec"))) = NULL;
                       ^
    glapi.c:85:20: error: unknown attribute 'tls_model' ignored [-Werror,-Wunknown-attributes]
        __attribute__((tls_model("initial-exec")));
                       ^
    4 errors generated.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at freedesktop.org>

diff --git a/glx/glapi.c b/glx/glapi.c
index 7cb8495..0a166ce 100644
--- a/glx/glapi.c
+++ b/glx/glapi.c
@@ -78,11 +78,15 @@ static void init_glapi_relocs(void);
 /*@{*/
 #if defined(GLX_USE_TLS)
 
-PUBLIC TLS struct _glapi_table * _glapi_tls_Dispatch
-    __attribute__((tls_model("initial-exec"))) = NULL;
+#ifdef HAVE_TLS_MODEL
+__attribute__((tls_model("initial-exec")))
+#endif
+PUBLIC TLS struct _glapi_table * _glapi_tls_Dispatch = NULL;
 
-PUBLIC TLS void * _glapi_tls_Context
-    __attribute__((tls_model("initial-exec")));
+#ifdef HAVE_TLS_MODEL
+__attribute__((tls_model("initial-exec")))
+#endif
+PUBLIC TLS void * _glapi_tls_Context;
 
 PUBLIC const struct _glapi_table *_glapi_Dispatch = NULL;
 PUBLIC const void *_glapi_Context = NULL;
diff --git a/glx/glapi.h b/glx/glapi.h
index 6521f31..85c5ab7 100644
--- a/glx/glapi.h
+++ b/glx/glapi.h
@@ -83,8 +83,10 @@ typedef void (*_glapi_warning_func)(void *ctx, const char *str, ...);
 const extern void *_glapi_Context;
 const extern struct _glapi_table *_glapi_Dispatch;
 
-extern TLS void * _glapi_tls_Context
-    __attribute__((tls_model("initial-exec")));
+#ifdef HAVE_TLS_MODEL
+__attribute__((tls_model("initial-exec")))
+#endif
+extern TLS void * _glapi_tls_Context;
 
 # define GET_CURRENT_CONTEXT(C)  GLcontext *C = (GLcontext *) _glapi_tls_Context
 
diff --git a/glx/glthread.h b/glx/glthread.h
index 140e2aa..0375443 100644
--- a/glx/glthread.h
+++ b/glx/glthread.h
@@ -233,8 +233,10 @@ _glthread_SetTSD(_glthread_TSD *, void *);
 
 #if defined(GLX_USE_TLS)
 
-extern TLS struct _glapi_table * _glapi_tls_Dispatch
-    __attribute__((tls_model("initial-exec")));
+#ifdef HAVE_TLS_MODEL
+__attribute__((tls_model("initial-exec")))
+#endif
+extern TLS struct _glapi_table * _glapi_tls_Dispatch;
 
 #define GET_DISPATCH() _glapi_tls_Dispatch
 
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 14229b4..4fd49ef 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -450,6 +450,9 @@
 /* If the compiler supports a TLS storage class define it to that here */
 #undef TLS
 
+/* Is the __attribute((tls_model(...))) extension supported? */
+#undef HAVE_TLS_MODEL
+
 /* Correctly set _XSERVER64 for OSX fat binaries */
 #ifdef __APPLE__
 #include "dix-config-apple-verbatim.h"
diff --git a/m4/ax_tls.m4 b/m4/ax_tls.m4
index 481c3d0..87c6f3c 100644
--- a/m4/ax_tls.m4
+++ b/m4/ax_tls.m4
@@ -16,6 +16,7 @@
 # LICENSE
 #
 #   Copyright (c) 2008 Alan Woodland <ajw05 at aber.ac.uk>
+#   Copyright (c) 2011 Jeremy Huddleston <jeremyhu at freedesktop.org>
 #
 #   This program is free software: you can redistribute it and/or modify it
 #   under the terms of the GNU General Public License as published by the
@@ -64,11 +65,21 @@ AC_DEFUN([AX_TLS], [
              )
        esac
     done
-])
+  ])
 
   if test "$ac_cv_tls" != "none"; then
     dnl AC_DEFINE([TLS], [], [If the compiler supports a TLS storage class define it to that here])
     AC_DEFINE_UNQUOTED([TLS], $ac_cv_tls, [If the compiler supports a TLS storage class define it to that here])
+
+    save_CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS -Werror=unknown-attributes"
+    AC_TRY_COMPILE([], [TLS int bar __attribute__((tls_model("initial-exec")));],
+                   ac_cv_tls_model=yes, ac_cv_tls_model=no)
+    CFLAGS="$save_CFLAGS"
+
+    if test "x$ac_cv_tls_model" = "xyes" ; then
+      AC_DEFINE([HAVE_TLS_MODEL], 1, [Is the __attribute((tls_model(...))) extension supported? ])
+    fi
   fi
   AC_MSG_RESULT($ac_cv_tls)
 ])
commit aa02d6b0007906156bfcf1bbeb1ec44db07366d1
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Apr 23 20:55:53 2011 -0700

    render: Silence warnings when building with clang
    
    picture.c:351:37: error: implicit conversion from 'unsigned int' to 'CARD16' (aka 'unsigned short') changes value from 4294967295 to 65535
          [-Werror,-Wconstant-conversion]
                pFormats[f].direct.alphaMask = Mask(PICT_FORMAT_A(format));
                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    ...
    fatal error: too many errors emitted, stopping now [-ferror-limit=]
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/render/picture.c b/render/picture.c
index e7e1f2b..59f2c68 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -42,6 +42,11 @@
 #include "picturestr.h"
 #include "xace.h"
 
+#ifdef __clang__
+/* Many implicit conversions from int to CARD16 which look intentional */
+#pragma clang diagnostic ignored "-Wconstant-conversion"
+#endif
+
 DevPrivateKeyRec PictureScreenPrivateKeyRec;
 DevPrivateKeyRec PictureWindowPrivateKeyRec;
 static int	PictureGeneration;
commit b2d986fe93d6c1832ff307b994e49787b3fee5d7
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Apr 23 20:49:27 2011 -0700

    os: Silence warnings when building with clang
    
    access.c:1492:20: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses]
            if ((host->family == FamilyServerInterpreted)) {
                 ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
    access.c:1492:20: note: use '=' to turn this equality comparison into an assignment
            if ((host->family == FamilyServerInterpreted)) {
                              ^~
                              =
    access.c:1492:20: note: remove extraneous parentheses around the comparison to silence this warning
            if ((host->family == FamilyServerInterpreted)) {
                ~             ^                         ~
    
    In file included from xstrans.c:8:
    In file included from /usr/X11/include/X11/Xtrans/transport.c:62:
    /usr/X11/include/X11/Xtrans/Xtranssock.c:262:5: error: implicit declaration of function 'ErrorF' is invalid in C99
          [-Werror,-Wimplicit-function-declaration]
        PRMSG (3,"SocketSelectFamily(%s)\n", family, 0, 0);
        ^
    
    log.c:180:29: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
            if (asprintf(&logFileName, fname, display) == -1)
                                       ^~~~~
    log.c:190:26: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
                    if ((asprintf(&suffix, backup, display) == -1) ||
                                           ^~~~~~
    log.c:382:25: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
            LogVWrite(verb, tmpBuf, args);
                            ^~~~~~
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/os/access.c b/os/access.c
index 3856e60..b7b1927 100644
--- a/os/access.c
+++ b/os/access.c
@@ -1489,7 +1489,7 @@ InvalidHost (
     }
     for (host = validhosts; host; host = host->next)
     {
-	if ((host->family == FamilyServerInterpreted)) {
+	if (host->family == FamilyServerInterpreted) {
 	    if (siAddrMatch (family, addr, len, host, client)) {
 		return 0;
 	    }
diff --git a/os/log.c b/os/log.c
index 65195ba..9579e58 100644
--- a/os/log.c
+++ b/os/log.c
@@ -102,6 +102,10 @@ OR PERFORMANCE OF THIS SOFTWARE.
 #include "xf86bigfontsrv.h"
 #endif
 
+#ifdef __clang__
+#pragma clang diagnostic ignored "-Wformat-nonliteral"
+#endif
+
 #ifdef DDXOSVERRORF
 void (*OsVendorVErrorFProc)(const char *, va_list args) = NULL;
 #endif
diff --git a/os/xstrans.c b/os/xstrans.c
index c086e22..44ff976 100644
--- a/os/xstrans.c
+++ b/os/xstrans.c
@@ -2,6 +2,11 @@
 #include <dix-config.h>
 #endif
 
+#include <X11/Xfuncproto.h>
+
+/* ErrorF is used by xtrans */
+extern _X_EXPORT void ErrorF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
+
 #define TRANS_REOPEN
 #define TRANS_SERVER
 #define XSERV_t
commit 79af180198273aecab77c3095e69f126beca9751
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Apr 23 20:39:25 2011 -0700

    Xext: Silence warnings when building with clang
    
    xvmain.c:1113:22: warning: equality comparison with extraneous parentheses [-Wparentheses]
          if ((pf->depth == pDraw->depth)
               ~~~~~~~~~~^~~~~~~~~~~~~~~
    xvmain.c:1113:22: note: use '=' to turn this equality comparison into an assignment
          if ((pf->depth == pDraw->depth)
                         ^~
                         =
    xvmain.c:1113:22: note: remove extraneous parentheses around the comparison to silence this warning
          if ((pf->depth == pDraw->depth)
              ~          ^              ~
    1 warning generated.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/Xext/xvmain.c b/Xext/xvmain.c
index cd6f097..d21a56c 100644
--- a/Xext/xvmain.c
+++ b/Xext/xvmain.c
@@ -1110,12 +1110,7 @@ XvdiMatchPort(
 
   while (nf--)
     {
-      if ((pf->depth == pDraw->depth) 
-#if 0
-         && ((pDraw->type == DRAWABLE_PIXMAP) || 
-	   (wVisual(((WindowPtr)pDraw)) == pf->visual))
-#endif
-	)
+      if (pf->depth == pDraw->depth)
 	return Success;
       pf++;
     }
commit bbe14c333881ae9ac19d7b8a91d2f218f031de79
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Apr 23 20:36:53 2011 -0700

    fb: Silence warnings when building with clang
    
    fbpict.c:163:8: warning: implicit conversion from enumeration type 'PictFormatShort' (aka 'enum _PictFormatShort') to different enumeration
          type 'pixman_format_code_t' [-Wconversion]
            pict->format,
            ~~~~~~^~~~~~
    
    fbbltone.c:486:2: warning: shift result (281474959933440) requires 49 bits to represent, but 'int' only has 32 bits [-Wshift-overflow]
            C2_24( 0, 0), C2_24 ( 1, 0), C2_24 ( 2, 0), C2_24 ( 3, 0),
            ^~~~~~~~~~~~
    fbbltone.c:474:6: note: instantiated from:
         SelMask24(b,1,r))
         ^
    fbbltone.c:429:46: note: instantiated from:
                                                        ^
    fbbltone.c:427:18: note: instantiated from:
                          0xffffff << Mask24Check(x,r)) : 0)
                          ~~~~~~~~ ^
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/fb/fbbltone.c b/fb/fbbltone.c
index 629b13a..0a91575 100644
--- a/fb/fbbltone.c
+++ b/fb/fbbltone.c
@@ -26,6 +26,11 @@
 
 #include "fb.h"
 
+#ifdef __clang__
+/* shift overflow is intentional */
+#pragma clang diagnostic ignored "-Wshift-overflow"
+#endif
+
 /*
  *  Example: srcX = 13 dstX = 8	(FB unit 32 dstBpp 8)
  *
diff --git a/fb/fbpict.c b/fb/fbpict.c
index 133f422..d1fd0cb 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -160,7 +160,7 @@ create_bits_picture (PicturePtr pict,
     fbGetPixmapBitsData(pixmap, bits, stride, bpp);
 
     image = pixman_image_create_bits (
-	pict->format,
+	(pixman_format_code_t)pict->format,
 	pixmap->drawable.width, pixmap->drawable.height,
 	(uint32_t *)bits, stride * sizeof (FbStride));
     
commit 6aa55731a58434e897d1e3c61b3e1e0a9ad91874
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sun Apr 24 19:57:22 2011 -0700

    os: Add missing _X_ATTRIBUTE_PRINTF to va_list variants
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/include/os.h b/include/os.h
index d747040..506dc5d 100644
--- a/include/os.h
+++ b/include/os.h
@@ -510,17 +510,17 @@ typedef enum {
 extern _X_EXPORT const char *LogInit(const char *fname, const char *backup);
 extern _X_EXPORT void LogClose(void);
 extern _X_EXPORT Bool LogSetParameter(LogParameter param, int value);
-extern _X_EXPORT void LogVWrite(int verb, const char *f, va_list args);
+extern _X_EXPORT void LogVWrite(int verb, const char *f, va_list args) _X_ATTRIBUTE_PRINTF(2,0);
 extern _X_EXPORT void LogWrite(int verb, const char *f, ...) _X_ATTRIBUTE_PRINTF(2,3);
 extern _X_EXPORT void LogVMessageVerb(MessageType type, int verb, const char *format,
-			    va_list args);
+			    va_list args) _X_ATTRIBUTE_PRINTF(3,0);
 extern _X_EXPORT void LogMessageVerb(MessageType type, int verb, const char *format,
 			   ...) _X_ATTRIBUTE_PRINTF(3,4);
 extern _X_EXPORT void LogMessage(MessageType type, const char *format, ...)
 			_X_ATTRIBUTE_PRINTF(2,3);
 extern _X_EXPORT void FreeAuditTimer(void);
 extern _X_EXPORT void AuditF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
-extern _X_EXPORT void VAuditF(const char *f, va_list args);
+extern _X_EXPORT void VAuditF(const char *f, va_list args) _X_ATTRIBUTE_PRINTF(1,0);
 extern _X_EXPORT void FatalError(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_NORETURN;
 
 #ifdef DEBUG
@@ -529,7 +529,7 @@ extern _X_EXPORT void FatalError(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2) _X
 #define DebugF(...) /* */
 #endif
 
-extern _X_EXPORT void VErrorF(const char *f, va_list args);
+extern _X_EXPORT void VErrorF(const char *f, va_list args) _X_ATTRIBUTE_PRINTF(1,0);
 extern _X_EXPORT void ErrorF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
 extern _X_EXPORT void Error(const char *str);
 extern _X_EXPORT void LogPrintMarkers(void);
commit d26b45d8bcb56bcfbbb4977fff82bae617823c63
Author: Nicolas Kaiser <nikai at nikai.net>
Date:   Sun Apr 24 12:44:15 2011 +0200

    xkb: remove duplicated include
    
    Remove duplicated include.
    
    Signed-off-by: Nicolas Kaiser <nikai at nikai.net>
    Reviewed-by: Matthieu Herrb <matthieu.herrb at laas.fr>

diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c
index c020e5e..7f91e9a 100644
--- a/xkb/xkbEvents.c
+++ b/xkb/xkbEvents.c
@@ -38,7 +38,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include "exevents.h"
 #include "exglobals.h"
 #include "windowstr.h"
-#include "exevents.h"
 #include <xkbsrv.h>
 #include "xkb.h"
 
commit 17936c5bb9329cd3343ecb2eff6aa8f68dccd364
Author: Nicolas Kaiser <nikai at nikai.net>
Date:   Sun Apr 24 12:43:05 2011 +0200

    test/xi2: remove duplicated include
    
    Remove duplicated include.
    
    Signed-off-by: Nicolas Kaiser <nikai at nikai.net>
    Reviewed-by: Matthieu Herrb <matthieu.herrb at laas.fr>

diff --git a/test/xi2/protocol-common.h b/test/xi2/protocol-common.h
index 18c61e6..b55f57c 100644
--- a/test/xi2/protocol-common.h
+++ b/test/xi2/protocol-common.h
@@ -27,7 +27,6 @@
 
 #include "scrnintstr.h"
 #include "windowstr.h"
-#include "scrnintstr.h"
 #include "exevents.h"
 #include <assert.h>
 
commit 696835572aa3658c1adb67165f3a31a0de06f2a6
Author: Nicolas Kaiser <nikai at nikai.net>
Date:   Sun Apr 24 12:42:07 2011 +0200

    hw/xwin: remove duplicated includes
    
    Remove duplicated includes.
    
    Signed-off-by: Nicolas Kaiser <nikai at nikai.net>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xwin/win.h b/hw/xwin/win.h
index 3f40fdb..9bee9b6 100644
--- a/hw/xwin/win.h
+++ b/hw/xwin/win.h
@@ -172,7 +172,6 @@
 #include "input.h"
 #include "mipointer.h"
 #include "X11/keysym.h"
-#include "mibstore.h"
 #include "micoord.h"
 #include "dix.h"
 #include "miline.h"
diff --git a/hw/xwin/winmultiwindowicons.c b/hw/xwin/winmultiwindowicons.c
index 1ca3f91..534f6fd 100644
--- a/hw/xwin/winmultiwindowicons.c
+++ b/hw/xwin/winmultiwindowicons.c
@@ -37,8 +37,6 @@
 #include "winprefs.h"
 
 #include "propertyst.h"
-
-#include "propertyst.h"
 #include "windowstr.h"
 
 
diff --git a/hw/xwin/winvideo.c b/hw/xwin/winvideo.c
index 0438e5f..ed20544 100644
--- a/hw/xwin/winvideo.c
+++ b/hw/xwin/winvideo.c
@@ -69,8 +69,6 @@ winInitVideo (ScreenPtr pScreen)
 #include <X11/extensions/Xv.h>
 #endif
 
-#include "win.h"
-
 
 
 #if 0
commit c270cfc30c547e28017533f490904013f73cf6f0
Author: Nicolas Kaiser <nikai at nikai.net>
Date:   Sun Apr 24 12:41:11 2011 +0200

    hw/xquartz: remove duplicated includes
    
    Remove duplicated includes.
    
    Signed-off-by: Nicolas Kaiser <nikai at nikai.net>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index 32fb12a..6da27c7 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -139,7 +139,6 @@
 #include <glxcontext.h>
 #include <glxext.h>
 #include <glxutil.h>
-#include <glxscreens.h>
 #include <GL/internal/glcore.h>
 #include "x-hash.h"
 #include "x-list.h"
diff --git a/hw/xquartz/GL/visualConfigs.c b/hw/xquartz/GL/visualConfigs.c
index b209b76..2c2a9a2 100644
--- a/hw/xquartz/GL/visualConfigs.c
+++ b/hw/xquartz/GL/visualConfigs.c
@@ -51,7 +51,6 @@
 #include <glxcontext.h>
 #include <glxext.h>
 #include <glxutil.h>
-#include <glxscreens.h>
 #include <GL/internal/glcore.h>
 
 #include "capabilities.h"
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index e56bf0c..83b5601 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -41,7 +41,6 @@
 #include "quartz.h"
 #include "darwinEvents.h"
 #include "quartzKeyboard.h"
-#include "quartz.h"
 #include <X11/extensions/applewmconst.h>
 #include "micmap.h"
 #include "exglobals.h"
diff --git a/hw/xquartz/quartzKeyboard.h b/hw/xquartz/quartzKeyboard.h
index 1151a00..de4aed8 100644
--- a/hw/xquartz/quartzKeyboard.h
+++ b/hw/xquartz/quartzKeyboard.h
@@ -32,8 +32,6 @@
 #include "X11/keysym.h"
 #include "inputstr.h"
 
-#include <pthread.h>
-
 // Each key can generate 4 glyphs. They are, in order:
 // unshifted, shifted, modeswitch unshifted, modeswitch shifted
 #define GLYPHS_PER_KEY  4
commit 50ced6cfa0aef472e713ffccfdba003829df68df
Author: Nicolas Kaiser <nikai at nikai.net>
Date:   Sun Apr 24 12:40:11 2011 +0200

    hw/xnest: remove duplicated include
    
    Remove duplicated include.
    
    Signed-off-by: Nicolas Kaiser <nikai at nikai.net>
    Reviewed-by: Matthieu Herrb <matthieu.herrb at laas.fr>

diff --git a/hw/xnest/Pixmap.c b/hw/xnest/Pixmap.c
index 3a92ffd..eccf569 100644
--- a/hw/xnest/Pixmap.c
+++ b/hw/xnest/Pixmap.c
@@ -21,7 +21,6 @@ is" without express or implied warranty.
 #include "regionstr.h"
 #include "pixmapstr.h"
 #include "scrnintstr.h"
-#include "regionstr.h"
 #include "gc.h"
 #include "servermd.h"
 #include "privates.h"
commit 387f45a7077faadf232edc3f608c4a081a7fd290
Author: Nicolas Kaiser <nikai at nikai.net>
Date:   Sun Apr 24 12:39:11 2011 +0200

    hw/xfree86/modes: remove duplicated include
    
    Remove duplicated include.
    
    Signed-off-by: Nicolas Kaiser <nikai at nikai.net>
    Reviewed-by: Matthieu Herrb <matthieu.herrb at laas.fr>

diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 2ebe0ae..cb20d1c 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -31,7 +31,6 @@
 #include "xf86.h"
 #include "os.h"
 #include "globals.h"
-#include "xf86.h"
 #include "xf86Priv.h"
 #include "xf86DDC.h"
 #include "mipointer.h"
commit 78a9ec125dcb1546ca7e7e18aedf2b323eebb1fc
Author: Nicolas Kaiser <nikai at nikai.net>
Date:   Sun Apr 24 12:38:08 2011 +0200

    hw/xfree86/fbdevhw: remove duplicated include
    
    Remove duplicated include.
    
    Signed-off-by: Nicolas Kaiser <nikai at nikai.net>
    Reviewed-by: Matthieu Herrb <matthieu.herrb at laas.fr>

diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c
index 17fba36..dee731b 100644
--- a/hw/xfree86/fbdevhw/fbdevhw.c
+++ b/hw/xfree86/fbdevhw/fbdevhw.c
@@ -48,7 +48,6 @@ _X_EXPORT XF86ModuleData fbdevhwModuleData = {
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <string.h>
 
 /* -------------------------------------------------------------------- */
 /* our private data, and two functions to allocate/free this            */
commit 0320db25f917980621107b790c4fc5171cb0b6ac
Author: Nicolas Kaiser <nikai at nikai.net>
Date:   Sun Apr 24 12:36:48 2011 +0200

    hw/xfree86/dri: remove duplicated includes
    
    Remove duplicated includes.
    
    Signed-off-by: Nicolas Kaiser <nikai at nikai.net>
    Reviewed-by: Matthieu Herrb <matthieu.herrb at laas.fr>

diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index bb5482a..1726960 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -63,8 +63,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "dri.h"
 #include "sarea.h"
 #include "dristruct.h"
-#include "xf86.h"
-#include "xf86drm.h"
 #include "mi.h"
 #include "mipointer.h"
 #include "xf86_OSproc.h"
diff --git a/hw/xfree86/dri/xf86dri.c b/hw/xfree86/dri/xf86dri.c
index 20baa24..e02644a 100644
--- a/hw/xfree86/dri/xf86dri.c
+++ b/hw/xfree86/dri/xf86dri.c
@@ -58,7 +58,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "dri.h"
 #include "sarea.h"
 #include "dristruct.h"
-#include "xf86.h"
 #include "xf86drm.h"
 #include "protocol-versions.h"
 
commit b56271b954d6ab8eeb320f314925b77403458b9c
Author: Nicolas Kaiser <nikai at nikai.net>
Date:   Sun Apr 24 12:35:45 2011 +0200

    hw/xfree86/ddc: remove duplicated include
    
    Remove duplicated include.
    
    Signed-off-by: Nicolas Kaiser <nikai at nikai.net>
    Reviewed-by: Matthieu Herrb <matthieu.herrb at laas.fr>

diff --git a/hw/xfree86/ddc/ddcProperty.c b/hw/xfree86/ddc/ddcProperty.c
index d2d90ba..5d6eec9 100644
--- a/hw/xfree86/ddc/ddcProperty.c
+++ b/hw/xfree86/ddc/ddcProperty.c
@@ -30,7 +30,6 @@
 #include <X11/Xatom.h>
 #include "property.h"
 #include "propertyst.h"
-#include "xf86DDC.h"
 #include <string.h>
 
 #define EDID1_ATOM_NAME         "XFree86_DDC_EDID1_RAWDATA"
commit 86c0c8b9c567f57fe7477d5302fa22dc7557ce90
Author: Nicolas Kaiser <nikai at nikai.net>
Date:   Sun Apr 24 12:34:46 2011 +0200

    dix: remove duplicated includes
    
    Remove duplicated includes.
    
    Signed-off-by: Nicolas Kaiser <nikai at nikai.net>
    Reviewed-by: Matthieu Herrb <matthieu.herrb at laas.fr>

diff --git a/dix/events.c b/dix/events.c
index 8835c5e..d70d62f 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -138,7 +138,6 @@ typedef const char *string;
 #include <X11/extensions/XI2.h>
 #include "exglobals.h"
 #include "exevents.h"
-#include "exglobals.h"
 #include "extnsionst.h"
 
 #include "dixevents.h"
diff --git a/dix/getevents.c b/dix/getevents.c
index 0fa8046..4267b61 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -61,7 +61,6 @@
 #include <pixman.h>
 #include "exglobals.h"
 #include "exevents.h"
-#include "exglobals.h"
 #include "extnsionst.h"
 #include "listdev.h" /* for sizing up DeviceClassesChangedEvent */
 
commit 9b5046d2130aead79956019faf7103b5c676fd02
Author: Nicolas Kaiser <nikai at nikai.net>
Date:   Sun Apr 24 12:33:32 2011 +0200

    Xi: remove duplicated includes
    
    Remove duplicated includes.
    
    Signed-off-by: Nicolas Kaiser <nikai at nikai.net>
    Reviewed-by: Matthieu Herrb <matthieu.herrb at laas.fr>

diff --git a/Xi/extinit.c b/Xi/extinit.c
index 51e0078..0905e18 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -84,7 +84,6 @@ SOFTWARE.
 #include "closedev.h"
 #include "devbell.h"
 #include "getbmap.h"
-#include "getbmap.h"
 #include "getdctl.h"
 #include "getfctl.h"
 #include "getfocus.h"
@@ -93,7 +92,6 @@ SOFTWARE.
 #include "getprop.h"
 #include "getselev.h"
 #include "getvers.h"
-#include "getvers.h"
 #include "grabdev.h"
 #include "grabdevb.h"
 #include "grabdevk.h"


More information about the Xquartz-changes mailing list