[Xquartz-changes] xserver: Branch 'server-1.11-apple' - 20 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Fri Jan 6 23:54:15 PST 2012


Rebased ref, commits from common ancestor:
commit cfb3b5b301a5addc8c420b010151c6b364d859d8
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Jan 6 23:51:26 2012 -0800

    902
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/configure.ac b/configure.ac
index 07d89b5..a9004b1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,7 +26,7 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.57)
-AC_INIT([xorg-server], 1.11.3.901, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+AC_INIT([xorg-server], 1.11.3.902, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
 RELEASE_DATE="2012-01-06"
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
commit 77eed70f3865e2b513b49c9d76619990181b9ffc
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 eaa21ad..e65a1c0 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -2049,11 +2049,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 57c93fd..127e5c7 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -50,24 +50,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);
     if (pMask)
 	miCompositeSourceValidate (pMask);
     
-    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);
     }
 
@@ -146,22 +141,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 (
 	(pixman_format_code_t)pict->format,
-	pixmap->drawable.width, pixmap->drawable.height,
+	pict->pDrawable->width, pict->pDrawable->height,
 	(uint32_t *)bits, stride * sizeof (FbStride));
 
     if (!image)
@@ -189,55 +184,33 @@ 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 pixman_image_t *
-image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map);
+image_from_pict_internal (PicturePtr pict, Bool has_clip, Bool is_alpha_map);
 
 static void
-set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map)
+set_image_properties (pixman_image_t *image, PicturePtr pict, Bool is_alpha_map)
 {
     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)
@@ -267,8 +240,7 @@ set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int
      */
     if (pict->alphaMap && !is_alpha_map)
     {
-	int alpha_xoff, alpha_yoff;
-	pixman_image_t *alpha_map = image_from_pict_internal (pict->alphaMap, FALSE, &alpha_xoff, &alpha_yoff, TRUE);
+	pixman_image_t *alpha_map = image_from_pict_internal (pict->alphaMap, TRUE, TRUE);
 	
 	pixman_image_set_alpha_map (
 	    image, alpha_map, pict->alphaOrigin.x, pict->alphaOrigin.y);
@@ -301,7 +273,8 @@ set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int
 }
 
 static pixman_image_t *
