[Xquartz-changes] xserver: Branch 'server-1.9-apple' - 11 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Sun May 2 15:27:51 PDT 2010


Rebased ref, commits from common ancestor:
commit 2a3d9e042ea0bca6e82d428f2b5a7c5b2c360bc2
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Mar 27 18:02:14 2010 -0700

    OS: Add some noreturn and printflike compiler attributes where appropriate
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/include/os.h b/include/os.h
index 453ab82..957fc74 100644
--- a/include/os.h
+++ b/include/os.h
@@ -83,6 +83,15 @@ typedef struct _NewClientRec *NewClientPtr;
 #include <stdio.h>
 #include <stdarg.h>
 
+/* XXX Need to check which GCC versions have the format(printf) attribute. */
+#if defined(__GNUC__) && (__GNUC__ > 2)
+#define _printf_attribute(a,b) __attribute((format(__printf__,a,b)))
+#define _noreturn_attribute __attribute((noreturn))
+#else
+#define _printf_attribute(a,b) /**/
+#define _noreturn_attribute /**/
+#endif
+
 #ifdef DDXBEFORERESET
 extern void ddxBeforeReset (void);
 #endif
@@ -226,9 +235,9 @@ extern _X_EXPORT pointer XNFrealloc(pointer /*ptr*/, unsigned long /*amount*/);
 
 extern _X_EXPORT char *Xstrdup(const char *s);
 extern _X_EXPORT char *XNFstrdup(const char *s);
-extern _X_EXPORT char *Xprintf(const char *fmt, ...);
+extern _X_EXPORT char *Xprintf(const char *fmt, ...) _printf_attribute(1,2);
 extern _X_EXPORT char *Xvprintf(const char *fmt, va_list va);
-extern _X_EXPORT char *XNFprintf(const char *fmt, ...);
+extern _X_EXPORT char *XNFprintf(const char *fmt, ...) _printf_attribute(1,2);
 extern _X_EXPORT char *XNFvprintf(const char *fmt, va_list va);
 
 typedef void (*OsSigHandlerPtr)(int /* sig */);
@@ -262,7 +271,7 @@ extern _X_EXPORT void OsBlockSignals (void);
 
 extern _X_EXPORT void OsReleaseSignals (void);
 
-extern _X_EXPORT void OsAbort (void);
+extern _X_EXPORT void OsAbort (void) _noreturn_attribute;
 
 #if !defined(WIN32)
 extern _X_EXPORT int System(char *);
@@ -488,13 +497,6 @@ typedef enum {
     X_UNKNOWN = -1		/* unknown -- this must always be last */
 } MessageType;
 
-/* XXX Need to check which GCC versions have the format(printf) attribute. */
-#if defined(__GNUC__) && (__GNUC__ > 2)
-#define _printf_attribute(a,b) __attribute((format(__printf__,a,b)))
-#else
-#define _printf_attribute(a,b) /**/
-#endif
-
 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);
@@ -509,11 +511,7 @@ extern _X_EXPORT void LogMessage(MessageType type, const char *format, ...)
 extern _X_EXPORT void FreeAuditTimer(void);
 extern _X_EXPORT void AuditF(const char *f, ...) _printf_attribute(1,2);
 extern _X_EXPORT void VAuditF(const char *f, va_list args);
-extern _X_EXPORT void FatalError(const char *f, ...) _printf_attribute(1,2)
-#if defined(__GNUC__) && (__GNUC__ > 2)
-__attribute((noreturn))
-#endif
-;
+extern _X_EXPORT void FatalError(const char *f, ...) _printf_attribute(1,2) _noreturn_attribute;
 
 #ifdef DEBUG
 #define DebugF ErrorF
diff --git a/os/log.c b/os/log.c
index 3773315..99f3528 100644
--- a/os/log.c
+++ b/os/log.c
@@ -402,9 +402,7 @@ LogMessage(MessageType type, const char *format, ...)
     va_end(ap);
 }
 
-#ifdef __GNUC__
-void AbortServer(void) __attribute__((noreturn));
-#endif
+void AbortServer(void) _noreturn_attribute;
 
 void
 AbortServer(void)
commit a134e2a062ada9d3e42bc2e82e7090c58721f2e3
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Feb 12 19:48:52 2010 -0800

    fb: Revert fb changes that broke XQuartz
    
    http://bugs.freedesktop.org/show_bug.cgi?id=26124
    
    Revert "Fix source pictures getting random transforms after 2d6a8f668342a5190cdf43b5."
    Revert "fb: Adjust transform or composite coordinates for pixman operations"
    
    http://bugs.freedesktop.org/26124
    
    This reverts commit a72c65e9176c51de95db2fdbf4c5d946a4911695.
    This reverts commit a6bd5d2e482a5aa84acb3d4932e2a166d8670ef1.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/fb/fb.h b/fb/fb.h
index 91c91ee..6d15b79 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -2078,11 +2078,8 @@ fbFillRegionSolid (DrawablePtr	pDrawable,
 		   FbBits	xor);
 
 extern _X_EXPORT pixman_image_t *
-image_from_pict (PicturePtr	pict,
-		 Bool		has_clip,
-		 int		*xoff,
-		 int		*yoff);
-
+image_from_pict (PicturePtr pict,
+		 Bool       has_clip);
 extern _X_EXPORT void free_pixman_pict (PicturePtr, pixman_image_t *);
 
 #endif /* _FB_H_ */
