[Xquartz-changes] xserver: Branch 'server-1.10-apple' - 15 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Thu Apr 7 20:44:44 PDT 2011


Rebased ref, commits from common ancestor:
commit 107b51176c77e00d41ffc3ad355dfcb61b4bc946
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 4a09bba..6770bf3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,6 +80,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 112bad3f26f7fdd098b27dcade45f3fa25cf228e
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 021a940..0b248e1 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -2079,11 +2079,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 7636040..af1920b 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, 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);
     }
 
@@ -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 (
 	pict->format,
-	pixmap->drawable.width, pixmap->drawable.height,
+	pict->pDrawable->width, pict->pDrawable->height,
 	(uint32_t *)bits, stride * sizeof (FbStride));
     
     
@@ -187,55 +182,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)
@@ -265,8 +238,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);
@@ -299,7 +271,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;
 
@@ -308,7 +281,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)
     {
@@ -329,19 +302,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 c309ceb..40cffd9 100644
--- a/fb/fbtrap.c
+++ b/fb/fbtrap.c
@@ -37,8 +37,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;
@@ -54,8 +53,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 3875c2c298576bfc6aed2f2f646237432fd1a50b
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 1f51fe4f748b2997e466863d8387bd6791b32931
Author: Matthieu Herrb <matthieu.herrb at laas.fr>
Date:   Fri Apr 1 22:55:57 2011 +0200

    Xi: fix querydevice request swapping
    
    WriteReplyToClient() swaps rep.length, so it can't be used
    on return of WriteReplyToClient(). So save it's value for later
    use.
    
    Signed-off-by: Matthieu Herrb <matthieu.herrb at laas.fr>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    (cherry picked from commit 266ea63bc3e052b753c5484fa08dcc4fb67c8952)

diff --git a/Xi/xiquerydevice.c b/Xi/xiquerydevice.c
index cb7a5fb..f8d6c13 100644
--- a/Xi/xiquerydevice.c
+++ b/Xi/xiquerydevice.c
@@ -155,8 +155,9 @@ ProcXIQueryDevice(ClientPtr client)
         }
     }
 
+    len = rep.length * 4;
     WriteReplyToClient(client, sizeof(xXIQueryDeviceReply), &rep);
-    WriteToClient(client, rep.length * 4, ptr);
+    WriteToClient(client, len, ptr);
     free(ptr);
     free(skip);
     return rc;
commit 2f12adb2c914732ae3a328b759d272d8bbbb55a6
Author: Matthieu Herrb <matthieu.herrb at laas.fr>
Date:   Fri Apr 1 22:54:54 2011 +0200

    Xext: fix test on extension number for the swapped case.
    
    Signed-off-by: Matthieu Herrb <matthieu.herrb at laas.fr>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    (cherry picked from commit 552c78592c5e5f52fe16e2429f77c63adf398247)

diff --git a/Xext/geext.c b/Xext/geext.c
index b37c1a0..a6fbb09 100644
--- a/Xext/geext.c
+++ b/Xext/geext.c
@@ -185,7 +185,7 @@ SGEGenericEvent(xEvent* from, xEvent* to)
     xGenericEvent* gefrom = (xGenericEvent*)from;
     xGenericEvent* geto = (xGenericEvent*)to;
 