-image_from_pict_internal (PicturePtr pict, Bool has_clip, int *xoff, int *yoff, Bool is_alpha_map)
+image_from_pict_internal (PicturePtr pict,
+		 Bool has_clip, Bool is_alpha_map)
 {
     pixman_image_t *image = NULL;
 
@@ -310,7 +283,7 @@ image_from_pict_internal (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)
     {
@@ -331,19 +304,18 @@ image_from_pict_internal (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, is_alpha_map);
+	set_image_properties (image, pict, is_alpha_map);
     
     return image;
 }
 
 pixman_image_t *
-image_from_pict (PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
+image_from_pict (PicturePtr pict, Bool has_clip)
 {
-    return image_from_pict_internal (pict, has_clip, xoff, yoff, FALSE);
+    return image_from_pict_internal (pict, has_clip, FALSE);
 }
 
 void
diff --git a/fb/fbtrap.c b/fb/fbtrap.c
index 0b5a638..fbe2647 100644
--- a/fb/fbtrap.c
+++ b/fb/fbtrap.c
@@ -39,12 +39,11 @@ fbAddTraps (PicturePtr	pPicture,
 	    xTrap	*traps)
 {
     pixman_image_t *image;
-    int dst_xoff, dst_yoff;
 
-    if (!(image = image_from_pict (pPicture, FALSE, &dst_xoff, &dst_yoff)))
+    if (!(image = image_from_pict (pPicture, FALSE)))
 	return;
     
-    pixman_add_traps (image, x_off + dst_xoff, y_off + dst_yoff,
+    pixman_add_traps (image, x_off, y_off,
 		      ntrap, (pixman_trap_t *)traps);
 
     free_pixman_pict (pPicture, image);
@@ -57,14 +56,13 @@ fbRasterizeTrapezoid (PicturePtr    pPicture,
 		      int	    y_off)
 {
     pixman_image_t *image;
-    int	dst_xoff, dst_yoff;
 
-    if (!(image = image_from_pict (pPicture, FALSE, &dst_xoff, &dst_yoff)))
+    if (!(image = image_from_pict (pPicture, FALSE)))
 	return;
 
     pixman_rasterize_trapezoid (image, (pixman_trapezoid_t *)trap,
-				x_off + dst_xoff,
-				y_off + dst_yoff);
+				x_off,
+				y_off);
 
     free_pixman_pict (pPicture, image);
 }
@@ -77,13 +75,12 @@ fbAddTriangles (PicturePtr  pPicture,
 		xTriangle *tris)
 {
     pixman_image_t *image;
-    int dst_xoff, dst_yoff;
 
-    if (!(image = image_from_pict (pPicture, FALSE, &dst_xoff, &dst_yoff)))
+    if (!(image = image_from_pict (pPicture, FALSE)))
 	return;
     
     pixman_add_triangles (image,
-			  dst_xoff + x_off, dst_yoff + y_off,
+			  x_off, y_off,
 			  ntri, (pixman_triangle_t *)tris);
 
     free_pixman_pict (pPicture, image);
@@ -110,13 +107,11 @@ fbShapes (CompositeShapesFunc	composite,
 	  const uint8_t *	shapes)
 {
     pixman_image_t *src, *dst;
-    int src_xoff, src_yoff;
-    int dst_xoff, dst_yoff;
 
     miCompositeSourceValidate (pSrc);
 
-    src = image_from_pict (pSrc, FALSE, &src_xoff, &src_yoff);
-    dst = image_from_pict (pDst, TRUE, &dst_xoff, &dst_yoff);
+    src = image_from_pict (pSrc, FALSE);
+    dst = image_from_pict (pDst, TRUE);
 
     if (src && dst)
     {
@@ -136,10 +131,10 @@ fbShapes (CompositeShapesFunc	composite,
 	    for (i = 0; i < nshapes; ++i)
 	    {
 		composite (op, src, dst, format,
-			   xSrc + src_xoff,
-			   ySrc + src_yoff,
-			   dst_xoff,
-			   dst_yoff,
+			   xSrc,
+			   ySrc,
+			   0,
+			   0,
 			   1, shapes + i * shape_size);
 	    }
 	}
@@ -162,10 +157,10 @@ fbShapes (CompositeShapesFunc	composite,
 	    }
 	    
 	    composite (op, src, dst, format,
-		       xSrc + src_xoff,
-		       ySrc + src_yoff,
-		       dst_xoff,
-		       dst_yoff,
+		       xSrc,
+		       ySrc,
+		       0,
+		       0,
 		       nshapes, shapes);
 	}
 
commit 05489f83c027dbfcec3ffc0957de14a53c17980f
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 0f1ebe5..dcbfe1c 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -521,6 +521,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
@@ -548,24 +549,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;
 
@@ -591,6 +605,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;
 	
@@ -599,6 +625,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;
@@ -661,6 +693,57 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
     ChangeGC (NullClient, pGC, gcmask, 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 = RegionNumRects(prgn);
     pbox = RegionRects(prgn);
     for (i= numRects; --i >= 0; pbox++, prect++)
commit 3291cee172e1c19babfee9fed53cbda4f825b779
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Oct 30 14:55:06 2010 -0700

    configure.ac: Add -fno-strict-aliasing to CFLAGS
    
    This should address https://bugs.freedesktop.org/show_bug.cgi?id=31238
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/configure.ac b/configure.ac
index fdaa583..07d89b5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -87,6 +87,12 @@ XORG_PROG_RAWCPP
 # easier overrides at build time.
 XSERVER_CFLAGS='$(CWARNFLAGS)'
 
+dnl Explicitly add -fno-strict-aliasing since this option should disappear
+dnl from util-macros CWARNFLAGS
+if  test "x$GCC" = xyes ; then
+    XSERVER_CFLAGS="$XSERVER_CFLAGS -fno-strict-aliasing"
+fi
+
 dnl Check for dtrace program (needed to build Xserver dtrace probes)
 dnl Also checks for <sys/sdt.h>, since some Linux distros have an 
 dnl ISDN trace program named dtrace
commit cea9f9f273cb525cb5daa2d2819d3f635582cb24
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Jan 6 22:01:03 2012 -0800

    configure.ac: 1.11.3.901 (1.11.4 RC1)
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/configure.ac b/configure.ac
index a871529..fdaa583 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,8 +26,8 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.57)
-AC_INIT([xorg-server], 1.11.3, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2011-12-16"
+AC_INIT([xorg-server], 1.11.3.901, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2012-01-06"
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
commit b15be8547d4d204f3e498f52d86713a76766e871
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Jan 6 22:12:14 2012 -0800

    Xi: Fix mishandled git merge
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
index 4a15d5c..3facadd 100644
--- a/Xi/xichangehierarchy.c
+++ b/Xi/xichangehierarchy.c
@@ -216,19 +216,6 @@ disable_clientpointer(DeviceIntPtr dev)
 }
 
 static int
-disable_clientpointer(DeviceIntPtr dev)
-{
-    int i;
-
-    for (i = 0; i < currentMaxClients; i++)
-    {
-        ClientPtr client = clients[i];
-        if (client && client->clientPtr == dev)
-            client->clientPtr = NULL;
-    }
-}
-
-static int
 remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
               int flags[MAXDEVICES])
 {
commit 82e0ae042379181eb143431e1413084432a17079
Merge: f9b00c2 4e4bb31
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Mon Jan 2 20:58:22 2012 -0500

    Merge remote-tracking branch 'whot/server-1.11-branch' into server-1.11-branch

diff --cc Xi/xichangehierarchy.c
index dfcd52f,3facadd..4a15d5c
--- a/Xi/xichangehierarchy.c
+++ b/Xi/xichangehierarchy.c
@@@ -202,20 -202,20 +202,33 @@@ unwind
      return rc;
  }
  
+ static void
+ disable_clientpointer(DeviceIntPtr dev)
+ {
+     int i;
+ 
+     for (i = 0; i < currentMaxClients; i++)
+     {
+         ClientPtr client = clients[i];
+         if (client && client->clientPtr == dev)
+             client->clientPtr = NULL;
+     }
+ }
+ 
  static int
 +disable_clientpointer(DeviceIntPtr dev)
 +{
 +    int i;
 +
 +    for (i = 0; i < currentMaxClients; i++)
 +    {
 +        ClientPtr client = clients[i];
 +        if (client && client->clientPtr == dev)
 +            client->clientPtr = NULL;
 +    }
 +}
 +
 +static int
  remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
                int flags[MAXDEVICES])
  {
commit 4e4bb319a4f9510277557f65676948cd1db10e93
Author: Carlos Garnacho <carlosg at gnome.org>
Date:   Tue Dec 13 15:41:23 2011 +0100

    Xi: assign correct grab_mode/other_device_mode in XI2 passive grabs
    
    CreateGrab() expects the keyboard mode to be stored in grab_mode, and the
    pointer mode in other_device_mode, so respect this in passive XI2 grabs,
    and switch modes if needed.
    
    Signed-off-by: Carlos Garnacho <carlosg at gnome.org>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>
    (cherry picked from commit 5b169cb695bd450d7f64e3800f00c9237ee67f96)

diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c
index 5cdd8ac..af46282 100644
--- a/Xi/xipassivegrab.c
+++ b/Xi/xipassivegrab.c
@@ -140,11 +140,17 @@ ProcXIPassiveGrabDevice(ClientPtr client)
     memset(&param, 0, sizeof(param));
     param.grabtype = GRABTYPE_XI2;
     param.ownerEvents = stuff->owner_events;
-    param.this_device_mode = stuff->grab_mode;
-    param.other_devices_mode = stuff->paired_device_mode;
     param.grabWindow = stuff->grab_window;
     param.cursor = stuff->cursor;
 
+    if (IsKeyboardDevice(dev)) {
+        param.this_device_mode = stuff->grab_mode;
+        param.other_devices_mode = stuff->paired_device_mode;
+    } else {
+        param.this_device_mode = stuff->paired_device_mode;
+        param.other_devices_mode = stuff->grab_mode;
+    }
+
     if (stuff->cursor != None)
     {
         status = dixLookupResourceByType(&tmp, stuff->cursor,
commit 8c73f6bcbdc04380cc41d9f6dc7e849c7c4f9298
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Thu Dec 8 21:52:07 2011 -0800

    Change disable_clientpointer return type to void
    
    It doesn't return anything, nor does it's caller expect it to.
    
    Fixes Solaris Studio compiler error:
    "xichangehierarchy.c", line 214: Function has no return statement : disable_clientpointer
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 372a6f10dc2d74d2d179e8b92449e9b8636a99ef)

diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
index dfcd52f..3facadd 100644
--- a/Xi/xichangehierarchy.c
+++ b/Xi/xichangehierarchy.c
@@ -202,7 +202,7 @@ unwind:
     return rc;
 }
 
-static int
+static void
 disable_clientpointer(DeviceIntPtr dev)
 {
     int i;
commit ae4272a5742119b10074a542d0dcd4c493cb83e4
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Nov 30 09:06:06 2011 +1000

    xfixes: don't dereference a NULL cursor
    
    If the new cursor is the NULL cursor, don't dereference it and use zeros
    instead.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit 1ab50be938524dcd4a9e56d27e3b96a27c2db2c0)

diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index ecbed40..7b01c8b 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -179,9 +179,9 @@ CursorDisplayCursor (DeviceIntPtr pDev,
 		ev.type = XFixesEventBase + XFixesCursorNotify;
 		ev.subtype = XFixesDisplayCursorNotify;
 		ev.window = e->pWindow->drawable.id;
-		ev.cursorSerial = pCursor->serialNumber;
+		ev.cursorSerial = pCursor ? pCursor->serialNumber : 0;
 		ev.timestamp = currentTime.milliseconds;
-		ev.name = pCursor->name;
+		ev.name = pCursor ? pCursor->name : None;
 		WriteEventsToClient (e->pClient, 1, (xEvent *) &ev);
 	    }
 	}
commit 20efd3c15829d8fbb3610d5af41b67a627e63d21
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Tue Nov 29 16:15:37 2011 +1000

    Xi: when removing a device, reset ClientPointers where needed
    
    if a client had the to-be-removed device as ClientPointer, reset to NULL.
    
    Fixes #43165
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit d2ebbcdaf6b13d70eee704b1764ff349e1be22a0)

diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
index 96ead6f..dfcd52f 100644
--- a/Xi/xichangehierarchy.c
+++ b/Xi/xichangehierarchy.c
@@ -203,6 +203,19 @@ unwind:
 }
 
 static int
+disable_clientpointer(DeviceIntPtr dev)
+{
+    int i;
+
+    for (i = 0; i < currentMaxClients; i++)
+    {
+        ClientPtr client = clients[i];
+        if (client && client->clientPtr == dev)
+            client->clientPtr = NULL;
+    }
+}
+
+static int
 remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
               int flags[MAXDEVICES])
 {
@@ -252,6 +265,8 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
     if (rc != Success)
         goto unwind;
 
+    disable_clientpointer(ptr);
+
     /* Disabling sends the devices floating, reattach them if
      * desired. */
     if (r->return_mode == XIAttachToMaster)
commit cf296f2eeffe4b438e9378268f84a1f63c555e52
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Nov 9 15:31:10 2011 +1000

    Xext: don't swap CARD8 in SProcSELinuxQueryVersion
    
    xselinux_ext.c: In function 'SELinuxSendItemsToClient':
    xselinux_ext.c:340:16: warning: unused variable 'n' [-Wunused-variable]
    xselinux_ext.c: In function 'SProcSELinuxQueryVersion':
    xselinux_ext.c:532:62: error: call to 'wrong_size' declared with attribute
    error: wrong sized variable passed to swap
    xselinux_ext.c:533:62: error: call to 'wrong_size' declared with attribute
    error: wrong sized variable passed to swap
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    (cherry picked from commit bb4aa1f263ad38c175bfda3b7e6c325260ce3f28)
    
    Conflicts:
    
    	Xext/xselinux_ext.c

diff --git a/Xext/xselinux_ext.c b/Xext/xselinux_ext.c
index 374571c..85ca2dc 100644
--- a/Xext/xselinux_ext.c
+++ b/Xext/xselinux_ext.c
@@ -528,12 +528,6 @@ ProcSELinuxDispatch(ClientPtr client)
 static int
 SProcSELinuxQueryVersion(ClientPtr client)
 {
-    REQUEST(SELinuxQueryVersionReq);
-    int n;
-
-    REQUEST_SIZE_MATCH(SELinuxQueryVersionReq);
-    swaps(&stuff->client_major, n);
-    swaps(&stuff->client_minor, n);
     return ProcSELinuxQueryVersion(client);
 }
 
commit 4b386610243b1a30db7e4cdb89cb43012198407d
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Dec 16 12:41:08 2011 +1000

    dix: button state must show the logical buttons, not physical buttons
    
    If the device is mapped 3 2 1, a click on physical button 1 sends a button 3
    press, but the state was set for button 1. Fix this, the state must be set
    for that button's logical mapping.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=655928
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 9567d21e85b99febe805263a4d93b15fd1f7ab42)
    
    Conflicts:
    
    	dix/inpututils.c

diff --git a/Xi/exevents.c b/Xi/exevents.c
index dcb496f..9d43564 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -927,7 +927,7 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
 
     for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++)
         if (BitIsOn(mouse->button->down, i))