diff --git a/fb/fbpict.c b/fb/fbpict.c
index 896d33e..00f9ada 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -156,24 +156,19 @@ fbComposite (CARD8      op,
 	     CARD16     height)
 {
     pixman_image_t *src, *mask, *dest;
-    int src_xoff, src_yoff;
-    int msk_xoff, msk_yoff;
-    int dst_xoff, dst_yoff;
     
     miCompositeSourceValidate (pSrc, xSrc - xDst, ySrc - yDst, width, height);
     if (pMask)
 	miCompositeSourceValidate (pMask, xMask - xDst, yMask - yDst, width, height);
     
-    src = image_from_pict (pSrc, FALSE, &src_xoff, &src_yoff);
-    mask = image_from_pict (pMask, FALSE, &msk_xoff, &msk_yoff);
-    dest = image_from_pict (pDst, TRUE, &dst_xoff, &dst_yoff);
+    src = image_from_pict (pSrc, TRUE);
+    mask = image_from_pict (pMask, TRUE);
+    dest = image_from_pict (pDst, TRUE);
 
     if (src && dest && !(pMask && !mask))
     {
 	pixman_image_composite (op, src, mask, dest,
-				xSrc + src_xoff, ySrc + src_yoff,
-				xMask + msk_xoff, yMask + msk_yoff,
-				xDst + dst_xoff, yDst + dst_yoff,
+				xSrc, ySrc, xMask, yMask, xDst, yDst,
 				width, height);
     }
 
@@ -271,22 +266,22 @@ create_conical_gradient_image (PictGradient *gradient)
 
 static pixman_image_t *
 create_bits_picture (PicturePtr pict,
-		     Bool       has_clip,
-		     int	*xoff,
-		     int	*yoff)
+		     Bool       has_clip)
 {
-    PixmapPtr pixmap;
     FbBits *bits;
     FbStride stride;
-    int bpp;
+    int bpp, xoff, yoff;
     pixman_image_t *image;
     
-    fbGetDrawablePixmap (pict->pDrawable, pixmap, *xoff, *yoff);
-    fbGetPixmapBitsData(pixmap, bits, stride, bpp);
+    fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff);
+
+    bits = (FbBits*)((CARD8*)bits +
+		     (pict->pDrawable->y + yoff) * stride * sizeof(FbBits) +
+		     (pict->pDrawable->x + xoff) * (bpp / 8));
 
     image = pixman_image_create_bits (
 	pict->format,
-	pixmap->drawable.width, pixmap->drawable.height,
+	pict->pDrawable->width, pict->pDrawable->height,
 	(uint32_t *)bits, stride * sizeof (FbStride));
     
     
@@ -312,52 +307,30 @@ create_bits_picture (PicturePtr pict,
 	if (pict->clientClipType != CT_NONE)
 	    pixman_image_set_has_client_clip (image, TRUE);
 
-	if (*xoff || *yoff)
-	    pixman_region_translate (pict->pCompositeClip, *xoff, *yoff);
+	pixman_region_translate (pict->pCompositeClip, - pict->pDrawable->x, - pict->pDrawable->y);
 
 	pixman_image_set_clip_region (image, pict->pCompositeClip);
 
-	if (*xoff || *yoff)
-	    pixman_region_translate (pict->pCompositeClip, -*xoff, -*yoff);
+	pixman_region_translate (pict->pCompositeClip, pict->pDrawable->x, pict->pDrawable->y);
     }
     
     /* Indexed table */
     if (pict->pFormat->index.devPrivate)
 	pixman_image_set_indexed (image, pict->pFormat->index.devPrivate);
 
-    /* Add in drawable origin to position within the image */
-    *xoff += pict->pDrawable->x;
-    *yoff += pict->pDrawable->y;
-
     return image;
 }
 
 static void
