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

Jeremy Huddleston jeremyhu at freedesktop.org
Wed Dec 15 13:40:38 PST 2010


Rebased ref, commits from common ancestor:
commit 0d96bf877317abec75483aabe3cfcdf151f787dd
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 a06f98b..3b9efea 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -2080,11 +2080,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 f7f1200..5467ee4 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,55 +307,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)
@@ -390,8 +363,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);
@@ -424,7 +396,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;
 
@@ -433,7 +406,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)
     {
@@ -454,19 +427,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 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 2e5c4ddfa21328d9bc429eb8595cd712333719f9
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 94258b8..4f25c23 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;
 
@@ -587,6 +601,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;
 	
@@ -595,6 +621,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;
@@ -657,6 +689,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 a2c674b75d3b1a663bece6f6e2e34c3e71e6be55
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Feb 5 11:08:27 2010 +1000

    test: reduce range of byte-padding macro tests.
    
    Byte padding and conversion is interesting for the rage of 0-8 bytes, and
    then interesting towards the end of the valid range (INT_MAX - 7 and INT_MAX
    - 3).
    
    Note: this changes the upper range for pad_to_int32() and bytes_to_int32()
    from the previous (INT_MAX - 4) to (INT_MAX - 3).
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    (cherry picked from commit d435e1ecb86e2fe6292b5945262956644f979bbb)

diff --git a/test/input.c b/test/input.c
index 5f03471..d1c4dd9 100644
--- a/test/input.c
+++ b/test/input.c
@@ -682,45 +682,82 @@ static void dix_grab_matching(void)
     g_assert(rc == TRUE);
 }
 
-static void include_byte_padding_macros(void)
+static void test_bits_to_byte(int i)
 {
-    int i;
-    g_test_message("Testing bits_to_bytes()");
-
-    /* the macros don't provide overflow protection */
-    for (i = 0; i < INT_MAX - 7; i++)
-    {
         int expected_bytes;
         expected_bytes = (i + 7)/8;
 
         g_assert(bits_to_bytes(i) >= i/8);
         g_assert((bits_to_bytes(i) * 8) - i <= 7);
         g_assert(expected_bytes == bits_to_bytes(i));
-    }
+}
 
-    g_test_message("Testing bytes_to_int32()");
-    for (i = 0; i < INT_MAX - 3; i++)
-    {
+static void test_bytes_to_int32(int i)
+{
         int expected_4byte;
         expected_4byte = (i + 3)/4;
 
         g_assert(bytes_to_int32(i) <= i);
         g_assert((bytes_to_int32(i) * 4) - i <= 3);
         g_assert(expected_4byte == bytes_to_int32(i));
-    }
-
-    g_test_message("Testing pad_to_int32");
+}
 
-    for (i = 0; i < INT_MAX - 3; i++)
-    {
+static void test_pad_to_int32(int i)
+{
         int expected_bytes;
         expected_bytes = ((i + 3)/4) * 4;
 
         g_assert(pad_to_int32(i) >= i);
         g_assert(pad_to_int32(i) - i <= 3);
         g_assert(expected_bytes == pad_to_int32(i));
-    }
+}
+static void include_byte_padding_macros(void)
+{
+    g_test_message("Testing bits_to_bytes()");
+
+    /* the macros don't provide overflow protection */
+    test_bits_to_byte(0);
+    test_bits_to_byte(1);
+    test_bits_to_byte(2);
+    test_bits_to_byte(7);
+    test_bits_to_byte(8);
+    test_bits_to_byte(0xFF);
+    test_bits_to_byte(0x100);
+    test_bits_to_byte(INT_MAX - 9);
+    test_bits_to_byte(INT_MAX - 8);
+
+    g_test_message("Testing bytes_to_int32()");
+
+    test_bytes_to_int32(0);
+    test_bytes_to_int32(1);
+    test_bytes_to_int32(2);
+    test_bytes_to_int32(7);
+    test_bytes_to_int32(8);
+    test_bytes_to_int32(0xFF);
+    test_bytes_to_int32(0x100);
+    test_bytes_to_int32(0xFFFF);
+    test_bytes_to_int32(0x10000);
+    test_bytes_to_int32(0xFFFFFF);
+    test_bytes_to_int32(0x1000000);
+    test_bytes_to_int32(INT_MAX - 4);
+    test_bytes_to_int32(INT_MAX - 3);
+
+    g_test_message("Testing pad_to_int32");
 
+    test_pad_to_int32(0);
+    test_pad_to_int32(0);
+    test_pad_to_int32(1);
+    test_pad_to_int32(2);
+    test_pad_to_int32(7);
+    test_pad_to_int32(8);
+    test_pad_to_int32(0xFF);
+    test_pad_to_int32(0x100);
+    test_pad_to_int32(0xFFFF);
+    test_pad_to_int32(0x10000);
+    test_pad_to_int32(0xFFFFFF);
+    test_pad_to_int32(0x1000000);
+    test_pad_to_int32(INT_MAX - 4);
+    test_pad_to_int32(INT_MAX - 3);
 }
 
 static void xi_unregister_handlers(void)