-            SetBit(event->buttons, i);
+            SetBit(event->buttons, mouse->button->map[i]);
 
     if (kbd && kbd->key)
     {
commit f9b00c2aba496fe470c24d0f8d3e3d0e3b05aa65
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Tue Nov 29 16:15:37 2011 +1000

    Xi: when removing a device, reset ClientPointers where needed
    
    if a client had the to-be-removed device as ClientPointer, reset to NULL.
    
    Fixes #43165
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit d2ebbcdaf6b13d70eee704b1764ff349e1be22a0)

diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
index 96ead6f..dfcd52f 100644
--- a/Xi/xichangehierarchy.c
+++ b/Xi/xichangehierarchy.c
@@ -203,6 +203,19 @@ unwind:
 }
 
 static int
+disable_clientpointer(DeviceIntPtr dev)
+{
+    int i;
+
+    for (i = 0; i < currentMaxClients; i++)
+    {
+        ClientPtr client = clients[i];
+        if (client && client->clientPtr == dev)
+            client->clientPtr = NULL;
+    }
+}
+
+static int
 remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
               int flags[MAXDEVICES])
 {
@@ -252,6 +265,8 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
     if (rc != Success)
         goto unwind;
 
+    disable_clientpointer(ptr);
+
     /* Disabling sends the devices floating, reattach them if
      * desired. */
     if (r->return_mode == XIAttachToMaster)
commit e4984b3023351b5fcc506f4a196ad699db8b0535
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Nov 30 09:06:06 2011 +1000

    xfixes: don't dereference a NULL cursor
    
    If the new cursor is the NULL cursor, don't dereference it and use zeros
    instead.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit 1ab50be938524dcd4a9e56d27e3b96a27c2db2c0)

diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index ecbed40..7b01c8b 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -179,9 +179,9 @@ CursorDisplayCursor (DeviceIntPtr pDev,
 		ev.type = XFixesEventBase + XFixesCursorNotify;
 		ev.subtype = XFixesDisplayCursorNotify;
 		ev.window = e->pWindow->drawable.id;
-		ev.cursorSerial = pCursor->serialNumber;
+		ev.cursorSerial = pCursor ? pCursor->serialNumber : 0;
 		ev.timestamp = currentTime.milliseconds;
-		ev.name = pCursor->name;
+		ev.name = pCursor ? pCursor->name : None;
 		WriteEventsToClient (e->pClient, 1, (xEvent *) &ev);
 	    }
 	}
commit 625d1088192a9ad972c20fbdbcb4bb9fda979157
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Dec 16 09:15:25 2011 -0500

    dmx: force -fno-strict-aliasing for xinput example
    
    Compiler warning:
    xinput.c:272: warning: dereferencing pointer 'e' does break strict-aliasing
    rules
    
    The code itself is the usual XInput client-side code:
            XEvent event;
            XDeviceMotionEvent *e = (XDeviceMotionEvent *)&event;
            XNextEvent(display, &event);
            printf("%d\n", e->type);
    
    Since XDeviceMotionEvent is not guaranteed the same size as XEvent, clients
    must use pointer aliasing as above when using the XNextEvent API. Disable
    strict aliasing for this example.
    
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 3aca8199405cff5097ee5813605ec78b5ae44a43)