-set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
+set_image_properties (pixman_image_t *image, PicturePtr pict)
 {
     pixman_repeat_t repeat;
     pixman_filter_t filter;
     
     if (pict->transform)
     {
-	/* For source images, adjust the transform to account
-	 * for the drawable offset within the pixman image,
-	 * then set the offset to 0 as it will be used
-	 * to compute positions within the transformed image.
-	 */
-	if (!has_clip) {
-	    struct pixman_transform	adjusted;
-
-	    adjusted = *pict->transform;
-	    pixman_transform_translate(&adjusted,
-				       NULL,
-				       pixman_int_to_fixed(*xoff),
-				       pixman_int_to_fixed(*yoff));
-	    pixman_image_set_transform (image, &adjusted);
-	    *xoff = 0;
-	    *yoff = 0;
-	} else
-	    pixman_image_set_transform (image, pict->transform);
+	pixman_image_set_transform (
+	    image, (pixman_transform_t *)pict->transform);
     }
     
     switch (pict->repeatType)
@@ -384,8 +357,7 @@ set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int
     
     if (pict->alphaMap)
     {
-	int alpha_xoff, alpha_yoff;
-	pixman_image_t *alpha_map = image_from_pict (pict->alphaMap, FALSE, &alpha_xoff, &alpha_yoff);
+	pixman_image_t *alpha_map = image_from_pict (pict->alphaMap, TRUE);
 	
 	pixman_image_set_alpha_map (
 	    image, alpha_map, pict->alphaOrigin.x, pict->alphaOrigin.y);
@@ -418,7 +390,8 @@ set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int
 }
 
 pixman_image_t *
-image_from_pict (PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
+image_from_pict (PicturePtr pict,
+		 Bool has_clip)
 {
     pixman_image_t *image = NULL;
 
@@ -427,7 +400,7 @@ image_from_pict (PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
 
     if (pict->pDrawable)
     {
-	image = create_bits_picture (pict, has_clip, xoff, yoff);
+	image = create_bits_picture (pict, has_clip);
     }
     else if (pict->pSourcePict)
     {
@@ -448,11 +421,10 @@ image_from_pict (PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
 	    else if (sp->type == SourcePictTypeConical)
 		image = create_conical_gradient_image (gradient);
 	}
-	*xoff = *yoff = 0;
     }
     
     if (image)
-	set_image_properties (image, pict, has_clip, xoff, yoff);
+	set_image_properties (image, pict);
     
     return image;
 }
diff --git a/fb/fbtrap.c b/fb/fbtrap.c
index 9f5c39f..9c55236 100644
--- a/fb/fbtrap.c
+++ b/fb/fbtrap.c
@@ -38,8 +38,7 @@ fbAddTraps (PicturePtr	pPicture,
 	    int		ntrap,
 	    xTrap	*traps)
 {
-    int image_xoff, image_yoff;
-    pixman_image_t *image = image_from_pict (pPicture, FALSE, &image_xoff, &image_yoff);
+    pixman_image_t *image = image_from_pict (pPicture, FALSE);
 
     if (!image)
 	return;
@@ -55,8 +54,7 @@ fbRasterizeTrapezoid (PicturePtr    pPicture,
 		      int	    x_off,
 		      int	    y_off)
 {
-    int	mask_xoff, mask_yoff;
-    pixman_image_t *image = image_from_pict (pPicture, FALSE, &mask_xoff, &mask_yoff);
+    pixman_image_t *image = image_from_pict (pPicture, FALSE);
 
     if (!image)
 	return;
commit 830788b3e7a6aa4878dad6ec54ad10e71dcf96e5
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Apr 30 13:08:25 2010 -0700

    Workaround the GC clipping problem in miPaintWindow and add some debugging output.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/mi/miexpose.c b/mi/miexpose.c
index f52b492..21493cb 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -524,6 +524,7 @@ void RootlessSetPixmapOfAncestors(WindowPtr pWin);
 void RootlessStartDrawing(WindowPtr pWin);
 void RootlessDamageRegion(WindowPtr pWin, RegionPtr prgn);
 Bool IsFramedWindow(WindowPtr pWin);
+#include "../fb/fb.h"
 #endif 
 
 void
@@ -551,24 +552,37 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
     Bool	solid = TRUE;
     DrawablePtr	drawable = &pWin->drawable;
 
+#ifdef XQUARTZ_CLIP_DEBUG
+    ErrorF("START %d BS %d (pR = %ld)\n", what, pWin->backgroundState, ParentRelative);
+    ErrorF("      Rgn: %d %d %d %d\n", prgn->extents.x1, prgn->extents.y1,
+	                               prgn->extents.x2 - prgn->extents.x1,
+	                               prgn->extents.y2 - prgn->extents.y1);
+    ErrorF("      Win: %d %d (%d %d) %d %d\n", pWin->origin.x, pWin->origin.y,
+	                                       pWin->winSize.extents.x1, pWin->winSize.extents.y1,
+	                                       pWin->winSize.extents.x2 - pWin->winSize.extents.x1,
+					       pWin->winSize.extents.y2 - pWin->winSize.extents.y1);
+    ErrorF("     Draw: %d %d %d %d\n", pWin->drawable.x, pWin->drawable.y,
+				       pWin->drawable.width, pWin->drawable.height);
+#endif
+
 #ifdef ROOTLESS
     if(!drawable || drawable->type == UNDRAWABLE_WINDOW)
 	return;
-
-    if(IsFramedWindow(pWin)) {
-        RootlessStartDrawing(pWin);
-        RootlessDamageRegion(pWin, prgn);
-    
-        if(pWin->backgroundState == ParentRelative) {
-            if((what == PW_BACKGROUND) || 
-               (what == PW_BORDER && !pWin->borderIsPixel))
-                RootlessSetPixmapOfAncestors(pWin);
-        }
-    }
 #endif
     
     if (what == PW_BACKGROUND)
     {
+#ifdef ROOTLESS
+	if(IsFramedWindow(pWin)) {
+	    RootlessStartDrawing(pWin);
+	    RootlessDamageRegion(pWin, prgn);
+
+	    if(pWin->backgroundState == ParentRelative) {
+		RootlessSetPixmapOfAncestors(pWin);
+	    }
+	}
+#endif
+
 	while (pWin->backgroundState == ParentRelative)
 	    pWin = pWin->parent;
 
@@ -590,6 +604,18 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
     {
 	PixmapPtr   pixmap;
 
+#ifdef ROOTLESS
+	if(IsFramedWindow(pWin)) {
+	    RootlessStartDrawing(pWin);
+	    RootlessDamageRegion(pWin, prgn);
+	    
+	    if(!pWin->borderIsPixel &&
+		pWin->backgroundState == ParentRelative) {
+		RootlessSetPixmapOfAncestors(pWin);
+	    }
+	}
+#endif
+
 	tile_x_off = drawable->x;
 	tile_y_off = drawable->y;
 	
@@ -598,6 +624,12 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
 	    return;
 	pixmap = (*pScreen->GetWindowPixmap) ((WindowPtr) drawable);
 	drawable = &pixmap->drawable;
+
+#ifdef XQUARTZ_CLIP_DEBUG
+	ErrorF("     Draw: %d %d %d %d\n",
+	       drawable->x, drawable->y, drawable->width, drawable->height);    
+#endif
+	
 #ifdef COMPOSITE
 	draw_x_off = pixmap->screen_x;
 	draw_y_off = pixmap->screen_y;
@@ -660,6 +692,57 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
     dixChangeGC (NullClient, pGC, gcmask, NULL, gcval);
     ValidateGC (drawable, pGC);
 
+#ifdef XQUARTZ_CLIP_DEBUG
+    ErrorF("       GC: %d %d %d %d\n",
+	   pGC->pCompositeClip->extents.x1, pGC->pCompositeClip->extents.y1,
+	   pGC->pCompositeClip->extents.x2 - pGC->pCompositeClip->extents.x1,
+	   pGC->pCompositeClip->extents.y2 - pGC->pCompositeClip->extents.y1);
+#endif
+    
+#ifdef XQUARTZ
+    /* Looks like our clipping isn't set right for some reason:
+     * http://xquartz.macosforge.org/trac/ticket/290
+     */
+    if(what == PW_BORDER) {
+
+#if 0
+	if(solid) {
+#if 1
+	    fbFillRegionSolid(&pWin->drawable,
+			      prgn,
+			      0,
+			      fbReplicatePixel(fill.pixel,
+					       pWin->drawable.bitsPerPixel));
+#else
+	    fbFillRegionSolid(drawable,
+			      prgn,
+			      0,
+			      fbReplicatePixel(fill.pixel,
+					       drawable->bitsPerPixel));
+#endif
+	    return;
+	}
+#endif
+    
+	pGC->pCompositeClip->extents.x1 += prgn->extents.x1;
+	pGC->pCompositeClip->extents.y1 += prgn->extents.y1;
+	pGC->pCompositeClip->extents.x2 += prgn->extents.x1;
+	pGC->pCompositeClip->extents.y2 += prgn->extents.y1;
+	
+	if(pGC->pCompositeClip->extents.x2 > drawable->pScreen->width)
+	    pGC->pCompositeClip->extents.x2 = drawable->pScreen->width;
+	if(pGC->pCompositeClip->extents.y2 > drawable->pScreen->height)
+	    pGC->pCompositeClip->extents.y2 = drawable->pScreen->height;
+    }
+#endif
+
+#ifdef XQUARTZ_CLIP_DEBUG
+    ErrorF("       GC: %d %d %d %d\n",
+	   pGC->pCompositeClip->extents.x1, pGC->pCompositeClip->extents.y1,
+	   pGC->pCompositeClip->extents.x2 - pGC->pCompositeClip->extents.x1,
+	   pGC->pCompositeClip->extents.y2 - pGC->pCompositeClip->extents.y1);    
+#endif
+
     numRects = REGION_NUM_RECTS(prgn);
     pbox = REGION_RECTS(prgn);
     for (i= numRects; --i >= 0; pbox++, prect++)
commit 0efd7b8d82a48793341e27d4c224986e0971687c
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Tue Apr 27 13:14:47 2010 -0700

    XQuartz GLX: Change around includes for better compatability with different OS versions
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index 70558ed..ad9ebbd 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -42,6 +42,8 @@
 #define GL_GLEXT_WUNDEF_SUPPORT
 
 #include <OpenGL/OpenGL.h>
+#include <OpenGL/gl.h>
+#include <OpenGL/glext.h>
 #include <OpenGL/CGLContext.h>
 
 /* These next few GL_EXT pre-processing blocks are to explicitly define 
diff --git a/hw/xquartz/GL/visualConfigs.c b/hw/xquartz/GL/visualConfigs.c
index bef27f0..cecc902 100644
--- a/hw/xquartz/GL/visualConfigs.c
+++ b/hw/xquartz/GL/visualConfigs.c
@@ -35,9 +35,10 @@
 #include "dri.h"
 
 #include <OpenGL/OpenGL.h>
+#include <OpenGL/gl.h>
+#include <OpenGL/glext.h>
 #include <OpenGL/CGLContext.h>
 
-#include <GL/gl.h>
 #include <GL/glxproto.h>
 #include <windowstr.h>
 #include <resource.h>
commit 7b506fdc840aebed6b5acb91437a2cb620b5bddc
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Apr 21 08:38:53 2010 -0700

    rootless: Add some sanity checking to miPaintWindow
    
    This avoids painting the root window when it isn't actually drawable.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/mi/miexpose.c b/mi/miexpose.c
index 1c9c3a4..f52b492 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -552,6 +552,9 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
     DrawablePtr	drawable = &pWin->drawable;
 
 #ifdef ROOTLESS
+    if(!drawable || drawable->type == UNDRAWABLE_WINDOW)
+	return;
+
     if(IsFramedWindow(pWin)) {
         RootlessStartDrawing(pWin);
         RootlessDamageRegion(pWin, prgn);
commit 4d3789c9b3fbe6aad32fcacd964353b612640f27
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sun Apr 18 01:22:27 2010 -0700

    rootless: Remove an unneeded comment
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c
index e78e2c8..55c7b96 100644
--- a/miext/rootless/rootlessWindow.c
+++ b/miext/rootless/rootlessWindow.c
@@ -1553,10 +1553,6 @@ RootlessDisableRoot (ScreenPtr pScreen)
 	return;
            
     RootlessDestroyFrame (pRoot, winRec);
-    /* 
-     * gstaplin: I fixed the usage of this DeleteProperty so that it would compile.
-     * QUESTION: Where is this xa_native_window_id set?
-     */
     DeleteProperty (serverClient, pRoot, xa_native_window_id ());
 }
 
commit 048d15192af39ba5111882d18a957b6ff4e34cad
Author: Oliver McFadden <oliver.mcfadden at nokia.com>
Date:   Thu Apr 22 10:29:44 2010 +0300

    x-list.c: null-returning function malloc() was called without checking
    
    Signed-off-by: Oliver McFadden <oliver.mcfadden at nokia.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/xpr/x-list.c b/hw/xquartz/xpr/x-list.c
index 3596dd3..77c9309 100644
--- a/hw/xquartz/xpr/x-list.c
+++ b/hw/xquartz/xpr/x-list.c
@@ -97,6 +97,7 @@ X_PFX (list_prepend) (x_list *lst, void *data)
         int i;
 
         b = malloc (sizeof (x_list_block));
+        assert(b != NULL);
 
         for (i = 0; i < NODES_PER_BLOCK - 1; i++)
             b->l[i].next = &(b->l[i+1]);
commit 40858960c02a7694b0e1b72e2a986805580ff6f1
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Apr 29 12:24:51 2010 -0700

    Delete loop with no effect from GlyphUninit
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>

diff --git a/render/glyph.c b/render/glyph.c
index f0f3b19..6b81118 100644
--- a/render/glyph.c
+++ b/render/glyph.c
@@ -113,15 +113,6 @@ GlyphUninit (ScreenPtr pScreen)
 	    }
 	}
     }
-
-    for (fdepth = 0; fdepth < GlyphFormatNum; fdepth++)
-    {
-	if (!globalGlyphs[fdepth].hashSet)
-	    continue;
-	
-	for (i = 0; i < globalGlyphs[fdepth].hashSet->size; i++)
-	    glyph = globalGlyphs[fdepth].table[i].glyph;    
-    }
 }
 
 GlyphHashSetPtr
commit 65e961fcc1da0f1e6c1c477701b2eeb36955ed24
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Apr 29 12:24:49 2010 -0700

    Replace some input devPrivates with regular struct fields
    
    In the process, fixes a memory leak in CloseDevice, and an unchecked
    memory allocation in InitializePredictableAccelerationProperties.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>

diff --git a/Xi/exevents.c b/Xi/exevents.c
index e680f6f..949efe7 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -94,9 +94,6 @@ Bool ShouldFreeInputMasks(WindowPtr /* pWin */ ,
 static Bool MakeInputMasks(WindowPtr	/* pWin */
     );
 
-/* Used to sture classes currently not in use by an MD */
-extern DevPrivateKey UnusedClassesPrivateKey;
-
 /*
  * Only let the given client know of core events which will affect its
  * interpretation of input events, if the client's ClientPointer (or the
@@ -228,8 +225,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
 
         if (!to->intfeed)
         {
-            classes = dixLookupPrivate(&to->devPrivates,
-                                       UnusedClassesPrivateKey);
+            classes = to->unused_classes;
             to->intfeed = classes->intfeed;
         }
 
@@ -253,7 +249,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
     } else if (to->intfeed && !from->intfeed)
     {
         ClassesPtr classes;
-        classes = dixLookupPrivate(&to->devPrivates, UnusedClassesPrivateKey);
+        classes = to->unused_classes;
         classes->intfeed = to->intfeed;
         to->intfeed      = NULL;
     }
@@ -264,8 +260,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
 
         if (!to->stringfeed)
         {
-            classes = dixLookupPrivate(&to->devPrivates,
-                                       UnusedClassesPrivateKey);
+            classes = to->unused_classes;
             to->stringfeed = classes->stringfeed;
         }
 
@@ -289,7 +284,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
     } else if (to->stringfeed && !from->stringfeed)
     {
         ClassesPtr classes;
-        classes = dixLookupPrivate(&to->devPrivates, UnusedClassesPrivateKey);
+        classes = to->unused_classes;
         classes->stringfeed = to->stringfeed;
         to->stringfeed      = NULL;
     }
@@ -300,8 +295,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
 
         if (!to->bell)
         {
-            classes = dixLookupPrivate(&to->devPrivates,
-                                       UnusedClassesPrivateKey);
+            classes = to->unused_classes;
             to->bell = classes->bell;
         }
 
@@ -326,7 +320,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
     } else if (to->bell && !from->bell)
     {
         ClassesPtr classes;
-        classes = dixLookupPrivate(&to->devPrivates, UnusedClassesPrivateKey);
+        classes = to->unused_classes;
         classes->bell = to->bell;
         to->bell      = NULL;
     }
@@ -337,8 +331,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
 
         if (!to->leds)
         {
-            classes = dixLookupPrivate(&to->devPrivates,
-                                       UnusedClassesPrivateKey);
+            classes = to->unused_classes;
             to->leds = classes->leds;
         }
 
@@ -365,7 +358,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
     } else if (to->leds && !from->leds)
     {
         ClassesPtr classes;
-        classes = dixLookupPrivate(&to->devPrivates, UnusedClassesPrivateKey);
+        classes = to->unused_classes;
         classes->leds = to->leds;
         to->leds      = NULL;
     }
@@ -385,8 +378,7 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to)
 
         if (!to->kbdfeed)
         {
-            classes = dixLookupPrivate(&to->devPrivates,
-                                       UnusedClassesPrivateKey);
+            classes = to->unused_classes;
 
             to->kbdfeed = classes->kbdfeed;
             if (!to->kbdfeed)
@@ -417,7 +409,7 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to)
     } else if (to->kbdfeed && !from->kbdfeed)
     {
         ClassesPtr classes;
-        classes = dixLookupPrivate(&to->devPrivates, UnusedClassesPrivateKey);
+        classes = to->unused_classes;
         classes->kbdfeed = to->kbdfeed;
         to->kbdfeed      = NULL;
     }
@@ -426,8 +418,7 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to)
     {
         if (!to->key)
         {
-            classes = dixLookupPrivate(&to->devPrivates,
-                    UnusedClassesPrivateKey);
+            classes = to->unused_classes;
             to->key = classes->key;
             if (!to->key)
                 InitKeyboardDeviceStruct(to, NULL, NULL, NULL);
@@ -439,7 +430,7 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to)
     } else if (to->key && !from->key)
     {
         ClassesPtr classes;
-        classes = dixLookupPrivate(&to->devPrivates, UnusedClassesPrivateKey);
+        classes = to->unused_classes;
         classes->key = to->key;
         to->key      = NULL;
     }
@@ -476,8 +467,7 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to)
         {
             WindowPtr *oldTrace;
 
-            classes = dixLookupPrivate(&to->devPrivates,
-                                       UnusedClassesPrivateKey);
+            classes = to->unused_classes;
             to->focus = classes->focus;
             if (!to->focus)
             {
@@ -500,7 +490,7 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to)
     } else if (to->focus)
     {
         ClassesPtr classes;
-        classes = dixLookupPrivate(&to->devPrivates, UnusedClassesPrivateKey);
+        classes = to->unused_classes;
         classes->focus = to->focus;
         to->focus      = NULL;
     }
@@ -518,8 +508,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
         PtrFeedbackPtr *p, it;
         if (!to->ptrfeed)
         {
-            classes = dixLookupPrivate(&to->devPrivates,
-                                       UnusedClassesPrivateKey);
+            classes = to->unused_classes;
             to->ptrfeed = classes->ptrfeed;
         }
 
@@ -543,7 +532,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
     } else if (to->ptrfeed && !from->ptrfeed)
     {
         ClassesPtr classes;
-        classes = dixLookupPrivate(&to->devPrivates, UnusedClassesPrivateKey);
+        classes = to->unused_classes;
         classes->ptrfeed = to->ptrfeed;
         to->ptrfeed      = NULL;
     }
@@ -553,8 +542,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
         ValuatorClassPtr v;
         if (!to->valuator)
         {
-            classes = dixLookupPrivate(&to->devPrivates,
-                                       UnusedClassesPrivateKey);
+            classes = to->unused_classes;
             to->valuator = classes->valuator;
             if (to->valuator)
                 classes->valuator = NULL;
@@ -577,7 +565,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
     } else if (to->valuator && !from->valuator)
     {
         ClassesPtr classes;
-        classes = dixLookupPrivate(&to->devPrivates, UnusedClassesPrivateKey);
+        classes = to->unused_classes;
         classes->valuator = to->valuator;
         to->valuator      = NULL;
     }
@@ -586,8 +574,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
     {
         if (!to->button)
         {
-            classes = dixLookupPrivate(&to->devPrivates,
-                                       UnusedClassesPrivateKey);
+            classes = to->unused_classes;
             to->button = classes->button;
             if (!to->button)
             {
@@ -617,7 +604,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
     } else if (to->button && !from->button)
     {
         ClassesPtr classes;
-        classes = dixLookupPrivate(&to->devPrivates, UnusedClassesPrivateKey);
+        classes = to->unused_classes;
         classes->button = to->button;
         to->button      = NULL;
     }
@@ -626,8 +613,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
     {
         if (!to->proximity)
         {
-            classes = dixLookupPrivate(&to->devPrivates,
-                                       UnusedClassesPrivateKey);
+            classes = to->unused_classes;
             to->proximity = classes->proximity;
             if (!to->proximity)
             {
@@ -642,7 +628,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
     } else if (to->proximity)
     {
         ClassesPtr classes;
-        classes = dixLookupPrivate(&to->devPrivates, UnusedClassesPrivateKey);
+        classes = to->unused_classes;
         classes->proximity = to->proximity;
         to->proximity      = NULL;
     }
@@ -651,8 +637,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
     {
         if (!to->absolute)
         {
-            classes = dixLookupPrivate(&to->devPrivates,
-                                       UnusedClassesPrivateKey);
+            classes = to->unused_classes;
             to->absolute = classes->absolute;
             if (!to->absolute)
             {
@@ -667,7 +652,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
     } else if (to->absolute)
     {
         ClassesPtr classes;
-        classes = dixLookupPrivate(&to->devPrivates, UnusedClassesPrivateKey);
+        classes = to->unused_classes;
         classes->absolute = to->absolute;
         to->absolute      = NULL;
     }
diff --git a/dix/devices.c b/dix/devices.c
index 6119dce..1386491 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -89,13 +89,6 @@ SOFTWARE.
  * This file handles input device-related stuff.
  */
 
-static int CoreDevicePrivateKeyIndex;
-DevPrivateKey CoreDevicePrivateKey = &CoreDevicePrivateKeyIndex;
-/* Used to store classes currently not in use by an MD */
-static int UnusedClassesPrivateKeyIndex;
-DevPrivateKey UnusedClassesPrivateKey = &UnusedClassesPrivateKeyIndex;
-
-
 static void RecalculateMasterButtons(DeviceIntPtr slave);
 
 /**
@@ -852,8 +845,9 @@ CloseDevice(DeviceIntPtr dev)
 
     if (IsMaster(dev))
     {
-        classes = dixLookupPrivate(&dev->devPrivates, UnusedClassesPrivateKey);
+        classes = dev->unused_classes;
         FreeAllDeviceClasses(classes);
+	xfree(classes);
     }
 
     if (DevHasCursor(dev) && dev->spriteInfo->sprite) {
@@ -2465,7 +2459,6 @@ AllocDevicePair (ClientPtr client, char* name,
 {
     DeviceIntPtr pointer;
     DeviceIntPtr keyboard;
-    ClassesPtr classes;
     *ptr = *keybd = NULL;
 
     pointer = AddInputDevice(client, ptr_proc, TRUE);
@@ -2511,12 +2504,9 @@ AllocDevicePair (ClientPtr client, char* name,
     keyboard->last.slave = NULL;
     keyboard->type = (master) ? MASTER_KEYBOARD : SLAVE;
 
-
     /* The ClassesRec stores the device classes currently not used. */
-    classes = xcalloc(1, sizeof(ClassesRec));
-    dixSetPrivate(&pointer->devPrivates, UnusedClassesPrivateKey, classes);
-    classes = xcalloc(1, sizeof(ClassesRec));
-    dixSetPrivate(&keyboard->devPrivates, UnusedClassesPrivateKey, classes);
+    pointer->unused_classes = xcalloc(1, sizeof(ClassesRec));
+    keyboard->unused_classes = xcalloc(1, sizeof(ClassesRec));
 
     *ptr = pointer;
     *keybd = keyboard;
diff --git a/dix/events.c b/dix/events.c
index b26e28a..60dd162 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1408,12 +1408,8 @@ CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode)
     ComputeFreezes();
 }
 
-/* Only ever used if a grab is called on an attached slave device. */
-static int GrabPrivateKeyIndex;
-static DevPrivateKey GrabPrivateKey = &GrabPrivateKeyIndex;
-
 /**
- * Save the device's master device in the devPrivates. This needs to be done
+ * Save the device's master device id. This needs to be done
  * if a client directly grabs a slave device that is attached to a master. For
  * the duration of the grab, the device is detached, ungrabbing re-attaches it
  * though.
@@ -1424,35 +1420,28 @@ static DevPrivateKey GrabPrivateKey = &GrabPrivateKeyIndex;
 static void
 DetachFromMaster(DeviceIntPtr dev)
 {
-    intptr_t id;
     if (!dev->u.master)
         return;
 
-    id = dev->u.master->id;
+    dev->saved_master_id = dev->u.master->id;
 
-    dixSetPrivate(&dev->devPrivates, GrabPrivateKey, (void *)id);
     AttachDevice(NULL, dev, NULL);
 }
 
 static void
 ReattachToOldMaster(DeviceIntPtr dev)
 {
-    int id;
-    void *p;
     DeviceIntPtr master = NULL;
 
     if (IsMaster(dev))
         return;
 
-
-    p = dixLookupPrivate(&dev->devPrivates, GrabPrivateKey);
-    id = (intptr_t) p; /* silence gcc warnings */
-    dixLookupDevice(&master, id, serverClient, DixUseAccess);
+    dixLookupDevice(&master, dev->saved_master_id, serverClient, DixUseAccess);
 
     if (master)
     {
         AttachDevice(serverClient, dev, master);
-        dixSetPrivate(&dev->devPrivates, GrabPrivateKey, NULL);
+	dev->saved_master_id = 0;
     }
 }
 
diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c
index c2f4378..100d6f8 100644
--- a/dix/ptrveloc.c
+++ b/dix/ptrveloc.c
@@ -83,8 +83,6 @@ GetAccelerationProfile(DeviceVelocityPtr vel, int profile_num);
 /* some int which is not a profile number */
 #define PROFILE_UNINITIALIZE (-100)
 
-/* number of properties for predictable acceleration */
-#define NPROPS_PREDICTABLE_ACCEL 4
 
 /**
  * Init struct so it should match the average case
@@ -323,26 +321,18 @@ AccelInitScaleProperty(DeviceIntPtr dev, DeviceVelocityPtr vel)
     return XIRegisterPropertyHandler(dev, AccelSetScaleProperty, NULL, NULL);
 }
 
-static int AccelPropHandlerPrivateKeyIndex;
-DevPrivateKey AccelPropHandlerPrivateKey = &AccelPropHandlerPrivateKeyIndex;
-
 BOOL
 InitializePredictableAccelerationProperties(DeviceIntPtr dev)
 {
     DeviceVelocityPtr  vel = GetDevicePredictableAccelData(dev);
-    long *prop_handlers;
 
     if(!vel)
 	return FALSE;
-    prop_handlers = xalloc(NPROPS_PREDICTABLE_ACCEL * sizeof(long));
-
-    prop_handlers[0] = AccelInitProfileProperty(dev, vel);
-    prop_handlers[1] = AccelInitDecelProperty(dev, vel);
-    prop_handlers[2] = AccelInitAdaptDecelProperty(dev, vel);
-    prop_handlers[3] = AccelInitScaleProperty(dev, vel);
 
-    dixSetPrivate(&dev->devPrivates, AccelPropHandlerPrivateKey,
-                  prop_handlers);
+    vel->prop_handlers[0] = AccelInitProfileProperty(dev, vel);
+    vel->prop_handlers[1] = AccelInitDecelProperty(dev, vel);
+    vel->prop_handlers[2] = AccelInitAdaptDecelProperty(dev, vel);
+    vel->prop_handlers[3] = AccelInitScaleProperty(dev, vel);
 
     return TRUE;
 }
@@ -350,8 +340,8 @@ InitializePredictableAccelerationProperties(DeviceIntPtr dev)
 BOOL
 DeletePredictableAccelerationProperties(DeviceIntPtr dev)
 {
+    DeviceVelocityPtr  vel;
     Atom prop;
-    long *prop_handlers;
     int i;
 
     prop = XIGetKnownProperty(ACCEL_PROP_VELOCITY_SCALING);
@@ -363,13 +353,10 @@ DeletePredictableAccelerationProperties(DeviceIntPtr dev)
     prop = XIGetKnownProperty(ACCEL_PROP_PROFILE_NUMBER);
     XIDeleteDeviceProperty(dev, prop, FALSE);
 
-    prop_handlers = dixLookupPrivate(&dev->devPrivates,
-                                     AccelPropHandlerPrivateKey);
-    dixSetPrivate(&dev->devPrivates, AccelPropHandlerPrivateKey, NULL);
-
-    for (i = 0; prop_handlers && i < NPROPS_PREDICTABLE_ACCEL; i++)
-        XIUnregisterPropertyHandler(dev, prop_handlers[i]);
-    xfree(prop_handlers);
+    vel = GetDevicePredictableAccelData(dev);
+    for (i = 0; vel && i < NPROPS_PREDICTABLE_ACCEL; i++)
+	if (vel->prop_handlers[i])
+	    XIUnregisterPropertyHandler(dev, vel->prop_handlers[i]);
 
     return TRUE;
 }
diff --git a/include/inputstr.h b/include/inputstr.h
index de4026c..6da3f38 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -514,8 +514,9 @@ typedef struct _DeviceIntRec {
     LedFeedbackPtr	leds;
     struct _XkbInterest *xkb_interest;
     char                *config_info; /* used by the hotplug layer */