commit 8d0866559dd418389b018f1e48c6f8605e6ebc8d
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Feb 5 10:59:52 2010 +1000

    test: compare byte padding macros against the expected bytes.
    
    We calculate the expected bytes for each value, let's use it.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    (cherry picked from commit f49ee9074a66883a3c525b0d6e71589123288465)

diff --git a/test/input.c b/test/input.c
index f08e13b..5f03471 100644
--- a/test/input.c
+++ b/test/input.c
@@ -695,6 +695,7 @@ static void include_byte_padding_macros(void)
 
         g_assert(bits_to_bytes(i) >= i/8);
         g_assert((bits_to_bytes(i) * 8) - i <= 7);
+        g_assert(expected_bytes == bits_to_bytes(i));
     }
 
     g_test_message("Testing bytes_to_int32()");
@@ -705,6 +706,7 @@ static void include_byte_padding_macros(void)
 
         g_assert(bytes_to_int32(i) <= i);
         g_assert((bytes_to_int32(i) * 4) - i <= 3);
+        g_assert(expected_4byte == bytes_to_int32(i));
     }
 
     g_test_message("Testing pad_to_int32");
@@ -716,6 +718,7 @@ static void include_byte_padding_macros(void)
 
         g_assert(pad_to_int32(i) >= i);
         g_assert(pad_to_int32(i) - i <= 3);
+        g_assert(expected_bytes == pad_to_int32(i));
     }
 
 }
commit 97f40a17afc197342b5aea92d870dd4099ac6b44
Author: Eoghan Sherry <ejsherry at gmail.com>
Date:   Sun Nov 28 16:15:51 2010 -0500

    Xi: Fix master button update when slave buttons are mapped. #24887
    
    It is currently assumed that an event button delieved to a master device
    corresponds to the slave button states. However, the event button is a
    logical (mapped) slave button and slave button states correspond to
    physical (unmapped) slave buttons. This leads to incorrect update of the
    master button state and incorrect events devlivered to clients. Fix the
    situation by taking the slave button map into account when querying a
    slave button state.
    
    Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=24887
    
    Signed-off-by: Eoghan Sherry <ejsherry at gmail.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 36b614dedf4ddc428e43ad1542d4f9314f73f60a)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index e19e207..6d88151 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -878,8 +878,10 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
                     continue;
                 if (!sd->button)
                     continue;
-                if (button_is_down(sd, key, BUTTON_PROCESSED))
-                    return DONT_PROCESS;
+                for (i = 1; i <= sd->button->numButtons; i++)
+                    if (sd->button->map[i] == key &&
+                        button_is_down(sd, i, BUTTON_PROCESSED))
+                        return DONT_PROCESS;
             }
         }
         set_button_up(device, key, BUTTON_PROCESSED);
commit faecab3b13bbaecf4f35f49b833d1b79a5fb647d
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Sep 3 11:54:41 2010 +1000

    mi: handle DGA subtypes when determining the master device.
    
    The subtype in the DGA event is the core type and all ET_ event types (where
    applicable) are identical to the core types. Thus the switch statement below
    will work as required and assign the right master device.
    
    Fixes a crasher bug on keyboard devices with valuators. If a device sends a
    motion event while grabbed and a DGA client is active (but has not selected
    input through DGA), the valuator event is posted through the VCK and
    eventually results in a NULL-pointer dereference on dev->valuator.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 31ab9f8860848504df18a8be9d19b817b191e0df)

diff --git a/mi/mieq.c b/mi/mieq.c
index d1441e2..01da52a 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -320,6 +320,7 @@ CopyGetMasterEvent(DeviceIntPtr sdev,
 {
     DeviceIntPtr mdev;
     int len = original->any.length;
+    int type = original->any.type;
 
     CHECKEVENT(original);
 
@@ -327,7 +328,12 @@ CopyGetMasterEvent(DeviceIntPtr sdev,
     if (!sdev || !sdev->u.master)
         return NULL;
 
-    switch(original->any.type)
+#if XFreeXDGA
+    if (type == ET_DGAEvent)
+        type = original->dga_event.subtype;
+#endif
+
+    switch(type)
     {
         case ET_KeyPress:
         case ET_KeyRelease:


More information about the Xquartz-changes mailing list