diff --git a/hw/dmx/examples/Makefile.am b/hw/dmx/examples/Makefile.am
index 229bb57..d055ddc 100644
--- a/hw/dmx/examples/Makefile.am
+++ b/hw/dmx/examples/Makefile.am
@@ -10,60 +10,60 @@ bin_PROGRAMS = \
 noinst_PROGRAMS = xinput xtest evi res xled xbell $(EV_PROG)
 
 dmxinfo_SOURCES = dmxinfo.c
-dmxinfo_LDADD = @DMXEXAMPLES_DEP_LIBS@
-dmxinfo_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+dmxinfo_LDADD = $(DMXEXAMPLES_DEP_LIBS)
+dmxinfo_CFLAGS = $(DMXEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS)
 
 dmxwininfo_SOURCES = dmxwininfo.c
-dmxwininfo_LDADD = @DMXXMUEXAMPLES_DEP_LIBS@
-dmxwininfo_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+dmxwininfo_LDADD = $(DMXXMUEXAMPLES_DEP_LIBS)
+dmxwininfo_CFLAGS = $(DMXXMUEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS)
 
 dmxreconfig_SOURCES = dmxreconfig.c
-dmxreconfig_LDADD = @DMXEXAMPLES_DEP_LIBS@
-dmxreconfig_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+dmxreconfig_LDADD = $(DMXEXAMPLES_DEP_LIBS)
+dmxreconfig_CFLAGS = $(DMXEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS)
 
 dmxresize_SOURCES = dmxresize.c
-dmxresize_LDADD = @DMXEXAMPLES_DEP_LIBS@
-dmxresize_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+dmxresize_LDADD = $(DMXEXAMPLES_DEP_LIBS)
+dmxresize_CFLAGS = $(DMXEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS)
 
 dmxaddscreen_SOURCES = dmxaddscreen.c
-dmxaddscreen_LDADD = @DMXEXAMPLES_DEP_LIBS@
-dmxaddscreen_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+dmxaddscreen_LDADD = $(DMXEXAMPLES_DEP_LIBS)
+dmxaddscreen_CFLAGS = $(DMXEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS)
 
 dmxrmscreen_SOURCES = dmxrmscreen.c
-dmxrmscreen_LDADD = @DMXEXAMPLES_DEP_LIBS@
-dmxrmscreen_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+dmxrmscreen_LDADD = $(DMXEXAMPLES_DEP_LIBS)
+dmxrmscreen_CFLAGS = $(DMXEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS)
 
 dmxaddinput_SOURCES = dmxaddinput.c
-dmxaddinput_LDADD = @DMXEXAMPLES_DEP_LIBS@
-dmxaddinput_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+dmxaddinput_LDADD = $(DMXEXAMPLES_DEP_LIBS)
+dmxaddinput_CFLAGS = $(DMXEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS)
 
 dmxrminput_SOURCES = dmxrminput.c
-dmxrminput_LDADD = @DMXEXAMPLES_DEP_LIBS@
-dmxrminput_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+dmxrminput_LDADD = $(DMXEXAMPLES_DEP_LIBS)
+dmxrminput_CFLAGS = $(DMXEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS)
 
 xinput_SOURCES = xinput.c
-xinput_LDADD = @DMXXIEXAMPLES_DEP_LIBS@
-xinput_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+xinput_LDADD = $(DMXXIEXAMPLES_DEP_LIBS)
+xinput_CFLAGS = $(DMXXIEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS)
 
 xtest_SOURCES = xtest.c
-xtest_LDADD = @XTSTEXAMPLES_DEP_LIBS@
-xtest_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+xtest_LDADD = $(XTSTEXAMPLES_DEP_LIBS)
+xtest_CFLAGS = $(XTSTEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS)
 
 evi_SOURCES = evi.c
-evi_LDADD = @X11EXAMPLES_DEP_LIBS@
-evi_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+evi_LDADD = $(X11EXAMPLES_DEP_LIBS)
+evi_CFLAGS = $(X11EXAMPLES_DEP_CFLAGS) $(CWARNFLAGS)
 
 res_SOURCES = res.c
-res_LDADD = @XRESEXAMPLES_DEP_LIBS@
-res_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+res_LDADD = $(XRESEXAMPLES_DEP_LIBS)
+res_CFLAGS = $(XRESEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS)
 
 xled_SOURCES = xled.c