+    ClassesPtr		unused_classes; /* for master devices */
+    int			saved_master_id;	/* for slaves while grabbed */
     PrivateRec		*devPrivates;
-    int			nPrivates;
     DeviceUnwrapProc    unwrapProc;
     SpriteInfoPtr       spriteInfo;
     union {
diff --git a/include/ptrveloc.h b/include/ptrveloc.h
index 676c464..6f999a8 100644
--- a/include/ptrveloc.h
+++ b/include/ptrveloc.h
@@ -62,6 +62,9 @@ typedef struct _MotionTracker {
     int dir;        /* initial direction bitfield */
 } MotionTracker, *MotionTrackerPtr;
 
+/* number of properties for predictable acceleration */
+#define NPROPS_PREDICTABLE_ACCEL 4
+
 /**
  * Contains all data needed to implement mouse ballistics
  */
@@ -88,9 +91,9 @@ typedef struct _DeviceVelocityRec {
     struct {   /* to be able to query this information */
         int     profile_number;
     } statistics;
+    long    prop_handlers[NPROPS_PREDICTABLE_ACCEL];
 } DeviceVelocityRec, *DeviceVelocityPtr;
 
-
 extern _X_EXPORT void
 InitVelocityData(DeviceVelocityPtr vel);
 
commit 998e982b775073da59412dce8ce609ea2ad7967c
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Apr 29 12:24:48 2010 -0700

    Move callback definitions to their own file
    
    Needed as the privates stuff uses the callbacks before they would have
    been defined in dix.h
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>

diff --git a/include/Makefile.am b/include/Makefile.am
index eddc86c..e76de05 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -3,6 +3,7 @@ sdk_HEADERS =		\
 	XIstubs.h	\
 	bstore.h	\
 	bstorestr.h	\
+	callback.h	\
 	closestr.h	\
 	closure.h	\
 	colormap.h	\
diff --git a/include/callback.h b/include/callback.h
new file mode 100644
index 0000000..632ed4f
--- /dev/null
+++ b/include/callback.h
@@ -0,0 +1,87 @@
+/***********************************************************
+
+Copyright 1987, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+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
+OPEN GROUP 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 of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+******************************************************************/
+
+#ifndef CALLBACK_H
+#define CALLBACK_H
+
+#include <X11/X.h>	/* for GContext, Mask */
+#include <X11/Xdefs.h>	/* for Bool */
+#include <X11/Xproto.h>
+#include <X11/Xfuncproto.h>
+
+/*
+ *  callback manager stuff
+ */
+
+#ifndef _XTYPEDEF_CALLBACKLISTPTR
+typedef struct _CallbackList *CallbackListPtr; /* also in misc.h */
+#define _XTYPEDEF_CALLBACKLISTPTR
+#endif
+
+typedef void (*CallbackProcPtr) (
+    CallbackListPtr *, pointer, pointer);
+
+extern _X_EXPORT Bool AddCallback(
+    CallbackListPtr * /*pcbl*/,
+    CallbackProcPtr /*callback*/,
+    pointer /*data*/);
+
+extern _X_EXPORT Bool DeleteCallback(
+    CallbackListPtr * /*pcbl*/,
+    CallbackProcPtr /*callback*/,
+    pointer /*data*/);
+
+extern _X_EXPORT void CallCallbacks(
+    CallbackListPtr * /*pcbl*/,
+    pointer /*call_data*/);
+
+extern _X_EXPORT void DeleteCallbackList(
+    CallbackListPtr * /*pcbl*/);
+
+extern _X_EXPORT void InitCallbackManager(void);
+
+#endif /* CALLBACK_H */
diff --git a/include/dix.h b/include/dix.h
index 6505fd0..dc86257 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -48,6 +48,7 @@ SOFTWARE.
 #ifndef DIX_H
 #define DIX_H
 
+#include "callback.h"
 #include "gc.h"
 #include "window.h"
 #include "input.h"
@@ -512,36 +513,6 @@ ScreenRestructured (ScreenPtr pScreen);
 
 extern _X_EXPORT int ffs(int i);
 
-/*
- *  callback manager stuff
- */
-
-#ifndef _XTYPEDEF_CALLBACKLISTPTR
-typedef struct _CallbackList *CallbackListPtr; /* also in misc.h */
-#define _XTYPEDEF_CALLBACKLISTPTR
-#endif
-
-typedef void (*CallbackProcPtr) (
-    CallbackListPtr *, pointer, pointer);
-
-extern _X_EXPORT Bool AddCallback(
-    CallbackListPtr * /*pcbl*/,
-    CallbackProcPtr /*callback*/,
-    pointer /*data*/);
-
-extern _X_EXPORT Bool DeleteCallback(
-    CallbackListPtr * /*pcbl*/,
-    CallbackProcPtr /*callback*/,
-    pointer /*data*/);
-
-extern _X_EXPORT void CallCallbacks(
-    CallbackListPtr * /*pcbl*/,
-    pointer /*call_data*/);
-
-extern _X_EXPORT void DeleteCallbackList(
-    CallbackListPtr * /*pcbl*/);
-
-extern _X_EXPORT void InitCallbackManager(void);
 
 /*
  *  ServerGrabCallback stuff
commit 7dde50c649089b03650d6497079a690feea65e22
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Apr 29 12:24:47 2010 -0700

    Move X_DEPRECATED to misc.h so it can be used outside resource.h
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>

diff --git a/include/misc.h b/include/misc.h
index 62d813e..c7add25 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -100,6 +100,12 @@ typedef unsigned long ATOM;
 #define FALSE 0
 #endif
 
+#ifdef __GNUC__
+#define X_DEPRECATED __attribute__((deprecated))
+#else
+#define X_DEPRECATED
+#endif
+
 #ifndef _XTYPEDEF_CALLBACKLISTPTR
 typedef struct _CallbackList *CallbackListPtr; /* also in dix.h */
 #define _XTYPEDEF_CALLBACKLISTPTR
diff --git a/include/resource.h b/include/resource.h
index 7948af5..56450d6 100644
--- a/include/resource.h
+++ b/include/resource.h
@@ -251,12 +251,6 @@ extern _X_EXPORT RESTYPE TypeMask;
  * Please use the noted replacements instead.
  */
 
-#ifdef __GNUC__
-#define X_DEPRECATED __attribute__((deprecated))
-#else
-#define X_DEPRECATED
-#endif
-
 /* replaced by dixLookupResourceByType */
 extern _X_EXPORT pointer SecurityLookupIDByType(
     ClientPtr client,


More information about the Xquartz-changes mailing list