-    if (gefrom->extension > MAXEXTENSIONS)
+    if ((gefrom->extension & 0x7f) > MAXEXTENSIONS)
     {
         ErrorF("GE: Invalid extension offset for event.\n");
         return;
commit e08a7df54da8aeb343412ed9dda250207dc749f4
Author: Matthieu Herrb <matthieu.herrb at laas.fr>
Date:   Fri Apr 1 22:53:40 2011 +0200

    Xi: add XI_Focus{In,Out} to swapped events.
    
    Signed-off-by: Matthieu Herrb <matthieu.herrb at laas.fr>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    (cherry picked from commit a074e6b6754d6c2706b2b5de54e22cbffc5b1a17)

diff --git a/Xi/extinit.c b/Xi/extinit.c
index c26cd6b..ec815c9 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -864,6 +864,8 @@ XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
     {
         case XI_Enter:
         case XI_Leave:
+        case XI_FocusIn:
+        case XI_FocusOut:
             SDeviceLeaveNotifyEvent((xXILeaveEvent*)from, (xXILeaveEvent*)to);
             break;
         case XI_DeviceChanged:
commit 69ee0f68b7bbd8007d91b8485a4c6684c552a9dd
Author: Matthieu Herrb <matthieu.herrb at laas.fr>
Date:   Fri Apr 1 22:51:48 2011 +0200

    Xi: take XI2 requests into account also for the swapping case.
    
    Signed-off-by: Matthieu Herrb <matthieu.herrb at laas.fr>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    (cherry picked from commit 81257377a2d011ce47fba5822df0f7918dea1d72)

diff --git a/Xi/extinit.c b/Xi/extinit.c
index 82df7eb..c26cd6b 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -49,6 +49,7 @@ SOFTWARE.
  *  Dispatch routines and initialization routines for the X input extension.
  *
  */
+#define ARRAY_SIZE(_a)        (sizeof((_a)) / sizeof((_a)[0]))
 
 #define	 NUMTYPES 15
 
@@ -410,7 +411,7 @@ static int
 ProcIDispatch(ClientPtr client)
 {
     REQUEST(xReq);
-    if (stuff->data > (IREQUESTS + XI2REQUESTS) || !ProcIVector[stuff->data])
+    if (stuff->data > ARRAY_SIZE(ProcIVector) || !ProcIVector[stuff->data])
         return BadRequest;
 
     return (*ProcIVector[stuff->data])(client);
@@ -429,7 +430,7 @@ static int
 SProcIDispatch(ClientPtr client)
 {
     REQUEST(xReq);
-    if (stuff->data > IREQUESTS || !SProcIVector[stuff->data])
+    if (stuff->data > ARRAY_SIZE(SProcIVector) || !SProcIVector[stuff->data])
         return BadRequest;
 
     return (*SProcIVector[stuff->data])(client);
commit 0a54ec5099bd04ebdce3f683ecb0f8cf4da025d9
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Tue Mar 15 13:20:03 2011 +1000

    man: list the drivers that are ignored when hotplugging (#35209)
    
    X.Org Bug 35209 <http://bugs.freedesktop.org/show_bug.cgi?id=35209>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Cyril Brulebois <kibi at debian.org>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    (cherry picked from commit 6f46ae3c69c48f389560af1491ed1729ba45866f)

diff --git a/hw/xfree86/doc/man/xorg.conf.man b/hw/xfree86/doc/man/xorg.conf.man
index e3fd0ea..4bec316 100644
--- a/hw/xfree86/doc/man/xorg.conf.man
+++ b/hw/xfree86/doc/man/xorg.conf.man
@@ -814,11 +814,18 @@ Example: the MIT-SHM extension can be disabled with the following entry:
 The config file may have multiple
 .B InputDevice
 sections.
-Recent X servers employ input hotplugging to add input devices, with the HAL
-backend being the default backend for X servers since 1.4. It is usually not
+Recent X servers employ HAL or udev backends for input device enumeration
+and input hotplugging. It is usually not
 necessary to provide
 .B InputDevice
-sections in the xorg.conf if hotplugging is enabled.
+sections in the xorg.conf if hotplugging is in use. If hotplugging is
+enabled,
+.B InputDevice
+sections using the
+.B mouse, kbd
+and
+.B vmmouse
+driver will be ignored.
 .PP
 If hotplugging is disabled, there will normally
 be at least two: one for the core (primary) keyboard
commit e9ba0539de1c4dfb946e1885cd64b3fc45bc2dbe
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Tue Feb 22 13:43:28 2011 +0000

    Input: Don't freeze unrelated devices in DeliverGrabbedEvent
    
    When delivering an event to a device grabbed with SyncBoth,
    DeliverGrabbedEvent walks the device tree looking for associated devices
    to freeze them.  Unfortunately, it froze all devices instead of just the
    paired device, and the previous fix in 4fbadc8b17237f3c would still break
    if the same client had a non-SyncBoth grab on another unrelated master
    device.
    
    Fix this by completely ignoring devices that aren't our paired device.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit b636893137da1695e235e3a9354bfd9243fdddc2)

diff --git a/dix/events.c b/dix/events.c
index 07f8b05..f0ea576 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3872,16 +3872,15 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
 	switch (grabinfo->sync.state)
 	{
 	case FREEZE_BOTH_NEXT_EVENT:
-	    for (dev = inputInfo.devices; dev; dev = dev->next)
+	    dev = GetPairedDevice(thisDev);
+	    if (dev)
 	    {
-		if (dev == thisDev)
-		    continue;
 		FreezeThaw(dev, TRUE);
 		if ((dev->deviceGrab.sync.state == FREEZE_BOTH_NEXT_EVENT) &&
 		    (CLIENT_BITS(grab->resource) ==
 		     CLIENT_BITS(dev->deviceGrab.grab->resource)))
 		    dev->deviceGrab.sync.state = FROZEN_NO_EVENT;
-		else if (GetPairedDevice(thisDev) == dev)
+		else
                     dev->deviceGrab.sync.other = grab;
 	    }
 	    /* fall through */
commit ff066dc75b6b8eb3f957d00f57011197a588cec6
Author: Bryce Harrington <bryce at canonical.com>
Date:   Wed Feb 16 16:55:57 2011 -0800

    Check for OOM condition in XISendDeviceHierarchyEvent
    
    When system is out of memory, calloc can fail returning a NULL pointer.
    Check for this before dereferencing it, and bail out if it fails.
    
    Ref.: https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/720445
    
    Signed-off-by: Bryce Harrington <bryce at canonical.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 649269d40667cfb387cb5286dd3519dd68f7dd80)

diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
index b9cdedf..21c74ed 100644
--- a/Xi/xichangehierarchy.c
+++ b/Xi/xichangehierarchy.c
@@ -70,6 +70,8 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
 
     ev = calloc(1, sizeof(xXIHierarchyEvent) +
                  MAXDEVICES * sizeof(xXIHierarchyInfo));
+    if (!ev)
+        return;
     ev->type = GenericEvent;
     ev->extension = IReqCode;
     ev->evtype = XI_HierarchyChanged;
commit 1a2fab98104468b5f17d54c206213af5b0226bfd
Author: Simon Thum <simon.thum at gmx.de>
Date:   Sun Feb 6 19:13:00 2011 +0100

    xfree86: allow to check for options without warnings in the log
    
    This allows set_percent_option in synaptics to work as described,
    and should generally enable to check option syntax without log spam.
    
    Signed-off-by: Simon Thum <simon.thum at gmx.de>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 38ffeec0c89e83afc62579dec221c325d667cc1e)

diff --git a/hw/xfree86/common/xf86Option.c b/hw/xfree86/common/xf86Option.c
index 455cafa..480f386 100644
--- a/hw/xfree86/common/xf86Option.c
+++ b/hw/xfree86/common/xf86Option.c
@@ -496,27 +496,33 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
 	switch (p->type) {
 	case OPTV_INTEGER:
 	    if (*s == '\0') {
-		xf86DrvMsg(scrnIndex, X_WARNING,
-			   "Option \"%s\" requires an integer value\n",
-			   p->name);
+		if (markUsed) {
+		    xf86DrvMsg(scrnIndex, X_WARNING,
+			       "Option \"%s\" requires an integer value\n",
+			       p->name);
+		}
 		p->found = FALSE;
 	    } else {
 		p->value.num = strtoul(s, &end, 0);
 		if (*end == '\0') {
 		    p->found = TRUE;
 		} else {
-		    xf86DrvMsg(scrnIndex, X_WARNING,
-			       "Option \"%s\" requires an integer value\n",
-			        p->name);
+		    if (markUsed) {
+			xf86DrvMsg(scrnIndex, X_WARNING,
+				   "Option \"%s\" requires an integer value\n",
+				    p->name);
+		    }
 		    p->found = FALSE;
 		}
 	    }
 	    break;
 	case OPTV_STRING:
 	    if (*s == '\0') {
-		xf86DrvMsg(scrnIndex, X_WARNING,
-			   "Option \"%s\" requires an string value\n",
-			   p->name);
+		if (markUsed) {
+		    xf86DrvMsg(scrnIndex, X_WARNING,
+			       "Option \"%s\" requires an string value\n",
+			       p->name);
+		}
 		p->found = FALSE;
 	    } else {
 		p->value.str = s;
@@ -529,18 +535,22 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
 	    break;
 	case OPTV_REAL:	
 	    if (*s == '\0') {
-		xf86DrvMsg(scrnIndex, X_WARNING,
-			   "Option \"%s\" requires a floating point value\n",
-			   p->name);
+		if (markUsed) {
+		    xf86DrvMsg(scrnIndex, X_WARNING,
+			       "Option \"%s\" requires a floating point "
+			       "value\n", p->name);
+		}
 		p->found = FALSE;
 	    } else {
 		p->value.realnum = strtod(s, &end);
 		if (*end == '\0') {
 		    p->found = TRUE;
 		} else {
-		    xf86DrvMsg(scrnIndex, X_WARNING,
-			    "Option \"%s\" requires a floating point value\n",
-			    p->name);
+		    if (markUsed) {
+			xf86DrvMsg(scrnIndex, X_WARNING,
+				"Option \"%s\" requires a floating point "
+				"value\n", p->name);
+		    }
 		    p->found = FALSE;
 		}
 	    }
@@ -549,8 +559,11 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
 	    if (GetBoolValue(p, s)) {
 		p->found = TRUE;
 	    } else {
-		xf86DrvMsg(scrnIndex, X_WARNING,
-			   "Option \"%s\" requires a boolean value\n", p->name);
+		if (markUsed) {
+		    xf86DrvMsg(scrnIndex, X_WARNING,
+			       "Option \"%s\" requires a boolean value\n",
+			       p->name);
+		}
 		p->found = FALSE;
 	    }
 	    break;
@@ -561,8 +574,10 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
 		 * hence 100 looks the same as 100% to the caller of sccanf
 		 */
 		if (sscanf(s, "%lf%c", &p->value.realnum, &tmp) != 2 || tmp != '%') {
-		    xf86DrvMsg(scrnIndex, X_WARNING,
+		    if (markUsed) {
+			xf86DrvMsg(scrnIndex, X_WARNING,
 			       "Option \"%s\" requires a percent value\n", p->name);
+		    }
 		    p->found = FALSE;
 		} else {
 		    p->found = TRUE;
@@ -571,9 +586,11 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
 	    break;
 	case OPTV_FREQ:	
 	    if (*s == '\0') {
-		xf86DrvMsg(scrnIndex, X_WARNING,
-			   "Option \"%s\" requires a frequency value\n",
-			   p->name);
+		if (markUsed) {
+		    xf86DrvMsg(scrnIndex, X_WARNING,
+			       "Option \"%s\" requires a frequency value\n",
+			       p->name);
+		}
 		p->found = FALSE;
 	    } else {
 		double freq = strtod(s, &end);
@@ -590,17 +607,21 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
 			     !xf86NameCmp(end, "M"))
 			units = 1000000;
 		    else {
-			xf86DrvMsg(scrnIndex, X_WARNING,
-			    "Option \"%s\" requires a frequency value\n",
-			    p->name);
+			if (markUsed) {
+			    xf86DrvMsg(scrnIndex, X_WARNING,
+				"Option \"%s\" requires a frequency value\n",
+				p->name);
+			}
 			p->found = FALSE;
 		    }
 		    if (p->found)
 			freq *= (double)units;
 		} else {
-		    xf86DrvMsg(scrnIndex, X_WARNING,
-			    "Option \"%s\" requires a frequency value\n",
-			    p->name);
+		    if (markUsed) {
+			xf86DrvMsg(scrnIndex, X_WARNING,
+				"Option \"%s\" requires a frequency value\n",
+				p->name);
+		    }
 		    p->found = FALSE;
 		}
 		if (p->found) {
commit 677aeef14b322615c67c3871e9b29638a9b341c4
Author: Simon Thum <simon.thum at gmx.de>
Date:   Sun Feb 6 19:07:19 2011 +0100

    fix percent options parsing
    
    Signed-off-by: Simon Thum <simon.thum at gmx.de>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 2fbccc881bfab4bdc5b97f74a7e5bcec7fdeae20)

diff --git a/hw/xfree86/common/xf86Option.c b/hw/xfree86/common/xf86Option.c
index 16c27e5..455cafa 100644
--- a/hw/xfree86/common/xf86Option.c
+++ b/hw/xfree86/common/xf86Option.c
@@ -212,7 +212,7 @@ LookupBoolOption(pointer optlist, const char *name, int deflt, Bool markUsed)
     return deflt;
 }
 
-static int
+static double
 LookupPercentOption(pointer optlist, const char *name, double deflt, Bool markUsed)
 {
     OptionInfoRec o;
commit 8da04cb0d94462a2bdfe3003e3c460cecbecb6f6
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Tue Feb 15 11:27:59 2011 +0000

    Input: Actually send Xi 1.x DeviceStateNotify events
    
    When a client has selected for Xi 1.x DeviceStateNotify events, they
    should receive them when a DeviceFocusIn event is generated.  The code
    to do this was there, but an incorrect test meant they were never being
    sent.
    
    The "type" passed in is the XI2 type, the XI1 type is in event.type.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 737562257e8ee30b1c438e5160a61fbb26ca609e)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 3da50bf..35f96e6 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1280,7 +1280,7 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
     DeliverEventsToWindow(dev, pWin, (xEvent *) & event, 1,
 				DeviceFocusChangeMask, NullGrab);
 
-    if ((type == DeviceFocusIn) &&
+    if ((event.type == DeviceFocusIn) &&
 	(wOtherInputMasks(pWin)) &&
 	(wOtherInputMasks(pWin)->inputEvents[dev->id] & DeviceStateNotifyMask))
     {
commit 9c803d2fe06163157edf84ed8e0563db20ec4a73
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Sun Feb 13 21:36:04 2011 -0800

    XkbAddGeomProperty: Fix checks for malloc failure
    
    Check the variable we just tried to malloc, not the string we're copying
    and already checked for NULL at the beginning of the function.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    (cherry picked from commit 682865c460945e1299f943561140f46439e2b4cb)

diff --git a/xkb/XKBGAlloc.c b/xkb/XKBGAlloc.c
index 3ec9eda..f49aead 100644
--- a/xkb/XKBGAlloc.c
+++ b/xkb/XKBGAlloc.c
@@ -659,11 +659,11 @@ register XkbPropertyPtr prop;
     }
     prop= &geom->properties[geom->num_properties];
     prop->name= malloc(strlen(name)+1);
-    if (!name)
+    if (!prop->name)
 	return NULL;
     strcpy(prop->name,name);
     prop->value= malloc(strlen(value)+1);
-    if (!value) {
+    if (!prop->value) {
 	free(prop->name);
 	prop->name= NULL;
 	return NULL;
commit 81fbb96c54f78a7cd96433294ee003c7ef6a772a
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Feb 25 11:08:19 2011 +1000

    dix: release all buttons and keys before reattaching a device (#34182)
    
    Testcase:
      xinput float <keyboard name>
    
    results in the keyboard's enter key being repeated as the device is detached
    while the key is still physically down. To avoid this, release all keys and
    buttons before reattaching the device.
    
    X.Org Bug 34182 <http://bugs.freedesktop.org/show_bug.cgi?id=34182>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Fernando Carrijo <fcarrijo at freedesktop.org>
    (cherry picked from commit 9d23459415b84606ee4f38bb2d19054c432c8552)

diff --git a/dix/devices.c b/dix/devices.c
index 55f22cb..84284e7 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -2380,6 +2380,46 @@ RecalculateMasterButtons(DeviceIntPtr slave)
 }
 
 /**
+ * Generate release events for all keys/button currently down on this
+ * device.
+ */
+static void
+ReleaseButtonsAndKeys(DeviceIntPtr dev)
+{
+    EventListPtr        eventlist = InitEventList(GetMaximumEventsNum());
+    ButtonClassPtr      b = dev->button;
+    KeyClassPtr         k = dev->key;
+    int                 i, j, nevents;
+
+    if (!eventlist) /* no release events for you */
+        return;
+
+    /* Release all buttons */
+    for (i = 0; b && i < b->numButtons; i++)
+    {
+        if (BitIsOn(b->down, i))
+        {
+            nevents = GetPointerEvents(eventlist, dev, ButtonRelease, i, 0, NULL);
+            for (j = 0; j < nevents; j++)
+                mieqProcessDeviceEvent(dev, (InternalEvent*)(eventlist+j)->event, NULL);
+        }
+    }
+
+    /* Release all keys */
+    for (i = 0; k && i < MAP_LENGTH; i++)
+    {
+        if (BitIsOn(k->down, i))
+        {
+            nevents = GetKeyboardEvents(eventlist, dev, KeyRelease, i);
+            for (j = 0; j < nevents; j++)
+                mieqProcessDeviceEvent(dev, (InternalEvent*)(eventlist+j)->event, NULL);
+        }
+    }
+
+    FreeEventList(eventlist, GetMaximumEventsNum());
+}
+
+/**
  * Attach device 'dev' to device 'master'.
  * Client is set to the client that issued the request, or NULL if it comes
  * from some internal automatic pairing.
@@ -2412,6 +2452,8 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
         free(dev->spriteInfo->sprite);
     }
 
+    ReleaseButtonsAndKeys(dev);
+
     oldmaster = dev->u.master;
     dev->u.master = master;
 


More information about the Xquartz-changes mailing list