-xled_LDADD = @X11EXAMPLES_DEP_LIBS@
-xled_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+xled_LDADD = $(X11EXAMPLES_DEP_LIBS)
+xled_CFLAGS = $(X11EXAMPLES_DEP_CFLAGS) $(CWARNFLAGS)
 
 xbell_SOURCES = xbell.c
-xbell_LDADD = @X11EXAMPLES_DEP_LIBS@
-xbell_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+xbell_LDADD = $(X11EXAMPLES_DEP_LIBS)
+xbell_CFLAGS = $(X11EXAMPLES_DEP_CFLAGS) $(CWARNFLAGS)
 
 ev_SOURCES = ev.c
 ev_LDADD = 
commit 53e347b22bb79043243e25891cd7d6f374a8aa23
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Nov 8 10:13:15 2011 -0800

    Save major/minor opcodes in ClientRec for RecordAReply
    
    The record extension needs the major and minor opcodes in the reply
    hook, but the request buffer may have been freed by the time the hook
    is invoked. Saving the request major and minor codes as the request is
    executed avoids fetching from the defunct request buffer.
    
    This patch also eliminates the public MinorOpcodeOfRequest function,
    inlining it into Dispatch. Usages of that function have been replaced
    with direct access to the new ClientRec field.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    (cherry picked from commit fb22a408c69a84f81905147de9e82cf66ffb6eb2)
    
    Conflicts:
    
    	include/extension.h

diff --git a/Xext/security.c b/Xext/security.c
index 8673880..aa78e54 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -148,9 +148,7 @@ SecurityLabelInitial(void)
 static _X_INLINE const char *
 SecurityLookupRequestName(ClientPtr client)
 {
-    int major = ((xReq *)client->requestBuffer)->reqType;
-    int minor = MinorOpcodeOfRequest(client);
-    return LookupRequestName(major, minor);
+    return LookupRequestName(client->majorOp, client->minorOp);
 }
 
 
diff --git a/Xext/xselinux_hooks.c b/Xext/xselinux_hooks.c
index f1d8e5d..0d4c9ab 100644
--- a/Xext/xselinux_hooks.c
+++ b/Xext/xselinux_hooks.c
@@ -263,8 +263,8 @@ SELinuxAudit(void *auditdata,
     if (client) {
 	REQUEST(xReq);
 	if (stuff) {
-	    major = stuff->reqType;
-	    minor = MinorOpcodeOfRequest(client);
+	    major = client->majorOp;
+	    minor = client->minorOp;
 	}
     }
     if (audit->id)
diff --git a/dix/dispatch.c b/dix/dispatch.c
index f8200b1..a13274c 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -337,8 +337,6 @@ DisableLimitedSchedulingLatency(void)
 	SmartScheduleLatencyLimited = 0;
 }
 
-#define MAJOROP ((xReq *)client->requestBuffer)->reqType
-
 void
 Dispatch(void)
 {
@@ -419,21 +417,28 @@ Dispatch(void)
 	        }
 
 		client->sequence++;
+		client->majorOp = ((xReq *)client->requestBuffer)->reqType;
+		client->minorOp = 0;
+		if (client->majorOp >= EXTENSION_BASE) {
+		    ExtensionEntry *ext = GetExtensionEntry(client->majorOp);
+		    if (ext)
+			client->minorOp = ext->MinorOpcode(client);
+		}
 #ifdef XSERVER_DTRACE
-		XSERVER_REQUEST_START(LookupMajorName(MAJOROP), MAJOROP,
+		XSERVER_REQUEST_START(LookupMajorName(client->majorOp), client->majorOp,
 			      ((xReq *)client->requestBuffer)->length,
 			      client->index, client->requestBuffer);
 #endif
 		if (result > (maxBigRequestSize << 2))
 		    result = BadLength;
 		else {
-		    result = XaceHookDispatch(client, MAJOROP);
+		    result = XaceHookDispatch(client, client->majorOp);
 		    if (result == Success)
-			result = (* client->requestVector[MAJOROP])(client);
+			result = (* client->requestVector[client->majorOp])(client);
 		    XaceHookAuditEnd(client, result);
 		}
 #ifdef XSERVER_DTRACE
-		XSERVER_REQUEST_DONE(LookupMajorName(MAJOROP), MAJOROP,
+		XSERVER_REQUEST_DONE(LookupMajorName(client->majorOp), client->majorOp,
 			      client->sequence, client->index, result);
 #endif
 
@@ -444,8 +449,8 @@ Dispatch(void)
 		}
 		else if (result != Success)
 		{
-		    SendErrorToClient(client, MAJOROP,
-				      MinorOpcodeOfRequest(client),
+		    SendErrorToClient(client, client->majorOp,
+				      client->minorOp,
 				      client->errorValue, result);
 		    break;
 		}
@@ -466,8 +471,6 @@ Dispatch(void)
     SmartScheduleLatencyLimited = 0;
 }
 
-#undef MAJOROP
-
 static int  VendorRelease = VENDOR_RELEASE;
 static char *VendorString = VENDOR_NAME;
 
diff --git a/dix/extension.c b/dix/extension.c
index c7bbac5..b677cdb 100644
--- a/dix/extension.c
+++ b/dix/extension.c
@@ -228,20 +228,6 @@ StandardMinorOpcode(ClientPtr client)
     return ((xReq *)client->requestBuffer)->data;
 }
 
-unsigned short
-MinorOpcodeOfRequest(ClientPtr client)
-{
-    unsigned char major;
-
-    major = ((xReq *)client->requestBuffer)->reqType;
-    if (major < EXTENSION_BASE)
-	return 0;
-    major -= EXTENSION_BASE;
-    if (major >= NumExtensions)
-	return 0;
-    return (*extensions[major]->MinorOpcode)(client);
-}
-
 void
 CloseDownExtensions(void)
 {
diff --git a/include/dixstruct.h b/include/dixstruct.h
index 443e8b0..94eb526 100644
--- a/include/dixstruct.h
+++ b/include/dixstruct.h
@@ -123,6 +123,7 @@ typedef struct _Client {
     
     DeviceIntPtr clientPtr;
     ClientIdPtr  clientIds;
+    unsigned short majorOp, minorOp;
 }           ClientRec;
 
 /*
diff --git a/include/extension.h b/include/extension.h
index 29a11c3..9249951 100644
--- a/include/extension.h
+++ b/include/extension.h
@@ -52,8 +52,6 @@ _XFUNCPROTOBEGIN
 
 extern _X_EXPORT unsigned short StandardMinorOpcode(ClientPtr /*client*/);
 
-extern _X_EXPORT unsigned short MinorOpcodeOfRequest(ClientPtr /*client*/);
-
 extern _X_EXPORT Bool EnableDisableExtension(char *name, Bool enable);
 
 extern _X_EXPORT void EnableDisableExtensionError(char *name, Bool enable);
diff --git a/record/record.c b/record/record.c
index 93383ce..778849a 100644
--- a/record/record.c
+++ b/record/record.c
@@ -554,7 +554,7 @@ RecordARequest(ClientPtr client)
 	    }
 	    else /* extension, check minor opcode */
 	    {
-		int minorop = MinorOpcodeOfRequest(client);
+		int minorop = client->minorOp;
 		int numMinOpInfo;
 		RecordMinorOpPtr pMinorOpInfo = pRCAP->pRequestMinOpInfo;
 
@@ -611,12 +611,9 @@ RecordAReply(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
     RecordContextPtr pContext;
     RecordClientsAndProtocolPtr pRCAP;
     int eci;
-    int majorop;
     ReplyInfoRec *pri = (ReplyInfoRec *)calldata;
     ClientPtr client = pri->client;
-    REQUEST(xReq);
 
-    majorop = stuff->reqType;
     for (eci = 0; eci < numEnabledContexts; eci++)
     {
 	pContext = ppAllContexts[eci];
@@ -624,6 +621,7 @@ RecordAReply(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
 					  NULL);
 	if (pRCAP)
 	{
+	    int majorop = client->majorOp;
 	    if (pContext->continuedReply)
 	    {
 		RecordAProtocolElement(pContext, client, XRecordFromServer,
@@ -644,7 +642,7 @@ RecordAReply(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
 		}
 		else /* extension, check minor opcode */
 		{
-		    int minorop = MinorOpcodeOfRequest(client);
+		    int minorop = client->minorOp;
 		    int numMinOpInfo;
 		    RecordMinorOpPtr pMinorOpInfo = pRCAP->pReplyMinOpInfo;
 		    		    assert (pMinorOpInfo);
commit b736f8c92bae7773ff6e1fca886f9ccc50156488
Author: Julien Cristau <jcristau at debian.org>
Date:   Sat Nov 5 13:00:07 2011 +0100

    Fix ShmPutImage for XYBitmap
    
    We can't call CopyArea in that case because the image has depth 1, which
    might not match the target drawable, so we might overrun the shm
    segment.  Commit 11817a881cb93a89788105d1e575a468f2a8d27c apparently
    fixed a similar bug for XYPixmap, but missed the bitmap case.
    
    Fixes: http://bugs.debian.org/629611
    
    Thanks to Alan Curry for diagnosing this and providing a test case.
    
    Reported-and-tested-by: Alan Curry <pacman at kosh.dhis.org>
    Reviewed-by: Peter Harris <pharris at opentext.com>
    Signed-off-by: Julien Cristau <jcristau at debian.org>
    (cherry picked from commit 08ec4da6a7617637914bee1636858474213cf39d)

diff --git a/Xext/shm.c b/Xext/shm.c
index 4141a8f..d2ae087 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -482,7 +482,7 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC,
 {
     PixmapPtr pPixmap;
 
-    if (format == ZPixmap || depth == 1) {
+    if (format == ZPixmap || (format == XYPixmap && depth == 1)) {
 	pPixmap = GetScratchPixmapHeader(dst->pScreen, w, h, depth,
 					 BitsPerPixel(depth),
 					 PixmapBytePad(w, depth),
commit b2a4c09507b267495ea5e4c2e05373b323c80edf
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Dec 17 12:56:59 2011 -0800

    kdrive/linux: Fix compilation with -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast
    
    Reported-by: Arkadiusz Miśkiewicz <arekm at maven.pl>
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    (cherry picked from commit 1deede3c48d5ac91f50774c79f02afc6e036614e)

diff --git a/hw/kdrive/linux/keyboard.c b/hw/kdrive/linux/keyboard.c
index f5f9d9b..ba2637b 100644
--- a/hw/kdrive/linux/keyboard.c
+++ b/hw/kdrive/linux/keyboard.c
@@ -692,7 +692,7 @@ LinuxKeyboardEnable (KdKeyboardInfo *ki)
         return !Success;
 
     fd = LinuxConsoleFd;
-    ki->driverPrivate = (void *) fd;
+    ki->driverPrivate = (void *) (intptr_t) fd;
 
     ioctl (fd, KDGKBMODE, &LinuxKbdTrans);
     tcgetattr (fd, &LinuxTermios);
@@ -724,7 +724,7 @@ LinuxKeyboardDisable (KdKeyboardInfo *ki)
     if (!ki)
         return;
 
-    fd = (int) ki->driverPrivate;
+    fd = (int) (intptr_t) ki->driverPrivate;
 
     KdUnregisterFd(ki, fd, FALSE);
     ioctl(fd, KDSKBMODE, LinuxKbdTrans);
@@ -753,7 +753,7 @@ LinuxKeyboardLeds (KdKeyboardInfo *ki, int leds)
     if (!ki)
         return;
 
-    ioctl ((int)ki->driverPrivate, KDSETLED, leds & 7);
+    ioctl ((int)(intptr_t)ki->driverPrivate, KDSETLED, leds & 7);
 }
 
 KdKeyboardDriver LinuxKeyboardDriver = {
diff --git a/hw/kdrive/linux/ms.c b/hw/kdrive/linux/ms.c
index b6151cd..176e125 100644
--- a/hw/kdrive/linux/ms.c
+++ b/hw/kdrive/linux/ms.c
@@ -152,7 +152,7 @@ MsEnable (KdPointerInfo *pi)
     }
     if (KdRegisterFd (port, MsRead, pi))
 	return TRUE;
-    pi->driverPrivate = (void *)port;
+    pi->driverPrivate = (void *)(intptr_t)port;
 
     return Success;
 
@@ -164,7 +164,7 @@ MsEnable (KdPointerInfo *pi)
 static void
 MsDisable (KdPointerInfo *pi)
 {
-    KdUnregisterFd (pi, (int)pi->driverPrivate, TRUE);
+    KdUnregisterFd (pi, (int)(intptr_t)pi->driverPrivate, TRUE);
 }
 
 static void
diff --git a/hw/kdrive/linux/ps2.c b/hw/kdrive/linux/ps2.c
index 465b963..b62d769 100644
--- a/hw/kdrive/linux/ps2.c
+++ b/hw/kdrive/linux/ps2.c
@@ -159,7 +159,7 @@ Ps2Enable (KdPointerInfo *pi)
         return BadAlloc;
     }
 
-    pi->driverPrivate = (void *)fd;
+    pi->driverPrivate = (void *)(intptr_t)fd;
 
     return Success;
 }
@@ -168,7 +168,7 @@ Ps2Enable (KdPointerInfo *pi)
 static void
 Ps2Disable (KdPointerInfo *pi)
 {
-    KdUnregisterFd (pi, (int)pi->driverPrivate, TRUE);
+    KdUnregisterFd (pi, (int)(intptr_t)pi->driverPrivate, TRUE);
 }
 
 static void
commit beaa7ad2ec45811e16722283a8b557a08e91ef18
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Dec 17 12:25:26 2011 -0800

    configure.ac: Make Xephyr dependency error message more informative
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    (cherry picked from commit d0170d54c71fc761b8f1ae7a0e555dc2ca23cf9c)

diff --git a/configure.ac b/configure.ac
index 5792731..a871529 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2029,12 +2029,10 @@ if test "$KDRIVE" = yes; then
         XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS $LIBGL libdrm"
     fi
 
-    PKG_CHECK_MODULES(XEPHYR, $XEPHYR_REQUIRED_LIBS, [xephyr="yes"], [xephyr="no"])
     if test "x$XEPHYR" = xauto; then
-        XEPHYR=$xephyr
-    fi
-    if test "x$XEPHYR" = xyes && test "x$xephyr" = xno; then	
-        AC_MSG_ERROR([Xephyr dependencies missing])
+        PKG_CHECK_MODULES(XEPHYR, $XEPHYR_REQUIRED_LIBS, [XEPHYR="yes"], [XEPHYR="no"])
+    elif test "x$XEPHYR" = xyes ; then
+        PKG_CHECK_MODULES(XEPHYR, $XEPHYR_REQUIRED_LIBS)
     fi
 
     # Xephyr needs nanosleep() which is in librt on Solaris


More information about the Xquartz-changes mailing list