[Xquartz-changes] xserver: Branch 'server-1.12-apple' - 55 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Mon Aug 27 13:51:29 PDT 2012


Rebased ref, commits from common ancestor:
commit 054f6043efef579090cc644bf884ccc01f454895
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>
    (cherry picked from commit e6fa592a74104aa9d0081387823314833526f306)

diff --git a/fb/fb.h b/fb/fb.h
index b327ce6..53a6c1a 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -1683,8 +1683,7 @@ fbFillRegionSolid(DrawablePtr pDrawable,
                   RegionPtr pRegion, FbBits and, FbBits xor);
 
 extern _X_EXPORT pixman_image_t *image_from_pict(PicturePtr pict,
-                                                 Bool has_clip,
-                                                 int *xoff, int *yoff);
+                                                 Bool has_clip);
 
 extern _X_EXPORT void free_pixman_pict(PicturePtr, pixman_image_t *);
 
diff --git a/fb/fbpict.c b/fb/fbpict.c
index 097a1a6..dc0ca3c 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -46,23 +46,18 @@ fbComposite(CARD8 op,
             INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, 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, width, height);
+                               xSrc, ySrc, xMask, yMask, xDst, yDst,
+                               width, height);
     }
 
     free_pixman_pict(pSrc, src);
@@ -143,20 +138,22 @@ create_conical_gradient_image(PictGradient * gradient)
 }
 
 static pixman_image_t *
-create_bits_picture(PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
+create_bits_picture(PicturePtr pict, 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, (uint32_t *) bits,
+                                     pict->pDrawable->width,
+                                     pict->pDrawable->height, (uint32_t *) bits,
                                      stride * sizeof(FbStride));
 
     if (!image)
@@ -183,57 +180,31 @@ create_bits_picture(PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
         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);
 
 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, pict->transform);
     }
 
     switch (pict->repeatType) {
@@ -261,10 +232,8 @@ set_image_properties(pixman_image_t * image, PicturePtr pict, Bool has_clip,
      * as the alpha map for this operation
      */
     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);
+            image_from_pict_internal(pict->alphaMap, TRUE, TRUE);
 
         pixman_image_set_alpha_map(image, alpha_map, pict->alphaOrigin.x,
                                    pict->alphaOrigin.y);
@@ -298,8 +267,7 @@ set_image_properties(pixman_image_t * image, PicturePtr pict, Bool has_clip,
 }
 
 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;
 
@@ -307,7 +275,7 @@ image_from_pict_internal(PicturePtr pict, Bool has_clip, int *xoff, int *yoff,
         return NULL;
 
     if (pict->pDrawable) {
-        image = create_bits_picture(pict, has_clip, xoff, yoff);
+        image = create_bits_picture(pict, has_clip);
     }
     else if (pict->pSourcePict) {
         SourcePict *sp = pict->pSourcePict;
@@ -325,19 +293,17 @@ 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 bf82f8f..0145ce9 100644
--- a/fb/fbtrap.c
+++ b/fb/fbtrap.c
@@ -36,13 +36,12 @@ fbAddTraps(PicturePtr pPicture,
            INT16 x_off, INT16 y_off, int ntrap, xTrap * traps)
 {
     pixman_image_t *image;
-    int dst_xoff, dst_yoff;
 
-    if (!(image = image_from_pict(pPicture, FALSE, &dst_xoff, &dst_yoff)))
-        return;
-
-    pixman_add_traps(image, x_off + dst_xoff, y_off + dst_yoff,
-                     ntrap, (pixman_trap_t *) traps);
+    if (!(image = image_from_pict (pPicture, FALSE)))
+	return;
+    
+    pixman_add_traps(image, x_off, y_off,
+                     ntrap, (pixman_trap_t *)traps);
 
     free_pixman_pict(pPicture, image);
 }
@@ -52,13 +51,12 @@ fbRasterizeTrapezoid(PicturePtr pPicture,
                      xTrapezoid * trap, int x_off, 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);
+    pixman_rasterize_trapezoid(image, (pixman_trapezoid_t *)trap,
+                               x_off, y_off);
 
     free_pixman_pict(pPicture, image);
 }
@@ -68,14 +66,12 @@ fbAddTriangles(PicturePtr pPicture,
                INT16 x_off, INT16 y_off, int ntri, 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,
-                         ntri, (pixman_triangle_t *) tris);
+    
+    pixman_add_triangles(image, x_off, y_off, ntri,
+                         (pixman_triangle_t *)tris);
 
     free_pixman_pict(pPicture, image);
 }
@@ -98,13 +94,11 @@ fbShapes(CompositeShapesFunc composite,
          int16_t ySrc, int nshapes, int shape_size, 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) {
         pixman_format_code_t format;
@@ -121,9 +115,8 @@ fbShapes(CompositeShapesFunc composite,
 
             for (i = 0; i < nshapes; ++i) {
                 composite(op, src, dst, format,
-                          xSrc + src_xoff,
-                          ySrc + src_yoff,
-                          dst_xoff, dst_yoff, 1, shapes + i * shape_size);
+                          xSrc, ySrc, 0, 0, 
+                          1, shapes + i * shape_size);
             }
         }
         else {
@@ -143,8 +136,8 @@ fbShapes(CompositeShapesFunc composite,
             }
 
             composite(op, src, dst, format,
-                      xSrc + src_xoff,
-                      ySrc + src_yoff, dst_xoff, dst_yoff, nshapes, shapes);
+                      xSrc, ySrc, 0, 0,
+                      nshapes, shapes);
         }
 
         DamageRegionProcessPending(pDst->pDrawable);
commit a8f9272c6b962e24b4f8594972c174ee41fda353
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>
    (cherry picked from commit d7e56959401ce32120af67b01632442c52f2cf85)

diff --git a/mi/miexpose.c b/mi/miexpose.c
index 2dc465d..7e36310 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -490,7 +490,8 @@ void RootlessSetPixmapOfAncestors(WindowPtr pWin);
 void RootlessStartDrawing(WindowPtr pWin);
 void RootlessDamageRegion(WindowPtr pWin, RegionPtr prgn);
 Bool IsFramedWindow(WindowPtr pWin);
-#endif
+#include "../fb/fb.h"
+#endif 
 
 void
 miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
@@ -519,23 +520,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;
+#endif
+    
+    if (what == PW_BACKGROUND)
+    {
+#ifdef ROOTLESS
+        if(IsFramedWindow(pWin)) {
+            RootlessStartDrawing(pWin);
+            RootlessDamageRegion(pWin, prgn);
 
-    if (IsFramedWindow(pWin)) {
-        RootlessStartDrawing(pWin);
-        RootlessDamageRegion(pWin, prgn);
-
-        if (pWin->backgroundState == ParentRelative) {
-            if ((what == PW_BACKGROUND) ||
-                (what == PW_BORDER && !pWin->borderIsPixel))
+            if(pWin->backgroundState == ParentRelative) {
                 RootlessSetPixmapOfAncestors(pWin);
+            }
         }
-    }
 #endif
 
-    if (what == PW_BACKGROUND) {
         while (pWin->backgroundState == ParentRelative)
             pWin = pWin->parent;
 
@@ -560,6 +575,18 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
     else {
         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;
 
@@ -568,6 +595,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;
@@ -630,6 +663,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 472aa2f4d22018c9ca668553d749df609b0dba5a
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Jan 13 12:00:57 2012 -0800

    sdksyms.sh: Use CPPFLAGS, not CFLAGS
    
    CFLAGS can include flags which are not useful to the preprocessor
    or can even cause it to fail.  This fixes a build issue on darwin
    when building for more than one architecture.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 290d366d4c6b6e051f0e337a1a6ee76f42d28003)

diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 391b26e..8c69b1b 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -38,7 +38,7 @@ DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw os-support \
 bin_PROGRAMS = Xorg
 nodist_Xorg_SOURCES = sdksyms.c
 
-AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
+AM_CPPFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
 INCLUDES = $(XORG_INCS) -I$(srcdir)/parser -I$(top_srcdir)/miext/cw \
 	-I$(srcdir)/ddc -I$(srcdir)/i2c -I$(srcdir)/modes -I$(srcdir)/ramdac
 
@@ -109,7 +109,7 @@ CLEANFILES = sdksyms.c sdksyms.dep
 EXTRA_DIST += sdksyms.sh
 
 sdksyms.dep sdksyms.c: sdksyms.sh
-	CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $(srcdir)/sdksyms.sh $(top_srcdir) $(CFLAGS) $(AM_CFLAGS) $(INCLUDES)
+	CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $(srcdir)/sdksyms.sh $(top_srcdir) $(CPPFLAGS) $(AM_CPPFLAGS) $(INCLUDES)
 
 SDKSYMS_DEP = sdksyms.dep
 include $(SDKSYMS_DEP)
commit 61b25d83fec2d07a01d0fb1f5bdbc1bc71ee652a
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Feb 17 13:15:12 2012 -0800

    XQuartz: Detect FatalErrors on startup to prevent tight crash loops
    
    If a FatalError occurs before the server finishes launching, it will
    not have drained the launchd-owned DISPLAY socket, so launchd will
    just relaunch it.  This can cause the server to crash in a tight loop
    which will spam the user with CrashReporter windows that claim focus on
    appearance.
    
    This allows users stuck in this loop to "deal" with the problem without
    popping up a crash report every 10 seconds.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit 3505e1faadddeeec85a0d3f823c877ea33f86e00)
    
    Conflicts:
    
    	hw/xquartz/X11Application.h

diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h
index 740a807..5ea6129 100644
--- a/hw/xquartz/X11Application.h
+++ b/hw/xquartz/X11Application.h
@@ -89,6 +89,9 @@ X11ApplicationCanEnterRandR(void);
 void
 X11ApplicationMain(int argc, char **argv, char **envp);
 
+void
+X11ApplicationFatalError(const char *f, va_list args) __printflike(1, 0);
+
 #define PREFS_APPSMENU                "apps_menu"
 #define PREFS_FAKEBUTTONS             "enable_fake_buttons"
 #define PREFS_KEYEQUIVS               "enable_key_equivalents"
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 339a93f..cd6bad6 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -72,6 +72,7 @@ static dispatch_queue_t eventTranslationQueue;
 
 extern Bool noTestExtensions;
 extern Bool noRenderExtension;
+extern BOOL serverRunning;
 
 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
 static TISInputSourceRef last_key_layout;
@@ -1073,6 +1074,50 @@ X11ApplicationCanEnterRandR(void)
     }
 }
 
+void
+X11ApplicationFatalError(const char *f, va_list args)
+{
+#ifdef HAVE_LIBDISPATCH
+    NSString *title, *msg;
+    char *error_msg;
+
+    /* This is called by FatalError() in the server thread just before
+     * we would abort.  If the server never got off the ground, We should
+     * inform the user of the error rather than letting the ever-so-friendly
+     * CrashReporter do it for us.
+     *
+     * This also has the benefit of forcing user interaction rather than
+     * allowing an infinite throttled-restart if the crash occurs before
+     * we can drain the launchd socket.
+     */
+
+    if (serverRunning) {
+        return;
+    }
+
+    title = NSLocalizedString(@"The application X11 could not be opened.",
+                              @"Dialog title when encountering a fatal error");
+    msg = NSLocalizedString(@"An error occurred while starting the X11 server: \"%s\"\n\nClick Quit to quit X11. Click Report to see more details or send a report to Apple.",
+                            @"Dialog when encountering a fatal error");
+
+    vasprintf(&error_msg, f, args);
+    msg = [NSString stringWithFormat:msg, error_msg];
+
+    /* We want the AppKit thread to actually service the alert or we will race [NSApp run] and create an
+     * 'NSInternalInconsistencyException', reason: 'NSApp with wrong _running count'
+     */
+    dispatch_sync(dispatch_get_main_queue(), ^{
+        if (NSAlertDefaultReturn == NSRunAlertPanel(title, msg, NSLocalizedString(@"Quit", @""),
+                                                    NSLocalizedString (@"Report...", @""), nil)) {
+            exit(EXIT_FAILURE);
+        }
+    });
+
+    /* fall back to caller to do the abort() in the DIX */
+#endif
+}
+
+
 static void
 check_xinitrc(void)
 {
diff --git a/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings
index bf2089c..36ae0ff 100644
Binary files a/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings and b/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings differ
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index e2ab057..41db72a 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -78,6 +78,8 @@
 #include "quartzKeyboard.h"
 #include "quartz.h"
 
+#include "X11Application.h"
+
 aslclient aslc;
 
 void
@@ -672,7 +674,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
 void
 OsVendorFatalError(const char *f, va_list args)
 {
-    ErrorF("   OsVendorFatalError\n");
+    X11ApplicationFatalError(f, args);
 }
 
 /*
commit e5db7375406ff9076aef4285626892993162aae6
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Thu Apr 19 16:39:23 2012 -0700

    os: Annotate OsVendorFatalError as _X_ATTRIBUTE_PRINTF
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    Tested-By: Michal Suchanek <hramrach at gmail.com>
    (cherry picked from commit d97868d934fd1a00f9e9ef23a1154a70c7bc0464)

diff --git a/include/os.h b/include/os.h
index 970ff02..8b58d7a 100644
--- a/include/os.h
+++ b/include/os.h
@@ -321,7 +321,8 @@ extern _X_EXPORT void
 OsCleanup(Bool);
 
 extern _X_EXPORT void
-OsVendorFatalError(const char *f, va_list args);
+OsVendorFatalError(const char *f, va_list args)
+_X_ATTRIBUTE_PRINTF(1, 0);
 
 extern _X_EXPORT void
 OsVendorInit(void);
commit 21ddb9504835ed2c57ce8bd233707c82ba6d6229
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Mar 28 15:07:51 2012 -0700

    os: Fix regression with FatalError not calling va_start
    
    Regression From: a818b305989bbcde4e585112a7ee70cbc0b14a92
    
    Found-by: Colin Harrison <colin.harrison at virgin.net>
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit 817cec8ffd6cdb1abbcc00decd43569d44801764)

diff --git a/os/log.c b/os/log.c
index 315ba1e..e8dcf02 100644
--- a/os/log.c
+++ b/os/log.c
@@ -591,6 +591,8 @@ FatalError(const char *f, ...)
     else
         ErrorF("\nFatal server error:\n");
 
+    va_start(args, f);
+
     /* Make a copy for OsVendorFatalError */
     va_copy(args2, args);
 
commit cc8b40966d3dfbdac378f1196676b1624086a890
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Feb 17 12:35:02 2012 -0800

    os: Pass the FatalError message to OsVendorFatalError
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    (cherry picked from commit a818b305989bbcde4e585112a7ee70cbc0b14a92)

diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c
index 09e3d74..5804353 100644
--- a/hw/dmx/dmxinit.c
+++ b/hw/dmx/dmxinit.c
@@ -905,7 +905,7 @@ OsVendorInit(void)
  * two routines mentioned here, as well as by others) to use the
  * referenced routine instead of \a vfprintf().) */
 void
-OsVendorFatalError(void)
+OsVendorFatalError(const char *f, va_list args)
 {
 }
 
diff --git a/hw/dmx/dmxlog.c b/hw/dmx/dmxlog.c
index 151f672..3249c48 100644
--- a/hw/dmx/dmxlog.c
+++ b/hw/dmx/dmxlog.c
@@ -114,9 +114,6 @@ VFatalError(const char *format, va_list args)
 {
     VErrorF(format, args);
     ErrorF("\n");
-#ifdef DDXOSFATALERROR
-    OsVendorFatalError();
-#endif
     AbortServer();
  /*NOTREACHED*/}
 #endif
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index 716f18e..2bda4d0 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -1104,7 +1104,7 @@ KdInitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
 }
 
 void
-OsVendorFatalError(void)
+OsVendorFatalError(const char *f, va_list args)
 {
 }
 
diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c
index 2d679a5..e2cd96c 100644
--- a/hw/vfb/InitOutput.c
+++ b/hw/vfb/InitOutput.c
@@ -219,7 +219,7 @@ OsVendorInit(void)
 }
 
 void
-OsVendorFatalError(void)
+OsVendorFatalError(const char *f, va_list args)
 {
 }
 
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index ba80aca..2ae3f1a 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1054,7 +1054,7 @@ AbortDDX(enum ExitCode error)
 }
 
 void
-OsVendorFatalError(void)
+OsVendorFatalError(const char *f, va_list args)
 {
 #ifdef VENDORSUPPORT
     ErrorF("\nPlease refer to your Operating System Vendor support pages\n"
diff --git a/hw/xnest/Init.c b/hw/xnest/Init.c
index 0909826..330b8ca 100644
--- a/hw/xnest/Init.c
+++ b/hw/xnest/Init.c
@@ -142,7 +142,7 @@ OsVendorInit(void)
 }
 
 void
-OsVendorFatalError(void)
+OsVendorFatalError(const char *f, va_list args)
 {
     return;
 }
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 74e11fe..e2ab057 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -670,7 +670,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
  * OsVendorFatalError
  */
 void
-OsVendorFatalError(void)
+OsVendorFatalError(const char *f, va_list args)
 {
     ErrorF("   OsVendorFatalError\n");
 }
diff --git a/hw/xwin/winerror.c b/hw/xwin/winerror.c
index 4049e97..a25307c 100644
--- a/hw/xwin/winerror.c
+++ b/hw/xwin/winerror.c
@@ -70,7 +70,7 @@ OsVendorVErrorF(const char *pszFormat, va_list va_args)
  * Attempt to do last-ditch, safe, important cleanup here.
  */
 void
-OsVendorFatalError(void)
+OsVendorFatalError(const char *f, va_list args)
 {
     /* Don't give duplicate warning if UseMsg was called */
     if (g_fSilentFatalError)
diff --git a/include/os.h b/include/os.h
index 4b5b440..970ff02 100644
--- a/include/os.h
+++ b/include/os.h
@@ -321,7 +321,7 @@ extern _X_EXPORT void
 OsCleanup(Bool);
 
 extern _X_EXPORT void
-OsVendorFatalError(void);
+OsVendorFatalError(const char *f, va_list args);
 
 extern _X_EXPORT void
 OsVendorInit(void);
diff --git a/os/log.c b/os/log.c
index 0e49572..315ba1e 100644
--- a/os/log.c
+++ b/os/log.c
@@ -583,6 +583,7 @@ void
 FatalError(const char *f, ...)
 {
     va_list args;
+    va_list args2;
     static Bool beenhere = FALSE;
 
     if (beenhere)
@@ -590,22 +591,25 @@ FatalError(const char *f, ...)
     else
         ErrorF("\nFatal server error:\n");
 
-    va_start(args, f);
+    /* Make a copy for OsVendorFatalError */
+    va_copy(args2, args);
+
 #ifdef __APPLE__
     {
-        va_list args2;
+        va_list apple_args;
 
-        va_copy(args2, args);
-        (void) vsnprintf(__crashreporter_info_buff__,
-                         sizeof(__crashreporter_info_buff__), f, args2);
-        va_end(args2);
+        va_copy(apple_args, args);
+        (void)vsnprintf(__crashreporter_info_buff__,
+                        sizeof(__crashreporter_info_buff__), f, apple_args);
+        va_end(apple_args);
     }
 #endif
     VErrorF(f, args);
     va_end(args);
     ErrorF("\n");
     if (!beenhere)
-        OsVendorFatalError();
+        OsVendorFatalError(f, args2);
+    va_end(args2);
     if (!beenhere) {
         beenhere = TRUE;
         AbortServer();
diff --git a/test/ddxstubs.c b/test/ddxstubs.c
index a214b96..3647dc5 100644
--- a/test/ddxstubs.c
+++ b/test/ddxstubs.c
@@ -50,7 +50,7 @@ OsVendorInit(void)
 }
 
 void
-OsVendorFatalError(void)
+OsVendorFatalError(const char *f, va_list args)
 {
 }
 
commit dfc03ef3fda3572db590c2096272c990d434163e
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date:   Sun Aug 26 22:11:00 2012 -0700

    configure.ac: Version bump to 1.12.4
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>

diff --git a/configure.ac b/configure.ac
index 28c9cf8..7c7e69e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,8 +26,8 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.60)
-AC_INIT([xorg-server], 1.12.3.902, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2012-08-19"
+AC_INIT([xorg-server], 1.12.4, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2012-08-27"
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
commit 8995fcf260895ad288146b78d4c42b6f3b838d4f
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date:   Sun Aug 26 22:09:49 2012 -0700

    XQuartz: Bump version to 2.7.3
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>

diff --git a/hw/xquartz/bundle/Info.plist.cpp b/hw/xquartz/bundle/Info.plist.cpp
index 4b6d9d1..460047c 100644
--- a/hw/xquartz/bundle/Info.plist.cpp
+++ b/hw/xquartz/bundle/Info.plist.cpp
@@ -19,9 +19,9 @@
 	<key>CFBundlePackageType</key>
 		<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
-		<string>2.7.2</string>
+		<string>2.7.3</string>
 	<key>CFBundleVersion</key>
-		<string>2.7.2</string>
+		<string>2.7.3</string>
 	<key>CFBundleSignature</key>
 		<string>x11a</string>
 	<key>CSResourcesFileMapped</key>
commit a6d7400507f220d6f98b853def7904586fb1eadd
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date:   Sun Aug 19 09:07:33 2012 -0700

    configure.ac: Version bump to 1.12.3.902 (1.12.4 RC2)
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>

diff --git a/configure.ac b/configure.ac
index aece819..28c9cf8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,8 +26,8 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.60)
-AC_INIT([xorg-server], 1.12.3.901, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2012-08-03"
+AC_INIT([xorg-server], 1.12.3.902, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2012-08-19"
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
commit 0754f74a538ca59e45a39fefa2d90b9d3bc822dd
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date:   Thu Aug 16 19:42:54 2012 -0700

    XQuartz: console_redirect: Properly zero-out the tail of the array on realloc()
    
    We forgot to multiply by sizeof(), so it wasn't fully zeroed out.
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
    (cherry picked from commit 7c3d2e4828deb4e8ec38e8ef88d6f92b2d931033)

diff --git a/hw/xquartz/console_redirect.c b/hw/xquartz/console_redirect.c
index 30e397a..8fdce46 100644
--- a/hw/xquartz/console_redirect.c
+++ b/hw/xquartz/console_redirect.c
@@ -365,8 +365,8 @@ xq_asl_log_fd(aslclient asl, aslmsg msg, int level, int fd)
                               BLOCK_DONE;
                           }
                           redirect_fds = new_array;
-                          memset(redirect_fds + n_redirect_fds, 0, new_n -
-                                 n_redirect_fds);
+                          memset(redirect_fds + n_redirect_fds, 0, (new_n -
+                                 n_redirect_fds) * sizeof(*redirect_fds));
                           n_redirect_fds = new_n;
                       }
 
commit 2141f21d51b0787c8d287bb50d01a6a81e61a634
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date:   Thu Aug 16 15:43:34 2012 -0700

    XQuartz: console_redirect: Set the correct location for reading into the buffer
    
    Prior to this change, it was possible that a large message would have some
    of its data prepended to subsequent messages due to our not incorrectly
    setting the location to write into the buffer.
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
    (cherry picked from commit a32e01802ff1c938c0afe0cc007a273b9ada8610)

diff --git a/hw/xquartz/console_redirect.c b/hw/xquartz/console_redirect.c
index 91d693b..30e397a 100644
--- a/hw/xquartz/console_redirect.c
+++ b/hw/xquartz/console_redirect.c
@@ -110,27 +110,33 @@ _read_redirect(int fd, int flush)
         /* Increment our returned number read */
         total_read += nbytes;
 
-        nbytes += (aslr->w - aslr->buf);
-        aslr->buf[nbytes] = '\0';
+        /* Increment our write location */
+        aslr->w += nbytes;
+        aslr->w[0] = '\0';
 
         /* One line at a time */
-        for (p = aslr->buf; *p && (p - aslr->buf) < nbytes; p = s + 1) {
+        for (p = aslr->buf; p < aslr->w; p = s + 1) {
             // Find null or \n
             for (s = p; *s && *s != '\n'; s++) ;
             if (*s == '\n') {
                 *s = '\0';
+            }
+
+            if (s < aslr->w || aslr->buf == p) {
+                /* Either the first of multiple messages or one message which is larger than our buffer */
                 asl_log(aslr->asl, aslr->msg, aslr->level, "%s", p);
             }
-            else if (aslr->buf != p) {
+            else {
+                /* We reached the end of the buffer, move this chunk to the start. */
                 memmove(aslr->buf, p, BUF_SIZE - (p - aslr->buf));
                 aslr->w = aslr->buf + (s - p);
                 break;
             }
-            else if (nbytes == BUF_SIZE - 1) {
-                asl_log(aslr->asl, aslr->msg, aslr->level, "%s", p);
-                aslr->w = aslr->buf;
-                break;
-            }
+        }
+
+        if (p == aslr->w) {
+            /* Start writing at the beginning in the case where we flushed */
+            aslr->w = aslr->buf;
         }
     }
 
commit 73d62f1aaea4a862cc512048cb6ca59586f4cdb6
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Aug 7 17:49:46 2012 -0700

    Only free Render filter names on last screen close
    
    Hotplugging screens causes the render filter names to get freed while
    still in use; wait for the last core screen to be closed before
    freeing them. That only happens at server reset, when we want them to
    be freed.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    (cherry picked from commit 19772670e3041fe1c7f5bbf32fa039a6d8245ccb)

diff --git a/render/filter.c b/render/filter.c
index 8c401ee..019ea7f 100644
--- a/render/filter.c
+++ b/render/filter.c
@@ -273,7 +273,10 @@ PictureResetFilters(ScreenPtr pScreen)
 
     free(ps->filters);
     free(ps->filterAliases);
-    PictureFreeFilterIds();
+
+    /* Free the filters when the last screen is closed */
+    if (pScreen->myNum == 0)
+        PictureFreeFilterIds();
 }
 
 int
commit 3e62f48edf47a59d923ac58b6d4262b02456a556
Author: Simon Schubert <2 at 0x2c.org>
Date:   Sun Aug 12 09:40:16 2012 -0700

    fb: reorder Bresenham error correction to avoid overshoot.
    
    When fbBresSolid draws a line, it can happen that after the last
    pixel, the Bresenham error term overflows, and fbBresSolid paints
    another pixel before adjusting the error term.
    
    However, if this happens on the last pixel (len=0), this extra pixel
    might overshoot the boundary, and, in rare cases, lead to a segfault.
    
    Fix this issue by adjusting for the Bresenham error term before
    drawing the main pixel, not after.
    
    Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=24274
    Signed-off-by: Simon Schubert <2 at 0x2c.or>
    Tested-by: Mitch Davis <mjd+freedesktop.org at afork.com>
    Signed-off-by: Matt Turner <mattst88 at gmail.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 863d528a9f76d0e8f122aebf19f8564a4c67a938)

diff --git a/fb/fbseg.c b/fb/fbseg.c
index 0e4e0a9..1848387 100644
--- a/fb/fbseg.c
+++ b/fb/fbseg.c
@@ -65,6 +65,12 @@ fbBresSolid(DrawablePtr pDrawable,
     if (axis == X_AXIS) {
         bits = 0;
         while (len--) {
+            if (e >= 0) {
+                WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, bits));
+                bits = 0;
+                dst += dstStride;
+                e += e3;
+            }
             bits |= mask;
             mask = fbBresShiftMask(mask, signdx, dstBpp);
             if (!mask) {
@@ -74,21 +80,12 @@ fbBresSolid(DrawablePtr pDrawable,
                 mask = mask0;
             }
             e += e1;
-            if (e >= 0) {
-                WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, bits));
-                bits = 0;
-                dst += dstStride;
-                e += e3;
-            }
         }
         if (bits)
             WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, bits));
     }
     else {
         while (len--) {
-            WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, mask));
-            dst += dstStride;
-            e += e1;
             if (e >= 0) {
                 e += e3;
                 mask = fbBresShiftMask(mask, signdx, dstBpp);
@@ -97,6 +94,9 @@ fbBresSolid(DrawablePtr pDrawable,
                     mask = mask0;
                 }
             }
+            WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, mask));
+            dst += dstStride;
+            e += e1;
         }
     }
 
commit f0823a057e4c80dbb18c16f066ad36e6459fcc85
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Tue Jul 31 16:09:38 2012 +1000

    dix: make sure the mask is set for emulated scroll events (#52508)
    
    If a device has smooth scrolling axes, but submits scroll button events, we
    convert those to motion events and update the valuators. For legacy button
    events, the valuator mask is likely unset though, causing
    add_to_scroll_valuator() to return early, leaving us with an empty mask.
    That again skipped the rest of the code and no events were generated.
    
    Fix it by making sure that the scroll valuator in the mask is at least
    initialized to 0.
    
    Broke evdev wheel emulation, introduced by
    54476b5e4461ff523e935961affabcf0de12c556.
    
    X.Org Bug 52508 <http://bugs.freedesktop.org/show_bug.cgi?id=52508>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>
    (cherry picked from commit cb306a8f174bec9ded95191b91797f59250e6808)

diff --git a/dix/getevents.c b/dix/getevents.c
index b78d5ce..fade40c 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1601,6 +1601,8 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
 
         if (adj != 0.0 && axis != -1) {
             adj *= pDev->valuator->axes[axis].scroll.increment;
+            if (!valuator_mask_isset(&mask, axis))
+                valuator_mask_set(&mask, axis, 0);
             add_to_scroll_valuator(pDev, &mask, axis, adj);
             type = MotionNotify;
             buttons = 0;
commit 1f8a958a12c1c7c684051e5679420fe3a02ce307
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Jul 23 16:34:28 2012 -0400

    sync: Fix logic error from b55bf248581dc66321b24b29f199f6dc8d02db1b
    
    That commit adds two hunks, and I _think_ they're backwards.  It adds
    code to modify bracket_greater on NegativeTransition triggers, and
    bracket_less on PositiveTransition triggers.  That breaks symmetry with
    the surrounding code; the code as of this commit could probably be
    simplified further.
    
    I can't keep the sync trigger rules in my head for more than about five
    minutes at a time, so I'm sending this on for more eyes.  RHEL 6.3's
    xserver is shipping with b55bf248 reverted:
    
        https://bugzilla.redhat.com/show_bug.cgi?id=748704#c33
    
    And there appear to be some upstream reports of the same issue:
    
        https://bugzilla.gnome.org/show_bug.cgi?id=658955
    
    So I'd like to get this sorted out.
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 4a6f42dda00ba3b5616f8a86f0d4c9a652c7d9d4)

diff --git a/Xext/sync.c b/Xext/sync.c
index 532cb64..c9162ee 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -1033,15 +1033,15 @@ SyncComputeBracketValues(SyncCounter * pCounter)
                 pnewltval = &psci->bracket_less;
             }
             else if (XSyncValueEqual(pCounter->value, pTrigger->test_value) &&
-                     XSyncValueLessThan(pTrigger->test_value,
-                                        psci->bracket_greater)) {
+                     XSyncValueGreaterThan(pTrigger->test_value,
+                                           psci->bracket_less)) {
                 /*
                  * The value is exactly equal to our threshold.  We want one
-                 * more event in the positive direction to ensure we pick up
-                 * when the value *exceeds* this threshold.
+                 * more event in the negative direction to ensure we pick up
+                 * when the value is less than this threshold.
                  */
-                psci->bracket_greater = pTrigger->test_value;
-                pnewgtval = &psci->bracket_greater;
+                psci->bracket_less = pTrigger->test_value;
+                pnewltval = &psci->bracket_less;
             }
         }
         else if (pTrigger->test_type == XSyncPositiveTransition &&
@@ -1053,15 +1053,15 @@ SyncComputeBracketValues(SyncCounter * pCounter)
                 pnewgtval = &psci->bracket_greater;
             }
             else if (XSyncValueEqual(pCounter->value, pTrigger->test_value) &&
-                     XSyncValueGreaterThan(pTrigger->test_value,
-                                           psci->bracket_less)) {
+                     XSyncValueLessThan(pTrigger->test_value,
+                                        psci->bracket_greater)) {
                 /*
                  * The value is exactly equal to our threshold.  We want one
-                 * more event in the negative direction to ensure we pick up
-                 * when the value is less than this threshold.
+                 * more event in the positive direction to ensure we pick up
+                 * when the value *exceeds* this threshold.
                  */
-                psci->bracket_less = pTrigger->test_value;
-                pnewltval = &psci->bracket_less;
+                psci->bracket_greater = pTrigger->test_value;
+                pnewgtval = &psci->bracket_greater;
             }
         }
     }                           /* end for each trigger */
commit 83cba78a0c858df4d5405783f3a1fb4bab128129
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 16 21:12:06 2012 -0700

    Make indentation of dix/tables.c much more consistent and readable
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Acked-by: Daniel Stone <daniel at fooishbar.org>
    (cherry picked from commit c37c65052f674cd58894ad0b9ec22928a62c624e)

diff --git a/dix/tables.c b/dix/tables.c
index 705ef0d..686cddd 100644
--- a/dix/tables.c
+++ b/dix/tables.c
@@ -58,364 +58,529 @@ SOFTWARE.
 #include "swaprep.h"
 #include "swapreq.h"
 
-int (*InitialVector[3]) (ClientPtr      /* client */
-    ) = {
-0, ProcInitialConnection, ProcEstablishConnection};
+int (*InitialVector[3]) (ClientPtr /* client */) = {
+    0,
+    ProcInitialConnection,
+    ProcEstablishConnection
+};
 
-int (*ProcVector[256]) (ClientPtr       /* client */
-    ) = {
-    ProcBadRequest, ProcCreateWindow, ProcChangeWindowAttributes, ProcGetWindowAttributes, ProcDestroyWindow, ProcDestroySubwindows,    /* 5 */
-        ProcChangeSaveSet, ProcReparentWindow, ProcMapWindow, ProcMapSubwindows, ProcUnmapWindow,       /* 10 */
-        ProcUnmapSubwindows, ProcConfigureWindow, ProcCirculateWindow, ProcGetGeometry, ProcQueryTree,  /* 15 */
-        ProcInternAtom, ProcGetAtomName, ProcChangeProperty, ProcDeleteProperty, ProcGetProperty,       /* 20 */
-        ProcListProperties, ProcSetSelectionOwner, ProcGetSelectionOwner, ProcConvertSelection, ProcSendEvent,  /* 25 */
-        ProcGrabPointer, ProcUngrabPointer, ProcGrabButton, ProcUngrabButton, ProcChangeActivePointerGrab,      /* 30 */
-        ProcGrabKeyboard, ProcUngrabKeyboard, ProcGrabKey, ProcUngrabKey, ProcAllowEvents,      /* 35 */
-        ProcGrabServer, ProcUngrabServer, ProcQueryPointer, ProcGetMotionEvents, ProcTranslateCoords,   /* 40 */
-        ProcWarpPointer, ProcSetInputFocus, ProcGetInputFocus, ProcQueryKeymap, ProcOpenFont,   /* 45 */
-        ProcCloseFont, ProcQueryFont, ProcQueryTextExtents, ProcListFonts, ProcListFontsWithInfo,       /* 50 */
-        ProcSetFontPath, ProcGetFontPath, ProcCreatePixmap, ProcFreePixmap, ProcCreateGC,       /* 55 */
-        ProcChangeGC, ProcCopyGC, ProcSetDashes, ProcSetClipRectangles, ProcFreeGC,     /* 60 */
-        ProcClearToBackground, ProcCopyArea, ProcCopyPlane, ProcPolyPoint, ProcPolyLine,        /* 65 */
-        ProcPolySegment, ProcPolyRectangle, ProcPolyArc, ProcFillPoly, ProcPolyFillRectangle,   /* 70 */
-        ProcPolyFillArc, ProcPutImage, ProcGetImage, ProcPolyText, ProcPolyText,        /* 75 */
-        ProcImageText8, ProcImageText16, ProcCreateColormap, ProcFreeColormap, ProcCopyColormapAndFree, /* 80 */
-        ProcInstallColormap, ProcUninstallColormap, ProcListInstalledColormaps, ProcAllocColor, ProcAllocNamedColor,    /* 85 */
-        ProcAllocColorCells, ProcAllocColorPlanes, ProcFreeColors, ProcStoreColors, ProcStoreNamedColor,        /* 90 */
-        ProcQueryColors, ProcLookupColor, ProcCreateCursor, ProcCreateGlyphCursor, ProcFreeCursor,      /* 95 */
-        ProcRecolorCursor, ProcQueryBestSize, ProcQueryExtension, ProcListExtensions, ProcChangeKeyboardMapping,        /* 100 */
-        ProcGetKeyboardMapping, ProcChangeKeyboardControl, ProcGetKeyboardControl, ProcBell, ProcChangePointerControl,  /* 105 */
-        ProcGetPointerControl, ProcSetScreenSaver, ProcGetScreenSaver, ProcChangeHosts, ProcListHosts,  /* 110 */
-        ProcChangeAccessControl, ProcChangeCloseDownMode, ProcKillClient, ProcRotateProperties, ProcForceScreenSaver,   /* 115 */
-        ProcSetPointerMapping, ProcGetPointerMapping, ProcSetModifierMapping, ProcGetModifierMapping, ProcBadRequest,   /* 120 */
-        ProcBadRequest, ProcBadRequest, ProcBadRequest, ProcBadRequest, ProcBadRequest, /* 125 */
-ProcBadRequest,
-        ProcNoOperation,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest, ProcBadRequest, ProcBadRequest, ProcBadRequest};
+int (*ProcVector[256]) (ClientPtr /* client */) = {
+    ProcBadRequest,
+    ProcCreateWindow,
+    ProcChangeWindowAttributes,
+    ProcGetWindowAttributes,
+    ProcDestroyWindow,
+    ProcDestroySubwindows,              /* 5 */
+    ProcChangeSaveSet,
+    ProcReparentWindow,
+    ProcMapWindow,
+    ProcMapSubwindows,
+    ProcUnmapWindow,                    /* 10 */
+    ProcUnmapSubwindows,
+    ProcConfigureWindow,
+    ProcCirculateWindow,
+    ProcGetGeometry,
+    ProcQueryTree,                      /* 15 */
+    ProcInternAtom,
+    ProcGetAtomName,
+    ProcChangeProperty,
+    ProcDeleteProperty,
+    ProcGetProperty,                    /* 20 */
+    ProcListProperties,
+    ProcSetSelectionOwner,
+    ProcGetSelectionOwner,
+    ProcConvertSelection,
+    ProcSendEvent,                      /* 25 */
+    ProcGrabPointer,
+    ProcUngrabPointer,
+    ProcGrabButton,
+    ProcUngrabButton,
+    ProcChangeActivePointerGrab,        /* 30 */
+    ProcGrabKeyboard,
+    ProcUngrabKeyboard,
+    ProcGrabKey,
+    ProcUngrabKey,
+    ProcAllowEvents,                    /* 35 */
+    ProcGrabServer,
+    ProcUngrabServer,
+    ProcQueryPointer,
+    ProcGetMotionEvents,
+    ProcTranslateCoords,                /* 40 */
+    ProcWarpPointer,
+    ProcSetInputFocus,
+    ProcGetInputFocus,
+    ProcQueryKeymap,
+    ProcOpenFont,                       /* 45 */
+    ProcCloseFont,
+    ProcQueryFont,
+    ProcQueryTextExtents,
+    ProcListFonts,
+    ProcListFontsWithInfo,              /* 50 */
+    ProcSetFontPath,
+    ProcGetFontPath,
+    ProcCreatePixmap,
+    ProcFreePixmap,
+    ProcCreateGC,                       /* 55 */
+    ProcChangeGC,
+    ProcCopyGC,
+    ProcSetDashes,
+    ProcSetClipRectangles,
+    ProcFreeGC,                         /* 60 */
+    ProcClearToBackground,
+    ProcCopyArea,
+    ProcCopyPlane,
+    ProcPolyPoint,
+    ProcPolyLine,                       /* 65 */
+    ProcPolySegment,
+    ProcPolyRectangle,
+    ProcPolyArc,
+    ProcFillPoly,
+    ProcPolyFillRectangle,              /* 70 */
+    ProcPolyFillArc,
+    ProcPutImage,
+    ProcGetImage,
+    ProcPolyText,
+    ProcPolyText,                       /* 75 */
+    ProcImageText8,
+    ProcImageText16,
+    ProcCreateColormap,
+    ProcFreeColormap,
+    ProcCopyColormapAndFree,            /* 80 */
+    ProcInstallColormap,
+    ProcUninstallColormap,
+    ProcListInstalledColormaps,
+    ProcAllocColor,
+    ProcAllocNamedColor,                /* 85 */
+    ProcAllocColorCells,
+    ProcAllocColorPlanes,
+    ProcFreeColors,
+    ProcStoreColors,
+    ProcStoreNamedColor,                /* 90 */
+    ProcQueryColors,
+    ProcLookupColor,
+    ProcCreateCursor,
+    ProcCreateGlyphCursor,
+    ProcFreeCursor,                     /* 95 */
+    ProcRecolorCursor,
+    ProcQueryBestSize,
+    ProcQueryExtension,
+    ProcListExtensions,
+    ProcChangeKeyboardMapping,          /* 100 */
+    ProcGetKeyboardMapping,
+    ProcChangeKeyboardControl,
+    ProcGetKeyboardControl,
+    ProcBell,
+    ProcChangePointerControl,           /* 105 */
+    ProcGetPointerControl,
+    ProcSetScreenSaver,
+    ProcGetScreenSaver,
+    ProcChangeHosts,
+    ProcListHosts,                      /* 110 */
+    ProcChangeAccessControl,
+    ProcChangeCloseDownMode,
+    ProcKillClient,
+    ProcRotateProperties,
+    ProcForceScreenSaver,               /* 115 */
+    ProcSetPointerMapping,
+    ProcGetPointerMapping,
+    ProcSetModifierMapping,
+    ProcGetModifierMapping,
+    ProcBadRequest,                     /* 120 */
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,                     /* 125 */
+    ProcBadRequest,
+    ProcNoOperation,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest
+};
 
-int (*SwappedProcVector[256]) (ClientPtr        /* client */
-    ) = {
-    ProcBadRequest, SProcCreateWindow, SProcChangeWindowAttributes, SProcResourceReq,   /* GetWindowAttributes */
-        SProcResourceReq,       /* DestroyWindow */
-        SProcResourceReq,       /* 5 DestroySubwindows */
-        SProcResourceReq,       /* SProcChangeSaveSet, */
-        SProcReparentWindow, SProcResourceReq,  /* MapWindow */
-        SProcResourceReq,       /* MapSubwindows */
-        SProcResourceReq,       /* 10 UnmapWindow */
-        SProcResourceReq,       /* UnmapSubwindows */
-        SProcConfigureWindow, SProcResourceReq, /* SProcCirculateWindow, */
-        SProcResourceReq,       /* GetGeometry */
-        SProcResourceReq,       /* 15 QueryTree */
-        SProcInternAtom, SProcResourceReq,      /* SProcGetAtomName, */
-        SProcChangeProperty, SProcDeleteProperty, SProcGetProperty,     /* 20 */
-        SProcResourceReq,       /* SProcListProperties, */
-        SProcSetSelectionOwner, SProcResourceReq,       /* SProcGetSelectionOwner, */
-        SProcConvertSelection, SProcSendEvent,  /* 25 */
-        SProcGrabPointer, SProcResourceReq,     /* SProcUngrabPointer, */
-        SProcGrabButton, SProcUngrabButton, SProcChangeActivePointerGrab,       /* 30 */
-        SProcGrabKeyboard, SProcResourceReq,    /* SProcUngrabKeyboard, */
-        SProcGrabKey, SProcUngrabKey, SProcResourceReq, /* 35 SProcAllowEvents, */
-        SProcSimpleReq,         /* SProcGrabServer, */
-        SProcSimpleReq,         /* SProcUngrabServer, */
-        SProcResourceReq,       /* SProcQueryPointer, */
-        SProcGetMotionEvents, SProcTranslateCoords,     /*40 */
-        SProcWarpPointer, SProcSetInputFocus, SProcSimpleReq,   /* SProcGetInputFocus, */
-        SProcSimpleReq,         /* QueryKeymap, */
-        SProcOpenFont,          /* 45 */
-        SProcResourceReq,       /* SProcCloseFont, */
-        SProcResourceReq,       /* SProcQueryFont, */
-        SProcResourceReq,       /* SProcQueryTextExtents,  */
-        SProcListFonts, SProcListFontsWithInfo, /* 50 */
-        SProcSetFontPath, SProcSimpleReq,       /* GetFontPath, */
-        SProcCreatePixmap, SProcResourceReq,    /* SProcFreePixmap, */
-        SProcCreateGC,          /* 55 */
-        SProcChangeGC, SProcCopyGC, SProcSetDashes, SProcSetClipRectangles, SProcResourceReq,   /* 60 SProcFreeGC, */
-        SProcClearToBackground, SProcCopyArea, SProcCopyPlane, SProcPoly,       /* PolyPoint, */
-        SProcPoly,              /* 65 PolyLine */
-        SProcPoly,              /* PolySegment, */
-        SProcPoly,              /* PolyRectangle, */
-        SProcPoly,              /* PolyArc, */
-        SProcFillPoly, SProcPoly,       /* 70 PolyFillRectangle */
-        SProcPoly,              /* PolyFillArc, */
-        SProcPutImage, SProcGetImage, SProcPolyText, SProcPolyText,     /* 75 */
-        SProcImageText, SProcImageText, SProcCreateColormap, SProcResourceReq,  /* SProcFreeColormap, */
-        SProcCopyColormapAndFree,       /* 80 */
-        SProcResourceReq,       /* SProcInstallColormap, */
-        SProcResourceReq,       /* SProcUninstallColormap, */
-        SProcResourceReq,       /* SProcListInstalledColormaps, */
-        SProcAllocColor, SProcAllocNamedColor,  /* 85 */
-        SProcAllocColorCells, SProcAllocColorPlanes, SProcFreeColors, SProcStoreColors, SProcStoreNamedColor,   /* 90 */
-        SProcQueryColors, SProcLookupColor, SProcCreateCursor, SProcCreateGlyphCursor, SProcResourceReq,        /* 95 SProcFreeCursor, */
-        SProcRecolorCursor, SProcQueryBestSize, SProcQueryExtension, SProcSimpleReq,    /* ListExtensions, */
-        SProcChangeKeyboardMapping,     /* 100 */
-        SProcSimpleReq,         /* GetKeyboardMapping, */
-        SProcChangeKeyboardControl, SProcSimpleReq,     /* GetKeyboardControl, */
-        SProcSimpleReq,         /* Bell, */
-        SProcChangePointerControl,      /* 105 */
-        SProcSimpleReq,         /* GetPointerControl, */
-        SProcSetScreenSaver, SProcSimpleReq,    /* GetScreenSaver, */
-        SProcChangeHosts, SProcSimpleReq,       /* 110 ListHosts, */
-        SProcSimpleReq,         /* SProcChangeAccessControl, */
-        SProcSimpleReq,         /* SProcChangeCloseDownMode, */
-        SProcResourceReq,       /* SProcKillClient, */
-        SProcRotateProperties, SProcSimpleReq,  /* 115 ForceScreenSaver */
-        SProcSimpleReq,         /* SetPointerMapping, */
-        SProcSimpleReq,         /* GetPointerMapping, */
-        SProcSimpleReq,         /* SetModifierMapping, */
-        SProcSimpleReq,         /* GetModifierMapping, */
-        ProcBadRequest,         /* 120 */
-        ProcBadRequest, ProcBadRequest, ProcBadRequest, ProcBadRequest, ProcBadRequest, /* 125 */
-ProcBadRequest,
-        SProcNoOperation,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest,
-        ProcBadRequest, ProcBadRequest, ProcBadRequest, ProcBadRequest};
+int (*SwappedProcVector[256]) (ClientPtr /* client */) = {
+    ProcBadRequest,
+    SProcCreateWindow,
+    SProcChangeWindowAttributes,
+    SProcResourceReq,                   /* GetWindowAttributes */
+    SProcResourceReq,                   /* DestroyWindow */
+    SProcResourceReq,                   /* 5 DestroySubwindows */
+    SProcResourceReq,                   /* SProcChangeSaveSet, */
+    SProcReparentWindow,
+    SProcResourceReq,                   /* MapWindow */
+    SProcResourceReq,                   /* MapSubwindows */
+    SProcResourceReq,                   /* 10 UnmapWindow */
+    SProcResourceReq,                   /* UnmapSubwindows */
+    SProcConfigureWindow,
+    SProcResourceReq,                   /* SProcCirculateWindow, */
+    SProcResourceReq,                   /* GetGeometry */
+    SProcResourceReq,                   /* 15 QueryTree */
+    SProcInternAtom,
+    SProcResourceReq,                   /* SProcGetAtomName, */
+    SProcChangeProperty,
+    SProcDeleteProperty,
+    SProcGetProperty,                   /* 20 */
+    SProcResourceReq,                   /* SProcListProperties, */
+    SProcSetSelectionOwner,
+    SProcResourceReq,                   /* SProcGetSelectionOwner, */
+    SProcConvertSelection,
+    SProcSendEvent,                     /* 25 */
+    SProcGrabPointer,
+    SProcResourceReq,                   /* SProcUngrabPointer, */
+    SProcGrabButton,
+    SProcUngrabButton,
+    SProcChangeActivePointerGrab,       /* 30 */
+    SProcGrabKeyboard,
+    SProcResourceReq,                   /* SProcUngrabKeyboard, */
+    SProcGrabKey,
+    SProcUngrabKey,
+    SProcResourceReq,                   /* 35 SProcAllowEvents, */
+    SProcSimpleReq,                     /* SProcGrabServer, */
+    SProcSimpleReq,                     /* SProcUngrabServer, */
+    SProcResourceReq,                   /* SProcQueryPointer, */
+    SProcGetMotionEvents,
+    SProcTranslateCoords,               /*40 */
+    SProcWarpPointer,
+    SProcSetInputFocus,
+    SProcSimpleReq,                     /* SProcGetInputFocus, */
+    SProcSimpleReq,                     /* QueryKeymap, */
+    SProcOpenFont,                      /* 45 */
+    SProcResourceReq,                   /* SProcCloseFont, */
+    SProcResourceReq,                   /* SProcQueryFont, */
+    SProcResourceReq,                   /* SProcQueryTextExtents,  */
+    SProcListFonts,
+    SProcListFontsWithInfo,             /* 50 */
+    SProcSetFontPath,
+    SProcSimpleReq,                     /* GetFontPath, */
+    SProcCreatePixmap,
+    SProcResourceReq,                   /* SProcFreePixmap, */
+    SProcCreateGC,                      /* 55 */
+    SProcChangeGC,
+    SProcCopyGC,
+    SProcSetDashes,
+    SProcSetClipRectangles,
+    SProcResourceReq,                   /* 60 SProcFreeGC, */
+    SProcClearToBackground,
+    SProcCopyArea,
+    SProcCopyPlane,
+    SProcPoly,                          /* PolyPoint, */
+    SProcPoly,                          /* 65 PolyLine */
+    SProcPoly,                          /* PolySegment, */
+    SProcPoly,                          /* PolyRectangle, */
+    SProcPoly,                          /* PolyArc, */
+    SProcFillPoly,
+    SProcPoly,                          /* 70 PolyFillRectangle */
+    SProcPoly,                          /* PolyFillArc, */
+    SProcPutImage,
+    SProcGetImage,
+    SProcPolyText,
+    SProcPolyText,                      /* 75 */
+    SProcImageText,
+    SProcImageText,
+    SProcCreateColormap,
+    SProcResourceReq,                   /* SProcFreeColormap, */
+    SProcCopyColormapAndFree,           /* 80 */
+    SProcResourceReq,                   /* SProcInstallColormap, */
+    SProcResourceReq,                   /* SProcUninstallColormap, */
+    SProcResourceReq,                   /* SProcListInstalledColormaps, */
+    SProcAllocColor,
+    SProcAllocNamedColor,               /* 85 */
+    SProcAllocColorCells,
+    SProcAllocColorPlanes,
+    SProcFreeColors,
+    SProcStoreColors,
+    SProcStoreNamedColor,               /* 90 */
+    SProcQueryColors,
+    SProcLookupColor,
+    SProcCreateCursor,
+    SProcCreateGlyphCursor,
+    SProcResourceReq,                   /* 95 SProcFreeCursor, */
+    SProcRecolorCursor,
+    SProcQueryBestSize,
+    SProcQueryExtension,
+    SProcSimpleReq,                     /* ListExtensions, */
+    SProcChangeKeyboardMapping,         /* 100 */
+    SProcSimpleReq,                     /* GetKeyboardMapping, */
+    SProcChangeKeyboardControl,
+    SProcSimpleReq,                     /* GetKeyboardControl, */
+    SProcSimpleReq,                     /* Bell, */
+    SProcChangePointerControl,          /* 105 */
+    SProcSimpleReq,                     /* GetPointerControl, */
+    SProcSetScreenSaver,
+    SProcSimpleReq,                     /* GetScreenSaver, */
+    SProcChangeHosts,
+    SProcSimpleReq,                     /* 110 ListHosts, */
+    SProcSimpleReq,                     /* SProcChangeAccessControl, */
+    SProcSimpleReq,                     /* SProcChangeCloseDownMode, */
+    SProcResourceReq,                   /* SProcKillClient, */
+    SProcRotateProperties,
+    SProcSimpleReq,                     /* 115 ForceScreenSaver */
+    SProcSimpleReq,                     /* SetPointerMapping, */
+    SProcSimpleReq,                     /* GetPointerMapping, */
+    SProcSimpleReq,                     /* SetModifierMapping, */
+    SProcSimpleReq,                     /* GetModifierMapping, */
+    ProcBadRequest,                     /* 120 */
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,                     /* 125 */
+    ProcBadRequest,
+    SProcNoOperation,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest,
+    ProcBadRequest
+};
 
 EventSwapPtr EventSwapVector[MAXEVENTS] = {
     (EventSwapPtr) SErrorEvent,
@@ -423,32 +588,32 @@ EventSwapPtr EventSwapVector[MAXEVENTS] = {
     SKeyButtonPtrEvent,
     SKeyButtonPtrEvent,
     SKeyButtonPtrEvent,
-    SKeyButtonPtrEvent,         /* 5 */
+    SKeyButtonPtrEvent,                         /* 5 */
     SKeyButtonPtrEvent,
     SEnterLeaveEvent,
     SEnterLeaveEvent,
     SFocusEvent,
-    SFocusEvent,                /* 10 */
+    SFocusEvent,                                /* 10 */
     SKeymapNotifyEvent,
     SExposeEvent,
     SGraphicsExposureEvent,
     SNoExposureEvent,
-    SVisibilityEvent,           /* 15 */
+    SVisibilityEvent,                           /* 15 */
     SCreateNotifyEvent,
     SDestroyNotifyEvent,
     SUnmapNotifyEvent,
     SMapNotifyEvent,
-    SMapRequestEvent,           /* 20 */
+    SMapRequestEvent,                           /* 20 */
     SReparentEvent,
     SConfigureNotifyEvent,
     SConfigureRequestEvent,
     SGravityEvent,
-    SResizeRequestEvent,        /* 25 */
+    SResizeRequestEvent,                        /* 25 */
     SCirculateEvent,
     SCirculateEvent,
     SPropertyEvent,
     SSelectionClearEvent,
-    SSelectionRequestEvent,     /* 30 */
+    SSelectionRequestEvent,                     /* 30 */
     SSelectionNotifyEvent,
     SColormapEvent,
     SClientMessageEvent,
@@ -554,37 +719,37 @@ ReplySwapPtr ReplySwapVector[256] = {
     ReplyNotSwappd,
     (ReplySwapPtr) SGetWindowAttributesReply,
     ReplyNotSwappd,
-    ReplyNotSwappd,             /* 5 */
+    ReplyNotSwappd,                             /* 5 */
     ReplyNotSwappd,
     ReplyNotSwappd,
     ReplyNotSwappd,
     ReplyNotSwappd,
-    ReplyNotSwappd,             /* 10 */
+    ReplyNotSwappd,                             /* 10 */
     ReplyNotSwappd,
     ReplyNotSwappd,
     ReplyNotSwappd,
     (ReplySwapPtr) SGetGeometryReply,
-    (ReplySwapPtr) SQueryTreeReply,     /* 15 */
+    (ReplySwapPtr) SQueryTreeReply,             /* 15 */
     (ReplySwapPtr) SInternAtomReply,
     (ReplySwapPtr) SGetAtomNameReply,
     ReplyNotSwappd,
     ReplyNotSwappd,
-    (ReplySwapPtr) SGetPropertyReply,   /* 20 */
+    (ReplySwapPtr) SGetPropertyReply,           /* 20 */
     (ReplySwapPtr) SListPropertiesReply,
     ReplyNotSwappd,
     (ReplySwapPtr) SGetSelectionOwnerReply,
     ReplyNotSwappd,
-    ReplyNotSwappd,             /* 25 */
-    (ReplySwapPtr) SGenericReply,       /* SGrabPointerReply, */
+    ReplyNotSwappd,                             /* 25 */
+    (ReplySwapPtr) SGenericReply,               /* SGrabPointerReply, */
     ReplyNotSwappd,
     ReplyNotSwappd,
     ReplyNotSwappd,
-    ReplyNotSwappd,             /* 30 */
-    (ReplySwapPtr) SGenericReply,       /* SGrabKeyboardReply, */
+    ReplyNotSwappd,                             /* 30 */
+    (ReplySwapPtr) SGenericReply,               /* SGrabKeyboardReply, */
     ReplyNotSwappd,
     ReplyNotSwappd,
     ReplyNotSwappd,
-    ReplyNotSwappd,             /* 35 */
+    ReplyNotSwappd,                             /* 35 */
     ReplyNotSwappd,
     ReplyNotSwappd,
     (ReplySwapPtr) SQueryPointerReply,
@@ -594,7 +759,7 @@ ReplySwapPtr ReplySwapVector[256] = {
     ReplyNotSwappd,
     (ReplySwapPtr) SGetInputFocusReply,
     (ReplySwapPtr) SQueryKeymapReply,
-    ReplyNotSwappd,             /* 45 */
+    ReplyNotSwappd,                             /* 45 */
     ReplyNotSwappd,
     (ReplySwapPtr) SQueryFontReply,
     (ReplySwapPtr) SQueryTextExtentsReply,
@@ -604,32 +769,32 @@ ReplySwapPtr ReplySwapVector[256] = {
     (ReplySwapPtr) SGetFontPathReply,
     ReplyNotSwappd,
     ReplyNotSwappd,
-    ReplyNotSwappd,             /* 55 */
+    ReplyNotSwappd,                             /* 55 */
     ReplyNotSwappd,
     ReplyNotSwappd,
     ReplyNotSwappd,
     ReplyNotSwappd,
-    ReplyNotSwappd,             /* 60 */
+    ReplyNotSwappd,                             /* 60 */
     ReplyNotSwappd,
     ReplyNotSwappd,
     ReplyNotSwappd,
     ReplyNotSwappd,
-    ReplyNotSwappd,             /* 65 */
+    ReplyNotSwappd,                             /* 65 */
     ReplyNotSwappd,
     ReplyNotSwappd,
     ReplyNotSwappd,
     ReplyNotSwappd,
-    ReplyNotSwappd,             /* 70 */
+    ReplyNotSwappd,                             /* 70 */
     ReplyNotSwappd,
     ReplyNotSwappd,
     (ReplySwapPtr) SGetImageReply,
     ReplyNotSwappd,
-    ReplyNotSwappd,             /* 75 */
+    ReplyNotSwappd,                             /* 75 */
     ReplyNotSwappd,
     ReplyNotSwappd,
     ReplyNotSwappd,
     ReplyNotSwappd,
-    ReplyNotSwappd,             /* 80 */
+    ReplyNotSwappd,                             /* 80 */
     ReplyNotSwappd,
     ReplyNotSwappd,
     (ReplySwapPtr) SListInstalledColormapsReply,
@@ -639,44 +804,44 @@ ReplySwapPtr ReplySwapVector[256] = {
     (ReplySwapPtr) SAllocColorPlanesReply,
     ReplyNotSwappd,
     ReplyNotSwappd,
-    ReplyNotSwappd,             /* 90 */
+    ReplyNotSwappd,                             /* 90 */
     (ReplySwapPtr) SQueryColorsReply,
     (ReplySwapPtr) SLookupColorReply,
     ReplyNotSwappd,
     ReplyNotSwappd,
-    ReplyNotSwappd,             /* 95 */
+    ReplyNotSwappd,                             /* 95 */
     ReplyNotSwappd,
     (ReplySwapPtr) SQueryBestSizeReply,
-    (ReplySwapPtr) SGenericReply,       /* SQueryExtensionReply, */
+    (ReplySwapPtr) SGenericReply,               /* SQueryExtensionReply, */
     (ReplySwapPtr) SListExtensionsReply,
-    ReplyNotSwappd,             /* 100 */
+    ReplyNotSwappd,                             /* 100 */
     (ReplySwapPtr) SGetKeyboardMappingReply,
     ReplyNotSwappd,
     (ReplySwapPtr) SGetKeyboardControlReply,
     ReplyNotSwappd,
-    ReplyNotSwappd,             /* 105 */
+    ReplyNotSwappd,                             /* 105 */
     (ReplySwapPtr) SGetPointerControlReply,
     ReplyNotSwappd,
     (ReplySwapPtr) SGetScreenSaverReply,
     ReplyNotSwappd,
-    (ReplySwapPtr) SListHostsReply,     /* 110 */
+    (ReplySwapPtr) SListHostsReply,             /* 110 */
     ReplyNotSwappd,
     ReplyNotSwappd,
     ReplyNotSwappd,
     ReplyNotSwappd,
-    ReplyNotSwappd,             /* 115 */
-    (ReplySwapPtr) SGenericReply,       /* SetPointerMapping */
+    ReplyNotSwappd,                             /* 115 */
+    (ReplySwapPtr) SGenericReply,               /* SetPointerMapping */
     (ReplySwapPtr) SGetPointerMappingReply,
-    (ReplySwapPtr) SGenericReply,       /* SetModifierMapping */
+    (ReplySwapPtr) SGenericReply,               /* SetModifierMapping */
     (ReplySwapPtr) SGetModifierMappingReply,    /* 119 */
-    ReplyNotSwappd,             /* 120 */
-    ReplyNotSwappd,             /* 121 */
-    ReplyNotSwappd,             /* 122 */
-    ReplyNotSwappd,             /* 123 */
-    ReplyNotSwappd,             /* 124 */
-    ReplyNotSwappd,             /* 125 */
-    ReplyNotSwappd,             /* 126 */
-    ReplyNotSwappd,             /* NoOperation */
+    ReplyNotSwappd,                             /* 120 */
+    ReplyNotSwappd,                             /* 121 */
+    ReplyNotSwappd,                             /* 122 */
+    ReplyNotSwappd,                             /* 123 */
+    ReplyNotSwappd,                             /* 124 */
+    ReplyNotSwappd,                             /* 125 */
+    ReplyNotSwappd,                             /* 126 */
+    ReplyNotSwappd,                             /* NoOperation */
     ReplyNotSwappd,
     ReplyNotSwappd,
     ReplyNotSwappd,
commit b6be94d89cab650ed73c5f3ca65f3a08bb79ebae
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 16 20:53:00 2012 -0700

    Fix up formatting of initializers for arrays of structs
    
    The indenter seems to have gotten confused by initializing arrays of
    structs with the struct defined inline - for predefined structs it did
    a better job, so match that.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    (cherry picked from commit 9f7ef7f7f0566f6319d8328ce0a1e6d0fa866720)

diff --git a/Xi/extinit.c b/Xi/extinit.c
index 2637f08..d6320b8 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -162,25 +162,25 @@ static struct dev_type {
     Atom type;
     const char *name;
 } dev_type[] = {
-    {
-    0, XI_KEYBOARD}, {
-    0, XI_MOUSE}, {
-    0, XI_TABLET}, {
-    0, XI_TOUCHSCREEN}, {
-    0, XI_TOUCHPAD}, {
-    0, XI_BARCODE}, {
-    0, XI_BUTTONBOX}, {
-    0, XI_KNOB_BOX}, {
-    0, XI_ONE_KNOB}, {
-    0, XI_NINE_KNOB}, {
-    0, XI_TRACKBALL}, {
-    0, XI_QUADRATURE}, {
-    0, XI_ID_MODULE}, {
-    0, XI_SPACEBALL}, {
-    0, XI_DATAGLOVE}, {
-    0, XI_EYETRACKER}, {
-    0, XI_CURSORKEYS}, {
-0, XI_FOOTMOUSE}};
+    {0, XI_KEYBOARD},
+    {0, XI_MOUSE},
+    {0, XI_TABLET},
+    {0, XI_TOUCHSCREEN},
+    {0, XI_TOUCHPAD},
+    {0, XI_BARCODE},
+    {0, XI_BUTTONBOX},
+    {0, XI_KNOB_BOX},
+    {0, XI_ONE_KNOB},
+    {0, XI_NINE_KNOB},
+    {0, XI_TRACKBALL},
+    {0, XI_QUADRATURE},
+    {0, XI_ID_MODULE},
+    {0, XI_SPACEBALL},
+    {0, XI_DATAGLOVE},
+    {0, XI_EYETRACKER},
+    {0, XI_CURSORKEYS},
+    {0, XI_FOOTMOUSE}
+};
 
 CARD8 event_base[numInputClasses];
 XExtEventInfo EventInfo[32];
diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
index e17efe4..e51aadb 100644
--- a/Xi/xiproperty.c
+++ b/Xi/xiproperty.c
@@ -49,132 +49,131 @@ static struct dev_properties {
     Atom type;
     const char *name;
 } dev_properties[] = {
-    {
-    0, XI_PROP_ENABLED}, {
-    0, XI_PROP_XTEST_DEVICE}, {
-    0, XATOM_FLOAT}, {
-    0, ACCEL_PROP_PROFILE_NUMBER}, {
-    0, ACCEL_PROP_CONSTANT_DECELERATION}, {
-    0, ACCEL_PROP_ADAPTIVE_DECELERATION}, {
-    0, ACCEL_PROP_VELOCITY_SCALING}, {
-    0, AXIS_LABEL_PROP}, {
-    0, AXIS_LABEL_PROP_REL_X}, {
-    0, AXIS_LABEL_PROP_REL_Y}, {
-    0, AXIS_LABEL_PROP_REL_Z}, {
-    0, AXIS_LABEL_PROP_REL_RX}, {
-    0, AXIS_LABEL_PROP_REL_RY}, {
-    0, AXIS_LABEL_PROP_REL_RZ}, {
-    0, AXIS_LABEL_PROP_REL_HWHEEL}, {
-    0, AXIS_LABEL_PROP_REL_DIAL}, {
-    0, AXIS_LABEL_PROP_REL_WHEEL}, {
-    0, AXIS_LABEL_PROP_REL_MISC}, {
-    0, AXIS_LABEL_PROP_REL_VSCROLL}, {
-    0, AXIS_LABEL_PROP_REL_HSCROLL}, {
-    0, AXIS_LABEL_PROP_ABS_X}, {
-    0, AXIS_LABEL_PROP_ABS_Y}, {
-    0, AXIS_LABEL_PROP_ABS_Z}, {
-    0, AXIS_LABEL_PROP_ABS_RX}, {
-    0, AXIS_LABEL_PROP_ABS_RY}, {
-    0, AXIS_LABEL_PROP_ABS_RZ}, {
-    0, AXIS_LABEL_PROP_ABS_THROTTLE}, {
-    0, AXIS_LABEL_PROP_ABS_RUDDER}, {
-    0, AXIS_LABEL_PROP_ABS_WHEEL}, {
-    0, AXIS_LABEL_PROP_ABS_GAS}, {
-    0, AXIS_LABEL_PROP_ABS_BRAKE}, {
-    0, AXIS_LABEL_PROP_ABS_HAT0X}, {
-    0, AXIS_LABEL_PROP_ABS_HAT0Y}, {
-    0, AXIS_LABEL_PROP_ABS_HAT1X}, {
-    0, AXIS_LABEL_PROP_ABS_HAT1Y}, {
-    0, AXIS_LABEL_PROP_ABS_HAT2X}, {
-    0, AXIS_LABEL_PROP_ABS_HAT2Y}, {
-    0, AXIS_LABEL_PROP_ABS_HAT3X}, {
-    0, AXIS_LABEL_PROP_ABS_HAT3Y}, {
-    0, AXIS_LABEL_PROP_ABS_PRESSURE}, {
-    0, AXIS_LABEL_PROP_ABS_DISTANCE}, {
-    0, AXIS_LABEL_PROP_ABS_TILT_X}, {
-    0, AXIS_LABEL_PROP_ABS_TILT_Y}, {
-    0, AXIS_LABEL_PROP_ABS_TOOL_WIDTH}, {
-    0, AXIS_LABEL_PROP_ABS_VOLUME}, {
-    0, AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR}, {
-    0, AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR}, {
-    0, AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR}, {
-    0, AXIS_LABEL_PROP_ABS_MT_WIDTH_MINOR}, {
-    0, AXIS_LABEL_PROP_ABS_MT_ORIENTATION}, {
-    0, AXIS_LABEL_PROP_ABS_MT_POSITION_X}, {
-    0, AXIS_LABEL_PROP_ABS_MT_POSITION_Y}, {
-    0, AXIS_LABEL_PROP_ABS_MT_TOOL_TYPE}, {
-    0, AXIS_LABEL_PROP_ABS_MT_BLOB_ID}, {
-    0, AXIS_LABEL_PROP_ABS_MT_TRACKING_ID}, {
-    0, AXIS_LABEL_PROP_ABS_MT_PRESSURE}, {
-    0, AXIS_LABEL_PROP_ABS_MISC}, {
-    0, BTN_LABEL_PROP}, {
-    0, BTN_LABEL_PROP_BTN_UNKNOWN}, {
-    0, BTN_LABEL_PROP_BTN_WHEEL_UP}, {
-    0, BTN_LABEL_PROP_BTN_WHEEL_DOWN}, {
-    0, BTN_LABEL_PROP_BTN_HWHEEL_LEFT}, {
-    0, BTN_LABEL_PROP_BTN_HWHEEL_RIGHT}, {
-    0, BTN_LABEL_PROP_BTN_0}, {
-    0, BTN_LABEL_PROP_BTN_1}, {
-    0, BTN_LABEL_PROP_BTN_2}, {
-    0, BTN_LABEL_PROP_BTN_3}, {
-    0, BTN_LABEL_PROP_BTN_4}, {
-    0, BTN_LABEL_PROP_BTN_5}, {
-    0, BTN_LABEL_PROP_BTN_6}, {
-    0, BTN_LABEL_PROP_BTN_7}, {
-    0, BTN_LABEL_PROP_BTN_8}, {
-    0, BTN_LABEL_PROP_BTN_9}, {
-    0, BTN_LABEL_PROP_BTN_LEFT}, {
-    0, BTN_LABEL_PROP_BTN_RIGHT}, {
-    0, BTN_LABEL_PROP_BTN_MIDDLE}, {
-    0, BTN_LABEL_PROP_BTN_SIDE}, {
-    0, BTN_LABEL_PROP_BTN_EXTRA}, {
-    0, BTN_LABEL_PROP_BTN_FORWARD}, {
-    0, BTN_LABEL_PROP_BTN_BACK}, {
-    0, BTN_LABEL_PROP_BTN_TASK}, {
-    0, BTN_LABEL_PROP_BTN_TRIGGER}, {
-    0, BTN_LABEL_PROP_BTN_THUMB}, {
-    0, BTN_LABEL_PROP_BTN_THUMB2}, {
-    0, BTN_LABEL_PROP_BTN_TOP}, {
-    0, BTN_LABEL_PROP_BTN_TOP2}, {
-    0, BTN_LABEL_PROP_BTN_PINKIE}, {
-    0, BTN_LABEL_PROP_BTN_BASE}, {
-    0, BTN_LABEL_PROP_BTN_BASE2}, {
-    0, BTN_LABEL_PROP_BTN_BASE3}, {
-    0, BTN_LABEL_PROP_BTN_BASE4}, {
-    0, BTN_LABEL_PROP_BTN_BASE5}, {
-    0, BTN_LABEL_PROP_BTN_BASE6}, {
-    0, BTN_LABEL_PROP_BTN_DEAD}, {
-    0, BTN_LABEL_PROP_BTN_A}, {
-    0, BTN_LABEL_PROP_BTN_B}, {
-    0, BTN_LABEL_PROP_BTN_C}, {
-    0, BTN_LABEL_PROP_BTN_X}, {
-    0, BTN_LABEL_PROP_BTN_Y}, {
-    0, BTN_LABEL_PROP_BTN_Z}, {
-    0, BTN_LABEL_PROP_BTN_TL}, {
-    0, BTN_LABEL_PROP_BTN_TR}, {
-    0, BTN_LABEL_PROP_BTN_TL2}, {
-    0, BTN_LABEL_PROP_BTN_TR2}, {
-    0, BTN_LABEL_PROP_BTN_SELECT}, {
-    0, BTN_LABEL_PROP_BTN_START}, {
-    0, BTN_LABEL_PROP_BTN_MODE}, {
-    0, BTN_LABEL_PROP_BTN_THUMBL}, {
-    0, BTN_LABEL_PROP_BTN_THUMBR}, {
-    0, BTN_LABEL_PROP_BTN_TOOL_PEN}, {
-    0, BTN_LABEL_PROP_BTN_TOOL_RUBBER}, {
-    0, BTN_LABEL_PROP_BTN_TOOL_BRUSH}, {
-    0, BTN_LABEL_PROP_BTN_TOOL_PENCIL}, {
-    0, BTN_LABEL_PROP_BTN_TOOL_AIRBRUSH}, {
-    0, BTN_LABEL_PROP_BTN_TOOL_FINGER}, {
-    0, BTN_LABEL_PROP_BTN_TOOL_MOUSE}, {
-    0, BTN_LABEL_PROP_BTN_TOOL_LENS}, {
-    0, BTN_LABEL_PROP_BTN_TOUCH}, {
-    0, BTN_LABEL_PROP_BTN_STYLUS}, {
-    0, BTN_LABEL_PROP_BTN_STYLUS2}, {
-    0, BTN_LABEL_PROP_BTN_TOOL_DOUBLETAP}, {
-    0, BTN_LABEL_PROP_BTN_TOOL_TRIPLETAP}, {
-    0, BTN_LABEL_PROP_BTN_GEAR_DOWN}, {
-    0, BTN_LABEL_PROP_BTN_GEAR_UP}, {
-    0, XI_PROP_TRANSFORM}
+    {0, XI_PROP_ENABLED},
+    {0, XI_PROP_XTEST_DEVICE},
+    {0, XATOM_FLOAT},
+    {0, ACCEL_PROP_PROFILE_NUMBER},
+    {0, ACCEL_PROP_CONSTANT_DECELERATION},
+    {0, ACCEL_PROP_ADAPTIVE_DECELERATION},
+    {0, ACCEL_PROP_VELOCITY_SCALING},
+    {0, AXIS_LABEL_PROP},
+    {0, AXIS_LABEL_PROP_REL_X},
+    {0, AXIS_LABEL_PROP_REL_Y},
+    {0, AXIS_LABEL_PROP_REL_Z},
+    {0, AXIS_LABEL_PROP_REL_RX},
+    {0, AXIS_LABEL_PROP_REL_RY},
+    {0, AXIS_LABEL_PROP_REL_RZ},
+    {0, AXIS_LABEL_PROP_REL_HWHEEL},
+    {0, AXIS_LABEL_PROP_REL_DIAL},
+    {0, AXIS_LABEL_PROP_REL_WHEEL},
+    {0, AXIS_LABEL_PROP_REL_MISC},
+    {0, AXIS_LABEL_PROP_REL_VSCROLL},
+    {0, AXIS_LABEL_PROP_REL_HSCROLL},
+    {0, AXIS_LABEL_PROP_ABS_X},
+    {0, AXIS_LABEL_PROP_ABS_Y},
+    {0, AXIS_LABEL_PROP_ABS_Z},
+    {0, AXIS_LABEL_PROP_ABS_RX},
+    {0, AXIS_LABEL_PROP_ABS_RY},
+    {0, AXIS_LABEL_PROP_ABS_RZ},
+    {0, AXIS_LABEL_PROP_ABS_THROTTLE},
+    {0, AXIS_LABEL_PROP_ABS_RUDDER},
+    {0, AXIS_LABEL_PROP_ABS_WHEEL},
+    {0, AXIS_LABEL_PROP_ABS_GAS},
+    {0, AXIS_LABEL_PROP_ABS_BRAKE},
+    {0, AXIS_LABEL_PROP_ABS_HAT0X},
+    {0, AXIS_LABEL_PROP_ABS_HAT0Y},
+    {0, AXIS_LABEL_PROP_ABS_HAT1X},
+    {0, AXIS_LABEL_PROP_ABS_HAT1Y},
+    {0, AXIS_LABEL_PROP_ABS_HAT2X},
+    {0, AXIS_LABEL_PROP_ABS_HAT2Y},
+    {0, AXIS_LABEL_PROP_ABS_HAT3X},
+    {0, AXIS_LABEL_PROP_ABS_HAT3Y},
+    {0, AXIS_LABEL_PROP_ABS_PRESSURE},
+    {0, AXIS_LABEL_PROP_ABS_DISTANCE},
+    {0, AXIS_LABEL_PROP_ABS_TILT_X},
+    {0, AXIS_LABEL_PROP_ABS_TILT_Y},
+    {0, AXIS_LABEL_PROP_ABS_TOOL_WIDTH},
+    {0, AXIS_LABEL_PROP_ABS_VOLUME},
+    {0, AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR},
+    {0, AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR},
+    {0, AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR},
+    {0, AXIS_LABEL_PROP_ABS_MT_WIDTH_MINOR},
+    {0, AXIS_LABEL_PROP_ABS_MT_ORIENTATION},
+    {0, AXIS_LABEL_PROP_ABS_MT_POSITION_X},
+    {0, AXIS_LABEL_PROP_ABS_MT_POSITION_Y},
+    {0, AXIS_LABEL_PROP_ABS_MT_TOOL_TYPE},
+    {0, AXIS_LABEL_PROP_ABS_MT_BLOB_ID},
+    {0, AXIS_LABEL_PROP_ABS_MT_TRACKING_ID},
+    {0, AXIS_LABEL_PROP_ABS_MT_PRESSURE},
+    {0, AXIS_LABEL_PROP_ABS_MISC},
+    {0, BTN_LABEL_PROP},
+    {0, BTN_LABEL_PROP_BTN_UNKNOWN},
+    {0, BTN_LABEL_PROP_BTN_WHEEL_UP},
+    {0, BTN_LABEL_PROP_BTN_WHEEL_DOWN},
+    {0, BTN_LABEL_PROP_BTN_HWHEEL_LEFT},
+    {0, BTN_LABEL_PROP_BTN_HWHEEL_RIGHT},
+    {0, BTN_LABEL_PROP_BTN_0},
+    {0, BTN_LABEL_PROP_BTN_1},
+    {0, BTN_LABEL_PROP_BTN_2},
+    {0, BTN_LABEL_PROP_BTN_3},
+    {0, BTN_LABEL_PROP_BTN_4},
+    {0, BTN_LABEL_PROP_BTN_5},
+    {0, BTN_LABEL_PROP_BTN_6},
+    {0, BTN_LABEL_PROP_BTN_7},
+    {0, BTN_LABEL_PROP_BTN_8},
+    {0, BTN_LABEL_PROP_BTN_9},
+    {0, BTN_LABEL_PROP_BTN_LEFT},
+    {0, BTN_LABEL_PROP_BTN_RIGHT},
+    {0, BTN_LABEL_PROP_BTN_MIDDLE},
+    {0, BTN_LABEL_PROP_BTN_SIDE},
+    {0, BTN_LABEL_PROP_BTN_EXTRA},
+    {0, BTN_LABEL_PROP_BTN_FORWARD},
+    {0, BTN_LABEL_PROP_BTN_BACK},
+    {0, BTN_LABEL_PROP_BTN_TASK},
+    {0, BTN_LABEL_PROP_BTN_TRIGGER},
+    {0, BTN_LABEL_PROP_BTN_THUMB},
+    {0, BTN_LABEL_PROP_BTN_THUMB2},
+    {0, BTN_LABEL_PROP_BTN_TOP},
+    {0, BTN_LABEL_PROP_BTN_TOP2},
+    {0, BTN_LABEL_PROP_BTN_PINKIE},
+    {0, BTN_LABEL_PROP_BTN_BASE},
+    {0, BTN_LABEL_PROP_BTN_BASE2},
+    {0, BTN_LABEL_PROP_BTN_BASE3},
+    {0, BTN_LABEL_PROP_BTN_BASE4},
+    {0, BTN_LABEL_PROP_BTN_BASE5},
+    {0, BTN_LABEL_PROP_BTN_BASE6},
+    {0, BTN_LABEL_PROP_BTN_DEAD},
+    {0, BTN_LABEL_PROP_BTN_A},
+    {0, BTN_LABEL_PROP_BTN_B},
+    {0, BTN_LABEL_PROP_BTN_C},
+    {0, BTN_LABEL_PROP_BTN_X},
+    {0, BTN_LABEL_PROP_BTN_Y},
+    {0, BTN_LABEL_PROP_BTN_Z},
+    {0, BTN_LABEL_PROP_BTN_TL},
+    {0, BTN_LABEL_PROP_BTN_TR},
+    {0, BTN_LABEL_PROP_BTN_TL2},
+    {0, BTN_LABEL_PROP_BTN_TR2},
+    {0, BTN_LABEL_PROP_BTN_SELECT},
+    {0, BTN_LABEL_PROP_BTN_START},
+    {0, BTN_LABEL_PROP_BTN_MODE},
+    {0, BTN_LABEL_PROP_BTN_THUMBL},
+    {0, BTN_LABEL_PROP_BTN_THUMBR},
+    {0, BTN_LABEL_PROP_BTN_TOOL_PEN},
+    {0, BTN_LABEL_PROP_BTN_TOOL_RUBBER},
+    {0, BTN_LABEL_PROP_BTN_TOOL_BRUSH},
+    {0, BTN_LABEL_PROP_BTN_TOOL_PENCIL},
+    {0, BTN_LABEL_PROP_BTN_TOOL_AIRBRUSH},
+    {0, BTN_LABEL_PROP_BTN_TOOL_FINGER},
+    {0, BTN_LABEL_PROP_BTN_TOOL_MOUSE},
+    {0, BTN_LABEL_PROP_BTN_TOOL_LENS},
+    {0, BTN_LABEL_PROP_BTN_TOUCH},
+    {0, BTN_LABEL_PROP_BTN_STYLUS},
+    {0, BTN_LABEL_PROP_BTN_STYLUS2},
+    {0, BTN_LABEL_PROP_BTN_TOOL_DOUBLETAP},
+    {0, BTN_LABEL_PROP_BTN_TOOL_TRIPLETAP},
+    {0, BTN_LABEL_PROP_BTN_GEAR_DOWN},
+    {0, BTN_LABEL_PROP_BTN_GEAR_UP},
+    {0, XI_PROP_TRANSFORM}
 };
 
 static long XIPropHandlerID = 1;
diff --git a/config/wscons.c b/config/wscons.c
index 7a5e8cc..fb114bd 100644
--- a/config/wscons.c
+++ b/config/wscons.c
@@ -53,8 +53,10 @@ struct nameint {
     int val;
     char *name;
 } kbdenc[] = {
-    KB_OVRENC, KB_ENCTAB, {
-0}};
+    KB_OVRENC,
+    KB_ENCTAB,
+    {0}
+};
 
 struct nameint kbdvar[] = {
     {KB_NODEAD | KB_SG, "de_nodeadkeys"},
diff --git a/dix/gc.c b/dix/gc.c
index 7be0502..42fca8a 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -419,11 +419,11 @@ static const struct {
     RESTYPE type;
     Mask access_mode;
 } xidfields[] = {
-    {
-    GCTile, RT_PIXMAP, DixReadAccess}, {
-    GCStipple, RT_PIXMAP, DixReadAccess}, {
-    GCFont, RT_FONT, DixUseAccess}, {
-GCClipMask, RT_PIXMAP, DixReadAccess},};
+    {GCTile, RT_PIXMAP, DixReadAccess},
+    {GCStipple, RT_PIXMAP, DixReadAccess},
+    {GCFont, RT_FONT, DixUseAccess},
+    {GCClipMask, RT_PIXMAP, DixReadAccess},
+};
 
 int
 ChangeGCXIDs(ClientPtr client, GC * pGC, BITS32 mask, CARD32 *pC32)
diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index abc668e..33bf408 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -419,23 +419,22 @@ ephyrRandRGetInfo(ScreenPtr pScreen, Rotation * rotations)
     struct {
         int width, height;
     } sizes[] = {
-        {
-        1600, 1200}, {
-        1400, 1050}, {
-        1280, 960}, {
-        1280, 1024}, {
-        1152, 864}, {
-        1024, 768}, {
-        832, 624}, {
-        800, 600}, {
-        720, 400}, {
-        480, 640}, {
-        640, 480}, {
-        640, 400}, {
-        320, 240}, {
-        240, 320}, {
-        160, 160}, {
-        0, 0}
+        {1600, 1200},
+        {1400, 1050},
+        {1280, 960},
+        {1280, 1024},
+        {1152, 864},
+        {1024, 768},
+        {832, 624},
+        {800, 600},
+        {720, 400},
+        {480, 640},
+        {640, 480},
+        {640, 400},
+        {320, 240},
+        {240, 320},
+        {160, 160},
+        {0, 0}
     };
 
     EPHYR_LOG("mark");
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index f65ab96..716f18e 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -730,22 +730,22 @@ KdSetSubpixelOrder(ScreenPtr pScreen, Rotation randr)
         int subpixel_order;
         Rotation direction;
     } orders[] = {
-        {
-        SubPixelHorizontalRGB, RR_Rotate_0}, {
-        SubPixelHorizontalBGR, RR_Rotate_180}, {
-        SubPixelVerticalRGB, RR_Rotate_270}, {
-    SubPixelVerticalBGR, RR_Rotate_90},};
+        {SubPixelHorizontalRGB, RR_Rotate_0},
+        {SubPixelHorizontalBGR, RR_Rotate_180},
+        {SubPixelVerticalRGB, RR_Rotate_270},
+        {SubPixelVerticalBGR, RR_Rotate_90},
+    };
 
     static struct {
         int bit;
         int normal;
         int reflect;
     } reflects[] = {
-        {
-        RR_Reflect_X, SubPixelHorizontalRGB, SubPixelHorizontalBGR}, {
-        RR_Reflect_X, SubPixelHorizontalBGR, SubPixelHorizontalRGB}, {
-        RR_Reflect_Y, SubPixelVerticalRGB, SubPixelVerticalBGR}, {
-    RR_Reflect_Y, SubPixelVerticalRGB, SubPixelVerticalRGB},};
+        {RR_Reflect_X, SubPixelHorizontalRGB, SubPixelHorizontalBGR},
+        {RR_Reflect_X, SubPixelHorizontalBGR, SubPixelHorizontalRGB},
+        {RR_Reflect_Y, SubPixelVerticalRGB, SubPixelVerticalBGR},
+        {RR_Reflect_Y, SubPixelVerticalRGB, SubPixelVerticalRGB},
+    };
 
     /* map subpixel to direction */
     for (i = 0; i < 4; i++)
diff --git a/hw/xfree86/loader/loader.c b/hw/xfree86/loader/loader.c
index 4836964..dc289c5 100644
--- a/hw/xfree86/loader/loader.c
+++ b/hw/xfree86/loader/loader.c
@@ -195,13 +195,12 @@ LoaderGetABIVersion(const char *abiclass)
         const char *name;
         int version;
     } classes[] = {
-        {
-        ABI_CLASS_ANSIC, LoaderVersionInfo.ansicVersion}, {
-        ABI_CLASS_VIDEODRV, LoaderVersionInfo.videodrvVersion}, {
-        ABI_CLASS_XINPUT, LoaderVersionInfo.xinputVersion}, {
-        ABI_CLASS_EXTENSION, LoaderVersionInfo.extensionVersion}, {
-        ABI_CLASS_FONT, LoaderVersionInfo.fontVersion}, {
-        NULL, 0}
+        {ABI_CLASS_ANSIC, LoaderVersionInfo.ansicVersion},
+        {ABI_CLASS_VIDEODRV, LoaderVersionInfo.videodrvVersion},
+        {ABI_CLASS_XINPUT, LoaderVersionInfo.xinputVersion},
+        {ABI_CLASS_EXTENSION, LoaderVersionInfo.extensionVersion},
+        {ABI_CLASS_FONT, LoaderVersionInfo.fontVersion},
+        {NULL, 0}
     };
     int i;
 
diff --git a/hw/xfree86/modes/xf86DisplayIDModes.c b/hw/xfree86/modes/xf86DisplayIDModes.c
index 781c806..bead126 100644
--- a/hw/xfree86/modes/xf86DisplayIDModes.c
+++ b/hw/xfree86/modes/xf86DisplayIDModes.c
@@ -184,105 +184,96 @@ static const struct did_dmt {
     short w, h, r, f;
 } did_dmt[] = {
     /* byte 3 */
-    {
-    640, 350, 85, 0}, {
-    640, 400, 85, 0}, {
-    720, 400, 85, 0}, {
-    640, 480, 60, 0}, {
-    640, 480, 72, 0}, {
-    640, 480, 75, 0}, {
-    640, 480, 85, 0}, {
-    800, 600, 56, 0},
+    {640, 350, 85, 0},
+    {640, 400, 85, 0},
+    {720, 400, 85, 0},
+    {640, 480, 60, 0},
+    {640, 480, 72, 0},
+    {640, 480, 75, 0},
+    {640, 480, 85, 0},
+    {800, 600, 56, 0},
         /* byte 4 */
-    {
-    800, 600, 60, 0}, {
-    800, 600, 72, 0}, {
-    800, 600, 75, 0}, {
-    800, 600, 85, 0}, {
-    800, 600, 120, RB}, {
-    848, 480, 60, 0}, {
-    1024, 768, 43, INT}, {
-    1024, 768, 60, 0},
+    {800, 600, 60, 0},
+    {800, 600, 72, 0},
+    {800, 600, 75, 0},
+    {800, 600, 85, 0},
+    {800, 600, 120, RB},
+    {848, 480, 60, 0},
+    {1024, 768, 43, INT},
+    {1024, 768, 60, 0},
         /* byte 5 */
-    {
-    1024, 768, 70, 0}, {
-    1024, 768, 75, 0}, {
-    1024, 768, 85, 0}, {
-    1024, 768, 120, RB}, {
-    1152, 864, 75, 0}, {
-    1280, 768, 60, RB}, {
-    1280, 768, 60, 0}, {
-    1280, 768, 75, 0},
+    {1024, 768, 70, 0},
+    {1024, 768, 75, 0},
+    {1024, 768, 85, 0},
+    {1024, 768, 120, RB},
+    {1152, 864, 75, 0},
+    {1280, 768, 60, RB},
+    {1280, 768, 60, 0},
+    {1280, 768, 75, 0},
         /* byte 6 */
-    {
-    1280, 768, 85, 0}, {
-    1280, 768, 120, RB}, {
-    1280, 800, 60, RB}, {
-    1280, 800, 60, 0}, {
-    1280, 800, 75, 0}, {
-    1280, 800, 85, 0}, {
-    1280, 800, 120, RB}, {
-    1280, 960, 60, 0},
+    {1280, 768, 85, 0},
+    {1280, 768, 120, RB},
+    {1280, 800, 60, RB},
+    {1280, 800, 60, 0},
+    {1280, 800, 75, 0},
+    {1280, 800, 85, 0},
+    {1280, 800, 120, RB},
+    {1280, 960, 60, 0},
         /* byte 7 */
-    {
-    1280, 960, 85, 0}, {
-    1280, 960, 120, RB}, {
-    1280, 1024, 60, 0}, {
-    1280, 1024, 75, 0}, {
-    1280, 1024, 85, 0}, {
-    1280, 1024, 120, RB}, {
-    1360, 768, 60, 0}, {
-    1360, 768, 120, RB},
+    {1280, 960, 85, 0},
+    {1280, 960, 120, RB},
+    {1280, 1024, 60, 0},
+    {1280, 1024, 75, 0},
+    {1280, 1024, 85, 0},
+    {1280, 1024, 120, RB},
+    {1360, 768, 60, 0},
+    {1360, 768, 120, RB},
         /* byte 8 */
-    {
-    1400, 1050, 60, RB}, {
-    1400, 1050, 60, 0}, {
-    1400, 1050, 75, 0}, {
-    1400, 1050, 85, 0}, {
-    1400, 1050, 120, RB}, {
-    1440, 900, 60, RB}, {
-    1440, 900, 60, 0}, {
-    1440, 900, 75, 0},
+    {1400, 1050, 60, RB},
+    {1400, 1050, 60, 0},
+    {1400, 1050, 75, 0},
+    {1400, 1050, 85, 0},
+    {1400, 1050, 120, RB},
+    {1440, 900, 60, RB},
+    {1440, 900, 60, 0},
+    {1440, 900, 75, 0},
         /* byte 9 */
-    {
-    1440, 900, 85, 0}, {
-    1440, 900, 120, RB}, {
-    1600, 1200, 60, 0}, {
-    1600, 1200, 65, 0}, {
-    1600, 1200, 70, 0}, {
-    1600, 1200, 75, 0}, {
-    1600, 1200, 85, 0}, {
-    1600, 1200, 120, RB},
+    {1440, 900, 85, 0},
+    {1440, 900, 120, RB},
+    {1600, 1200, 60, 0},
+    {1600, 1200, 65, 0},
+    {1600, 1200, 70, 0},
+    {1600, 1200, 75, 0},
+    {1600, 1200, 85, 0},
+    {1600, 1200, 120, RB},
         /* byte a */
-    {
-    1680, 1050, 60, RB}, {
-    1680, 1050, 60, 0}, {
-    1680, 1050, 75, 0}, {
-    1680, 1050, 85, 0}, {
-    1680, 1050, 120, RB}, {
-    1792, 1344, 60, 0}, {
-    1792, 1344, 75, 0}, {
-    1792, 1344, 120, RB},
+    {1680, 1050, 60, RB},
+    {1680, 1050, 60, 0},
+    {1680, 1050, 75, 0},
+    {1680, 1050, 85, 0},
+    {1680, 1050, 120, RB},
+    {1792, 1344, 60, 0},
+    {1792, 1344, 75, 0},
+    {1792, 1344, 120, RB},
         /* byte b */
-    {
-    1856, 1392, 60, 0}, {
-    1856, 1392, 75, 0}, {
-    1856, 1392, 120, RB}, {
-    1920, 1200, 60, RB}, {
-    1920, 1200, 60, 0}, {
-    1920, 1200, 75, 0}, {
-    1920, 1200, 85, 0}, {
-    1920, 1200, 120, RB},
+    {1856, 1392, 60, 0},
+    {1856, 1392, 75, 0},
+    {1856, 1392, 120, RB},
+    {1920, 1200, 60, RB},
+    {1920, 1200, 60, 0},
+    {1920, 1200, 75, 0},
+    {1920, 1200, 85, 0},
+    {1920, 1200, 120, RB},
         /* byte c */
-    {
-    1920, 1440, 60, 0}, {
-    1920, 1440, 75, 0}, {
-    1920, 1440, 120, RB}, {
-    2560, 1600, 60, RB}, {
-    2560, 1600, 60, 0}, {
-    2560, 1600, 75, 0}, {
-    2560, 1600, 85, 0}, {
-2560, 1600, 120, RB},};
+    {1920, 1440, 60, 0},
+    {1920, 1440, 75, 0},
+    {1920, 1440, 120, RB},
+    {2560, 1600, 60, RB},
+    {2560, 1600, 60, 0},
+    {2560, 1600, 75, 0},
+    {2560, 1600, 85, 0},
+    {2560, 1600, 120, RB},
+};
 
 static void
 didVesaTiming(int scrn, unsigned char *x, MonPtr mon)
diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
index 258ada5..4ee862d 100644
--- a/hw/xfree86/modes/xf86EdidModes.c
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -513,14 +513,14 @@ DDCModeDoInterlaceQuirks(DisplayModePtr mode)
     static const struct {
         int w, h;
     } cea_interlaced[] = {
-        {
-        1920, 1080}, {
-        720, 480}, {
-        1440, 480}, {
-        2880, 480}, {
-        720, 576}, {
-        1440, 576}, {
-    2880, 576},};
+        {1920, 1080},
+        {720, 480},
+        {1440, 480},
+        {2880, 480},
+        {720, 576},
+        {1440, 576},
+        {2880, 576},
+    };
     static const int n_modes =
         sizeof(cea_interlaced) / sizeof(cea_interlaced[0]);
     int i;
@@ -668,68 +668,62 @@ static const struct {
     short r;
     short rb;
 } EstIIIModes[] = {
-    /* byte 6 */
-    {
-    640, 350, 85, 0}, {
-    640, 400, 85, 0}, {
-    720, 400, 85, 0}, {
-    640, 480, 85, 0}, {
-    848, 480, 60, 0}, {
-    800, 600, 85, 0}, {
-    1024, 768, 85, 0}, {
-    1152, 864, 75, 0},
+        /* byte 6 */
+    {640, 350, 85, 0},
+    {640, 400, 85, 0},
+    {720, 400, 85, 0},
+    {640, 480, 85, 0},
+    {848, 480, 60, 0},
+    {800, 600, 85, 0},
+    {1024, 768, 85, 0},
+    {1152, 864, 75, 0},
         /* byte 7 */
-    {
-    1280, 768, 60, 1}, {
-    1280, 768, 60, 0}, {
-    1280, 768, 75, 0}, {
-    1280, 768, 85, 0}, {
-    1280, 960, 60, 0}, {
-    1280, 960, 85, 0}, {
-    1280, 1024, 60, 0}, {
-    1280, 1024, 85, 0},
+    {1280, 768, 60, 1},
+    {1280, 768, 60, 0},
+    {1280, 768, 75, 0},
+    {1280, 768, 85, 0},
+    {1280, 960, 60, 0},
+    {1280, 960, 85, 0},
+    {1280, 1024, 60, 0},
+    {1280, 1024, 85, 0},
         /* byte 8 */
-    {
-    1360, 768, 60, 0}, {
-    1440, 900, 60, 1}, {
-    1440, 900, 60, 0}, {
-    1440, 900, 75, 0}, {
-    1440, 900, 85, 0}, {
-    1400, 1050, 60, 1}, {
-    1400, 1050, 60, 0}, {
-    1400, 1050, 75, 0},
+    {1360, 768, 60, 0},
+    {1440, 900, 60, 1},
+    {1440, 900, 60, 0},
+    {1440, 900, 75, 0},
+    {1440, 900, 85, 0},
+    {1400, 1050, 60, 1},
+    {1400, 1050, 60, 0},
+    {1400, 1050, 75, 0},
         /* byte 9 */
-    {
-    1400, 1050, 85, 0}, {
-    1680, 1050, 60, 1}, {
-    1680, 1050, 60, 0}, {
-    1680, 1050, 75, 0}, {
-    1680, 1050, 85, 0}, {
-    1600, 1200, 60, 0}, {
-    1600, 1200, 65, 0}, {
-    1600, 1200, 70, 0},
+    {1400, 1050, 85, 0},
+    {1680, 1050, 60, 1},
+    {1680, 1050, 60, 0},
+    {1680, 1050, 75, 0},
+    {1680, 1050, 85, 0},
+    {1600, 1200, 60, 0},
+    {1600, 1200, 65, 0},
+    {1600, 1200, 70, 0},
         /* byte 10 */
-    {
-    1600, 1200, 75, 0}, {
-    1600, 1200, 85, 0}, {
-    1792, 1344, 60, 0}, {
-    1792, 1344, 85, 0}, {
-    1856, 1392, 60, 0}, {
-    1856, 1392, 75, 0}, {
-    1920, 1200, 60, 1}, {
-    1920, 1200, 60, 0},
+    {1600, 1200, 75, 0},
+    {1600, 1200, 85, 0},
+    {1792, 1344, 60, 0},
+    {1792, 1344, 85, 0},
+    {1856, 1392, 60, 0},
+    {1856, 1392, 75, 0},
+    {1920, 1200, 60, 1},
+    {1920, 1200, 60, 0},
         /* byte 11 */
-    {
-    1920, 1200, 75, 0}, {
-    1920, 1200, 85, 0}, {
-    1920, 1440, 60, 0}, {
-    1920, 1440, 75, 0},
+    {1920, 1200, 75, 0},
+    {1920, 1200, 85, 0},
+    {1920, 1440, 60, 0},
+    {1920, 1440, 75, 0},
         /* fill up last byte */
-    {
-    0,0,0,0}, {
-    0,0,0,0}, {
-    0,0,0,0}, {
-    0,0,0,0}, };
+    {0,0,0,0},
+    {0,0,0,0},
+    {0,0,0,0},
+    {0,0,0,0},
+};
 
 static DisplayModePtr
 DDCModesFromEstIII(unsigned char *est)
diff --git a/hw/xfree86/os-support/bsd/bsd_apm.c b/hw/xfree86/os-support/bsd/bsd_apm.c
index a8a4164..b1938cf 100644
--- a/hw/xfree86/os-support/bsd/bsd_apm.c
+++ b/hw/xfree86/os-support/bsd/bsd_apm.c
@@ -21,21 +21,19 @@ static struct {
     u_int apmBsd;
     pmEvent xf86;
 } bsdToXF86Array[] = {
-    {
-    APM_STANDBY_REQ, XF86_APM_SYS_STANDBY}, {
-    APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND}, {
-    APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME}, {
-    APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME}, {
-    APM_BATTERY_LOW, XF86_APM_LOW_BATTERY}, {
-    APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE}, {
-    APM_UPDATE_TIME, XF86_APM_UPDATE_TIME}, {
-    APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND}, {
-    APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY}, {
-    APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND}, {
-    APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME},
+    {APM_STANDBY_REQ, XF86_APM_SYS_STANDBY},
+    {APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND},
+    {APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME},
+    {APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME},
+    {APM_BATTERY_LOW, XF86_APM_LOW_BATTERY},
+    {APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE},
+    {APM_UPDATE_TIME, XF86_APM_UPDATE_TIME},
+    {APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND},
+    {APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY},
+    {APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND},
+    {APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME},
 #ifdef APM_CAPABILITY_CHANGE
-    {
-    APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED},
+    {APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED},
 #endif
 };
 
diff --git a/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c b/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c
index 10251f3..2294385 100644
--- a/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c
+++ b/hw/xfree86/os-support/bsd/bsd_kqueue_apm.c
@@ -54,21 +54,19 @@ static struct {
     u_int apmBsd;
     pmEvent xf86;
 } bsdToXF86Array[] = {
-    {
-    APM_STANDBY_REQ, XF86_APM_SYS_STANDBY}, {
-    APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND}, {
-    APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME}, {
-    APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME}, {
-    APM_BATTERY_LOW, XF86_APM_LOW_BATTERY}, {
-    APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE}, {
-    APM_UPDATE_TIME, XF86_APM_UPDATE_TIME}, {
-    APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND}, {
-    APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY}, {
-    APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND}, {
-    APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME},
+    {APM_STANDBY_REQ, XF86_APM_SYS_STANDBY},
+    {APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND},
+    {APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME},
+    {APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME},
+    {APM_BATTERY_LOW, XF86_APM_LOW_BATTERY},
+    {APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE},
+    {APM_UPDATE_TIME, XF86_APM_UPDATE_TIME},
+    {APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND},
+    {APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY},
+    {APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND},
+    {APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME},
 #ifdef APM_CAPABILITY_CHANGE
-    {
-    APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED},
+    {APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED},
 #endif
 };
 
diff --git a/hw/xfree86/os-support/bus/Sbus.c b/hw/xfree86/os-support/bus/Sbus.c
index b75308a..8260007 100644
--- a/hw/xfree86/os-support/bus/Sbus.c
+++ b/hw/xfree86/os-support/bus/Sbus.c
@@ -403,16 +403,16 @@ sparcPromAssignNodes(void)
             int devId;
             char *prefix;
         } procFbPrefixes[] = {
-            {
-            SBUS_DEVICE_BW2, "BWtwo"}, {
-            SBUS_DEVICE_CG14, "CGfourteen"}, {
-            SBUS_DEVICE_CG6, "CGsix"}, {
-            SBUS_DEVICE_CG3, "CGthree"}, {
-            SBUS_DEVICE_FFB, "Creator"}, {
-            SBUS_DEVICE_FFB, "Elite 3D"}, {
-            SBUS_DEVICE_LEO, "Leo"}, {
-            SBUS_DEVICE_TCX, "TCX"}, {
-        0, NULL},};
+            {SBUS_DEVICE_BW2, "BWtwo"},
+            {SBUS_DEVICE_CG14, "CGfourteen"},
+            {SBUS_DEVICE_CG6, "CGsix"},
+            {SBUS_DEVICE_CG3, "CGthree"},
+            {SBUS_DEVICE_FFB, "Creator"},
+            {SBUS_DEVICE_FFB, "Elite 3D"},
+            {SBUS_DEVICE_LEO, "Leo"},
+            {SBUS_DEVICE_TCX, "TCX"},
+            {0, NULL},
+        };
 
         while (fscanf(f, "%d %63s\n", &fbNum, buffer) == 2) {
             for (i = 0; procFbPrefixes[i].devId; i++)
diff --git a/hw/xfree86/os-support/linux/lnx_apm.c b/hw/xfree86/os-support/linux/lnx_apm.c
index a37331e..3879340 100644
--- a/hw/xfree86/os-support/linux/lnx_apm.c
+++ b/hw/xfree86/os-support/linux/lnx_apm.c
@@ -42,26 +42,23 @@ static struct {
     apm_event_t apmLinux;
     pmEvent xf86;
 } LinuxToXF86[] = {
-    {
-    APM_SYS_STANDBY, XF86_APM_SYS_STANDBY}, {
-    APM_SYS_SUSPEND, XF86_APM_SYS_SUSPEND}, {
-    APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME}, {
-    APM_CRITICAL_RESUME, XF86_APM_CRITICAL_RESUME}, {
-    APM_LOW_BATTERY, XF86_APM_LOW_BATTERY}, {
-    APM_POWER_STATUS_CHANGE, XF86_APM_POWER_STATUS_CHANGE}, {
-    APM_UPDATE_TIME, XF86_APM_UPDATE_TIME}, {
-    APM_CRITICAL_SUSPEND, XF86_APM_CRITICAL_SUSPEND}, {
-    APM_USER_STANDBY, XF86_APM_USER_STANDBY}, {
-    APM_USER_SUSPEND, XF86_APM_USER_SUSPEND}, {
-    APM_STANDBY_RESUME, XF86_APM_STANDBY_RESUME},
+    {APM_SYS_STANDBY, XF86_APM_SYS_STANDBY},
+    {APM_SYS_SUSPEND, XF86_APM_SYS_SUSPEND},
+    {APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME},
+    {APM_CRITICAL_RESUME, XF86_APM_CRITICAL_RESUME},
+    {APM_LOW_BATTERY, XF86_APM_LOW_BATTERY},
+    {APM_POWER_STATUS_CHANGE, XF86_APM_POWER_STATUS_CHANGE},
+    {APM_UPDATE_TIME, XF86_APM_UPDATE_TIME},
+    {APM_CRITICAL_SUSPEND, XF86_APM_CRITICAL_SUSPEND},
+    {APM_USER_STANDBY, XF86_APM_USER_STANDBY},
+    {APM_USER_SUSPEND, XF86_APM_USER_SUSPEND},
+    {APM_STANDBY_RESUME, XF86_APM_STANDBY_RESUME},
 #if defined(APM_CAPABILITY_CHANGED)
-    {
-    APM_CAPABILITY_CHANGED, XF86_CAPABILITY_CHANGED},
+    {APM_CAPABILITY_CHANGED, XF86_CAPABILITY_CHANGED},
 #endif
 #if 0
-    {
-    APM_STANDBY_FAILED, XF86_APM_STANDBY_FAILED}, {
-    APM_SUSPEND_FAILED, XF86_APM_SUSPEND_FAILED}
+    {APM_STANDBY_FAILED, XF86_APM_STANDBY_FAILED},
+    {APM_SUSPEND_FAILED, XF86_APM_SUSPEND_FAILED}
 #endif
 };
 
diff --git a/hw/xfree86/os-support/solaris/sun_apm.c b/hw/xfree86/os-support/solaris/sun_apm.c
index 4ff6464..b6a1432 100644
--- a/hw/xfree86/os-support/solaris/sun_apm.c
+++ b/hw/xfree86/os-support/solaris/sun_apm.c
@@ -97,21 +97,19 @@ static struct {
     u_int apmBsd;
     pmEvent xf86;
 } sunToXF86Array[] = {
-    {
-    APM_STANDBY_REQ, XF86_APM_SYS_STANDBY}, {
-    APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND}, {
-    APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME}, {
-    APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME}, {
-    APM_BATTERY_LOW, XF86_APM_LOW_BATTERY}, {
-    APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE}, {
-    APM_UPDATE_TIME, XF86_APM_UPDATE_TIME}, {
-    APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND}, {
-    APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY}, {
-    APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND}, {
-    APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME},
+    {APM_STANDBY_REQ, XF86_APM_SYS_STANDBY},
+    {APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND},
+    {APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME},
+    {APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME},
+    {APM_BATTERY_LOW, XF86_APM_LOW_BATTERY},
+    {APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE},
+    {APM_UPDATE_TIME, XF86_APM_UPDATE_TIME},
+    {APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND},
+    {APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY},
+    {APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND},
+    {APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME},
 #ifdef APM_CAPABILITY_CHANGE
-    {
-    APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED},
+    {APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED},
 #endif
 };
 
commit afe8ef9043a0bc3b9322448c004b3f4ce203160a
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Jul 30 14:32:11 2012 -0400

    randr: Fix up yet another corner case in preferred mode selection
    
    Let's say - purely for the sake of argument, mind you - that you had a
    server GPU with anemic memory bandwidth, and you walked up to it and
    plugged in a monitor that was 1920x1080 because that's what happened to
    be on the crash cart.  Say the memory bandwidth is such that anything
    larger than 1280x1024 gets filtered away.  Now you're in trouble,
    because the established timings section includes a 720x400 mode because
    that's what DOS 80x25 is, and that happens to just about match the
    physical aspect ratio.
    
    Instead let's reuse the logic from the existing aspect-match path: pick
    the larger mode of either the physical aspect ratio or 4:3.
    
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit ff56f88616aa63797384c2c484b2bd0f194df96a)

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 6d5e92f..803de88 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -2054,12 +2054,13 @@ xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
 
     /*
      * If there's no preferred mode, but only one monitor, pick the
-     * biggest mode for its aspect ratio, assuming one exists.
+     * biggest mode for its aspect ratio or 4:3, assuming one exists.
      */
     if (!ret)
         do {
             int i = 0;
             float aspect = 0.0;
+            DisplayModePtr a = NULL, b = NULL;
 
             /* count the number of enabled outputs */
             for (i = 0, p = -1; nextEnabledOutput(config, enabled, &p); i++);
@@ -2073,8 +2074,11 @@ xf86TargetPreferred(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
                 aspect = (float) config->output[p]->mm_width /
                     (float) config->output[p]->mm_height;
 
+            a = bestModeForAspect(config, enabled, 4.0/3.0);
             if (aspect)
-                preferred_match[p] = bestModeForAspect(config, enabled, aspect);
+                b = bestModeForAspect(config, enabled, aspect);
+
+            preferred_match[p] = biggestMode(a, b);
 
             if (preferred_match[p])
                 ret = TRUE;
commit af8ffefc070be8cb449812100b86501db17e8fd8
Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Jul 30 14:32:10 2012 -0400

    kinput: allocate enough space for null character.
    
    This code wasn't allocating enough space and was assigning the NULL
    one past the end.
    
    Pointed out by coverity.
    
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 531785dd746d64ef7f473a83ca73bb20e74b6fca)

diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 692e511..eabee6d 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -1055,7 +1055,7 @@ KdGetOptions(InputOption **options, char *string)
 
     if (strchr(string, '=')) {
         tam_key = (strchr(string, '=') - string);
-        key = strndup(string, tam_key);
+        key = strndup(string, tam_key + 1);
         if (!key)
             goto out;
 
commit 3a2b67577cdf0d4e3aae28883e65cf782673198a
Author: Vic Lee <llyzs at 163.com>
Date:   Mon Jul 30 14:32:09 2012 -0400

    ephyr: Resize screen automatically when parent window is resized
    
    Bugzilla: https://bugs.freedesktop.org/25804
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Vic Lee <llyzs at 163.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 8843aed82e7d69422e7763a35832a2be8f26723f)

diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index 8eda539..abc668e 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -562,6 +562,8 @@ ephyrRandRSetConfig(ScreenPtr pScreen,
     if (wasEnabled)
         KdEnableScreen(pScreen);
 
+    RRScreenSizeNotify(pScreen);
+
     return TRUE;
 
  bail4:
@@ -594,6 +596,43 @@ ephyrRandRInit(ScreenPtr pScreen)
     pScrPriv->rrSetConfig = ephyrRandRSetConfig;
     return TRUE;
 }
+
+static Bool
+ephyrResizeScreen (ScreenPtr           pScreen,
+                  int                  newwidth,
+                  int                  newheight)
+{
+    KdScreenPriv(pScreen);
+    KdScreenInfo *screen = pScreenPriv->screen;
+    RRScreenSize size = {0};
+    Bool ret;
+    int t;
+
+    if (screen->randr & (RR_Rotate_90|RR_Rotate_270)) {
+        t = newwidth;
+        newwidth = newheight;
+        newheight = t;
+    }
+
+    if (newwidth == screen->width && newheight == screen->height) {
+        return FALSE;
+    }
+
+    size.width = newwidth;
+    size.height = newheight;
+
+    ret = ephyrRandRSetConfig (pScreen, screen->randr, 0, &size);
+    if (ret) {
+        RROutputPtr output;
+
+        output = RRFirstOutput(pScreen);
+        if (!output)
+            return FALSE;
+        RROutputSetModes(output, NULL, 0, 0);
+    }
+
+    return ret;
+}
 #endif
 
 Bool
@@ -963,6 +1002,14 @@ ephyrPoll(void)
             break;
 #endif                          /* XF86DRI */
 
+#ifdef RANDR
+        case EPHYR_EV_CONFIGURE:
+            ephyrResizeScreen(screenInfo.screens[ev.data.configure.screen],
+                              ev.data.configure.width,
+                              ev.data.configure.height);
+            break;
+#endif /* RANDR */
+
         default:
             break;
         }
diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index e13910b..02729d6 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -348,7 +348,8 @@ hostx_init(void)
         | PointerMotionMask
         | KeyPressMask
         | KeyReleaseMask
-        | ExposureMask;
+        | ExposureMask
+        | StructureNotifyMask;
 
     EPHYR_DBG("mark");
 
@@ -696,12 +697,14 @@ hostx_screen_init(EphyrScreenInfo screen,
     XResizeWindow(HostX.dpy, host_screen->win, width, height);
 
     /* Ask the WM to keep our size static */
-    size_hints = XAllocSizeHints();
-    size_hints->max_width = size_hints->min_width = width;
-    size_hints->max_height = size_hints->min_height = height;
-    size_hints->flags = PMinSize | PMaxSize;
-    XSetWMNormalHints(HostX.dpy, host_screen->win, size_hints);
-    XFree(size_hints);
+    if (host_screen->win_pre_existing == None) {
+        size_hints = XAllocSizeHints();
+        size_hints->max_width = size_hints->min_width = width;
+        size_hints->max_height = size_hints->min_height = height;
+        size_hints->flags = PMinSize | PMaxSize;
+        XSetWMNormalHints(HostX.dpy, host_screen->win, size_hints);
+        XFree(size_hints);
+    }
 
     XMapWindow(HostX.dpy, host_screen->win);
 
@@ -1004,6 +1007,22 @@ hostx_get_event(EphyrHostXEvent * ev)
             ev->data.key_up.scancode = xev.xkey.keycode;
             return 1;
 
+        case ConfigureNotify:
+        {
+            struct EphyrHostScreen *host_screen =
+                host_screen_from_window(xev.xconfigure.window);
+
+            if (host_screen && host_screen->win_pre_existing != None) {
+                ev->type = EPHYR_EV_CONFIGURE;
+                ev->data.configure.width = xev.xconfigure.width;
+                ev->data.configure.height = xev.xconfigure.height;
+                ev->data.configure.window = xev.xconfigure.window;
+                ev->data.configure.screen = host_screen->mynum;
+                return 1;
+            }
+
+            return 0;
+        }
         default:
             break;
 
diff --git a/hw/kdrive/ephyr/hostx.h b/hw/kdrive/ephyr/hostx.h
index d621711..31c4053 100644
--- a/hw/kdrive/ephyr/hostx.h
+++ b/hw/kdrive/ephyr/hostx.h
@@ -47,7 +47,8 @@ typedef enum EphyrHostXEventType {
     EPHYR_EV_MOUSE_RELEASE,
     EPHYR_EV_KEY_PRESS,
     EPHYR_EV_KEY_RELEASE,
-    EPHYR_EV_EXPOSE
+    EPHYR_EV_EXPOSE,
+    EPHYR_EV_CONFIGURE,
 } EphyrHostXEventType;
 
 /* I can't believe it's not a KeySymsRec. */
@@ -89,6 +90,13 @@ struct EphyrHostXEvent {
             int window;
         } expose;
 
+        struct configure {
+            int width;
+            int height;
+            int screen;
+            int window;
+        } configure;
+
     } data;
 
     int key_state;
commit 7749c58134022bc6718150c3bb81f18b07687674
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Jul 30 14:32:08 2012 -0400

    ephyr: Fix up some bizarre formatting
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit b46bbafae6d0a8b3f2f7853d5c1475fc223b1ed6)

diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index 6988f16..e13910b 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -345,7 +345,10 @@ hostx_init(void)
     attr.event_mask =
         ButtonPressMask
         | ButtonReleaseMask
-        | PointerMotionMask | KeyPressMask | KeyReleaseMask | ExposureMask;
+        | PointerMotionMask
+        | KeyPressMask
+        | KeyReleaseMask
+        | ExposureMask;
 
     EPHYR_DBG("mark");
 
commit ab46bdec65b4b1150ffa0aa4d9f3142e7e89cef9
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date:   Fri Aug 3 10:21:11 2012 -0700

    configure.ac: Version bump to 1.12.3.901 (1.12.4 RC1)
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>

diff --git a/configure.ac b/configure.ac
index c8dee90..aece819 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,8 +26,8 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.60)
-AC_INIT([xorg-server], 1.12.3, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2012-07-09"
+AC_INIT([xorg-server], 1.12.3.901, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2012-08-03"
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
commit 631715e12953a392066ca2a0787b37471747f879
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date:   Wed Aug 1 18:46:08 2012 -0700

    XQuartz: Fix xp_window_bring_all_to_front linking on OS versions with older libXplugin
    
    Found-by: Tinderbox
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
    (cherry picked from commit 884f51e9770c9ccd3b38a14ea393ea2c7a5ef235)

diff --git a/hw/xquartz/xpr/xprEvent.c b/hw/xquartz/xpr/xprEvent.c
index 73bcc93..398177c 100644
--- a/hw/xquartz/xpr/xprEvent.c
+++ b/hw/xquartz/xpr/xprEvent.c
@@ -59,13 +59,6 @@
 #include "rootlessWindow.h"
 #include "xprEvent.h"
 
-/* This is important enough to declare here if building against an old
- * libXplugin, so we pick it up whenever libXplugin  starts to support it.
- */
-#if !defined(XPLUGIN_VERSION) || XPLUGIN_VERSION < 6
-extern xp_error xp_window_bring_all_to_front(void) __attribute__((weak_import));
-#endif
-
 Bool
 QuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev)
 {
@@ -86,21 +79,18 @@ QuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev)
         /* There's no need to do xp_window_bring_all_to_front on Leopard,
          * and we don't care about the result, so just do it async.
          */
-#if defined(HAVE_LIBDISPATCH)
-#if (defined(XPLUGIN_VERSION_MIN_REQUIRED) && XPLUGIN_VERSION_MIN_REQUIRED >= 6) || \
-    (!defined(XPLUGIN_VERSION_MIN_REQUIRED) && defined(XPLUGIN_VERSION) && XPLUGIN_VERSION >= 6)
-        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-            xp_window_bring_all_to_front();
-        });
-#else
-            if (&xp_window_bring_all_to_front) {
-                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-                    xp_window_bring_all_to_front();
-                });
-            } else {
-                RootlessOrderAllWindows(e->data[0]);
-            }
-#endif
+#if defined(HAVE_LIBDISPATCH) && defined(XPLUGIN_VERSION) && XPLUGIN_VERSION >= 6
+#  if defined(XPLUGIN_VERSION_MIN_REQUIRED) && XPLUGIN_VERSION_MIN_REQUIRED < 6
+        if (&xp_window_bring_all_to_front) {
+#  endif
+            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+                xp_window_bring_all_to_front();
+            });
+#  if defined(XPLUGIN_VERSION_MIN_REQUIRED) && XPLUGIN_VERSION_MIN_REQUIRED < 6
+        } else {
+            RootlessOrderAllWindows(e->data[0]);
+        }
+#  endif
 #else
         RootlessOrderAllWindows(e->data[0]);
 #endif
commit e2df31de390f58211029bd975e8af0169d121737
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Mon Jul 23 12:16:36 2012 +0100

    hw/xquartz: Various fixes for pseudoramiX.c
    
    Various fixes, applied to panoramiX.c in commit 2b266eda, also need applying to pseudoramiX.c:
     Fix panoramiX request and reply swapping
     Set window and screen values in panoramix replies
     Prevent buffer overrun in ProcPanoramiXGetScreenSize
    
    These fixes seem to be necessary in order to compile pseudoramiX.c with gcc
    
    pseudoramiX.c: In function 'ProcPseudoramiXGetState':
    pseudoramiX.c:221:56: error: call to 'wrong_size' declared with attribute error: wrong sized variable passed to swap
    pseudoramiX.c: In function 'ProcPseudoramiXGetScreenCount':
    pseudoramiX.c:250:62: error: call to 'wrong_size' declared with attribute error: wrong sized variable passed to swap
    pseudoramiX.c: In function 'ProcPseudoramiXGetScreenSize':
    pseudoramiX.c:283:56: error: call to 'wrong_size' declared with attribute error: wrong sized variable passed to swap
    pseudoramiX.c:284:57: error: call to 'wrong_size' declared with attribute error: wrong sized variable passed to swap
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
    (cherry picked from commit 067931ccce592e319baffa26d4f7380d8d924537)

diff --git a/hw/xquartz/pseudoramiX.c b/hw/xquartz/pseudoramiX.c
index 24349e3..0f591d5 100644
--- a/hw/xquartz/pseudoramiX.c
+++ b/hw/xquartz/pseudoramiX.c
@@ -211,10 +211,11 @@ ProcPseudoramiXGetState(ClientPtr client)
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
     rep.state = !noPseudoramiXExtension;
+    rep.window = stuff->window;
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
-        swaps(&rep.state);
+        swapl(&rep.window);
     }
     WriteToClient(client, sizeof(xPanoramiXGetStateReply), (char *)&rep);
     return Success;
@@ -240,10 +241,11 @@ ProcPseudoramiXGetScreenCount(ClientPtr client)
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
     rep.ScreenCount = pseudoramiXNumScreens;
+    rep.window = stuff->window;
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
-        swaps(&rep.ScreenCount);
+        swapl(&rep.window);
     }
     WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), (char *)&rep);
     return Success;
@@ -260,6 +262,9 @@ ProcPseudoramiXGetScreenSize(ClientPtr client)
 
     TRACE();
 
+    if (stuff->screen >= pseudoramiXNumScreens)
+      return BadMatch;
+
     REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
     rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
     if (rc != Success)
@@ -273,11 +278,15 @@ ProcPseudoramiXGetScreenSize(ClientPtr client)
     // was screenInfo.screens[stuff->screen]->width;
     rep.height = pseudoramiXScreens[stuff->screen].h;
     // was screenInfo.screens[stuff->screen]->height;
+    rep.window = stuff->window;
+    rep.screen = stuff->screen;
     if (client->swapped) {
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
-        swaps(&rep.width);
-        swaps(&rep.height);
+        swapl(&rep.width);
+        swapl(&rep.height);
+        swapl(&rep.window);
+        swapl(&rep.screen);
     }
     WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), (char *)&rep);
     return Success;
commit dfc943609acf73dc3946ba106bcdf6c66997a3b8
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Jul 25 11:40:33 2012 -0700

    XQuartz: Call xp_window_bring_all_to_front if available in libXplugin
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit fd228d318428d0d9dea52ca560a9b66660dd2d02)

diff --git a/hw/xquartz/xpr/xprEvent.c b/hw/xquartz/xpr/xprEvent.c
index 106a919..73bcc93 100644
--- a/hw/xquartz/xpr/xprEvent.c
+++ b/hw/xquartz/xpr/xprEvent.c
@@ -52,9 +52,20 @@
 #include <sys/uio.h>
 #include <unistd.h>
 
+#ifdef HAVE_LIBDISPATCH
+#include <dispatch/dispatch.h>
+#endif
+
 #include "rootlessWindow.h"
 #include "xprEvent.h"
 
+/* This is important enough to declare here if building against an old
+ * libXplugin, so we pick it up whenever libXplugin  starts to support it.
+ */
+#if !defined(XPLUGIN_VERSION) || XPLUGIN_VERSION < 6
+extern xp_error xp_window_bring_all_to_front(void) __attribute__((weak_import));
+#endif
+
 Bool
 QuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev)
 {
@@ -72,7 +83,28 @@ QuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev)
 
     case kXquartzBringAllToFront:
         DEBUG_LOG("kXquartzBringAllToFront\n");
+        /* There's no need to do xp_window_bring_all_to_front on Leopard,
+         * and we don't care about the result, so just do it async.
+         */
+#if defined(HAVE_LIBDISPATCH)
+#if (defined(XPLUGIN_VERSION_MIN_REQUIRED) && XPLUGIN_VERSION_MIN_REQUIRED >= 6) || \
+    (!defined(XPLUGIN_VERSION_MIN_REQUIRED) && defined(XPLUGIN_VERSION) && XPLUGIN_VERSION >= 6)
+        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+            xp_window_bring_all_to_front();
+        });
+#else
+            if (&xp_window_bring_all_to_front) {
+                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+                    xp_window_bring_all_to_front();
+                });
+            } else {
+                RootlessOrderAllWindows(e->data[0]);
+            }
+#endif
+#else
         RootlessOrderAllWindows(e->data[0]);
+#endif
+
         return TRUE;
 
     default:
commit bfcc45861c7a2396c109fdac9b6db84d6b614db1
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Jul 11 23:49:59 2012 -0700

    XQuartz: Fix incorrect PseudoramiXExtensionInit prototype
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit 1a64d3cc9c319d5e9ab2365b60469fb5b83407fc)

diff --git a/hw/xquartz/pseudoramiX.c b/hw/xquartz/pseudoramiX.c
index 01113ce..24349e3 100644
--- a/hw/xquartz/pseudoramiX.c
+++ b/hw/xquartz/pseudoramiX.c
@@ -125,7 +125,7 @@ PseudoramiXAddScreen(int x, int y, int w, int h)
 // Initialize PseudoramiX.
 // Copied from PanoramiXExtensionInit
 void
-PseudoramiXExtensionInit(int argc, char *argv[])
+PseudoramiXExtensionInit(void)
 {
     Bool success = FALSE;
     ExtensionEntry      *extEntry;
diff --git a/hw/xquartz/pseudoramiX.h b/hw/xquartz/pseudoramiX.h
index f41b5cb..7e08749 100644
--- a/hw/xquartz/pseudoramiX.h
+++ b/hw/xquartz/pseudoramiX.h
@@ -6,6 +6,6 @@ extern int noPseudoramiXExtension;
 
 void
 PseudoramiXAddScreen(int x, int y, int w, int h);
-void PseudoramiXExtensionInit(int argc, char *argv[]);
+void PseudoramiXExtensionInit(void);
 void
 PseudoramiXResetScreens(void);
commit cb8fbccba79b30d0f8443d181016fa78ccce86e6
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Jul 11 23:49:33 2012 -0700

    XQuartz: Silence an unused-variable warning
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit 228f8bfe81890770f1ba109a0acca1c81a2ffee9)

diff --git a/hw/xquartz/pseudoramiX.c b/hw/xquartz/pseudoramiX.c
index 8bb7f2d..01113ce 100644
--- a/hw/xquartz/pseudoramiX.c
+++ b/hw/xquartz/pseudoramiX.c
@@ -256,7 +256,7 @@ ProcPseudoramiXGetScreenSize(ClientPtr client)
     REQUEST(xPanoramiXGetScreenSizeReq);
     WindowPtr pWin;
     xPanoramiXGetScreenSizeReply rep;
-    register int n, rc;
+    register int rc;
 
     TRACE();
 
commit 1b2ae1fd7a630c9100ed87bc785fa5d9a52661b0
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Tue Jul 10 09:10:22 2012 +0100

    AllocDevicePair: Ensure XKB privates are initialised
    
    Since we call directly into XKB and may be doing so before the extension
    has been initialised, make sure its privates are set up first.  XTest
    had a hack to do this itself, but seems cleaner to just make sure we do
    it in AllocDevicePair.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 59c2c4f645b4d782599c274f4bc752de9623d308)

diff --git a/dix/devices.c b/dix/devices.c
index 0125504..fbc9fec 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -2630,6 +2630,8 @@ AllocDevicePair(ClientPtr client, const char *name,
 
     *ptr = *keybd = NULL;
 
+    XkbInitPrivates();
+
     pointer = AddInputDevice(client, ptr_proc, TRUE);
 
     if (!pointer)
diff --git a/test/xtest.c b/test/xtest.c
index aeca669..0b8d866 100644
--- a/test/xtest.c
+++ b/test/xtest.c
@@ -63,8 +63,6 @@ xtest_init_devices(void)
     dixResetPrivates();
     InitAtoms();
 
-    XkbInitPrivates();
-
     /* this also inits the xtest devices */
     InitCoreDevices();
 
commit fc13888f19cd068ee6485d5d7be54edfa17036a2
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Tue Jul 10 02:02:52 2012 +0100

    Xinerama: Fix ExtensionInit prototype
    
    Huh, so I guess INITARGS used to be int argc, char *argv then.  Either
    way, it's now void, so fix that ...
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Cyril Brulebois <kibi at debian.org>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit bddb8c6cbe52ba9923b1d36d01f5ac9391b0ec0e)

diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index 98d327f..3e5cd62 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -434,7 +434,7 @@ XineramaReinitData(void)
  */
 
 void
-PanoramiXExtensionInit(int argc, char *argv[])
+PanoramiXExtensionInit(void)
 {
     int i;
     Bool success = FALSE;
diff --git a/hw/xfree86/dixmods/extmod/modinit.h b/hw/xfree86/dixmods/extmod/modinit.h
index 9753fe0..e7c7448 100644
--- a/hw/xfree86/dixmods/extmod/modinit.h
+++ b/hw/xfree86/dixmods/extmod/modinit.h
@@ -85,7 +85,7 @@ extern void SecurityExtensionInit(INITARGS);
 #endif
 
 #if 1
-extern void PanoramiXExtensionInit(int argc, char *argv[]);
+extern void PanoramiXExtensionInit(INITARGS);
 #endif
 
 #if 1
commit ce106ae299a5444ee7cca1b6f4b7bc3bdfe15888
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Tue Jul 10 02:02:49 2012 +0100

    Xorg: Link XKB DDX library after core server libs
    
    libxorgxkb.a contains a number of libraries which are used by XKB action
    code to call back into the DDX, e.g. for VT switching, termination, grab
    breaking, et al.  Make sure libxkb.a comes first in the link order, so
    it can mark XkbDDX* as used in order for the linker to not discard them.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 67953d6975ef2ee573b95e7641aaf3d72e9f8379)

diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 72be889..391b26e 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -54,8 +54,8 @@ LOCAL_LIBS = \
             ramdac/libramdac.la \
             ddc/libddc.la \
             i2c/libi2c.la \
-            dixmods/libxorgxkb.la \
             $(XORG_LIBS) \
+            dixmods/libxorgxkb.la \
             $(top_builddir)/mi/libmi.la \
             $(top_builddir)/os/libos.la
 Xorg_LDADD = \
commit 7b7db8ced263093bdcc1e57dfe7574e07cd5b63a
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Tue Jul 10 02:02:46 2012 +0100

    Don't make failure to -nolisten fatal
    
    If failing to disable a protocol specified by -nolisten failed, we'd
    throw a FatalError and bomb startup entirely.  From poking at xtrans, it
    looks like the only way we can get a failure here is because we've
    specified a protocol name which doesn't exist, which probably doesn't
    constitute a security risk.
    
    And it makes it possible to start gdm even though you've built with
    --disable-tcp-transport.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 656af2c7e73d948338683675e14cd827b46a97c4)

diff --git a/os/utils.c b/os/utils.c
index 30592d2..e33e4d2 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -746,8 +746,8 @@ ProcessCommandLine(int argc, char *argv[])
         else if (strcmp(argv[i], "-nolisten") == 0) {
             if (++i < argc) {
                 if (_XSERVTransNoListen(argv[i]))
-                    FatalError("Failed to disable listen for %s transport",
-                               argv[i]);
+                    ErrorF("Failed to disable listen for %s transport",
+                           argv[i]);
             }
             else
                 UseMsg();
commit af7ff8f1ccec722bc8690c6f512a986b0f3c7a9c
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:44 2012 -0700

    Initialize padding bits to 0 in ErrorConnMax()
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>
    (cherry picked from commit 7a29f6878284e2d65e69fcd157aa9ec01d21b3c0)

diff --git a/os/connection.c b/os/connection.c
index 1099752..d7e21f3 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -863,7 +863,7 @@ ErrorConnMax(XtransConnInfo trans_conn)
 {
     int fd = _XSERVTransGetConnectionNumber(trans_conn);
     xConnSetupPrefix csp;
-    char pad[3];
+    char pad[3] = { 0, 0, 0 };
     struct iovec iov[3];
     char byteOrder = 0;
     int whichbyte = 1;
commit f29c0ddd5afc4549e20d72a1d9e4c17276bb4bb1
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:44 2012 -0700

    Set padding bytes to 0 in WriteToClient
    
    Clear them out when needed instead of leaving whatever values were
    present in previously sent messages.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>
    (cherry picked from commit bed610fcae41ddfe21fa9acde599b17d1d15f5d1)

diff --git a/os/io.c b/os/io.c
index b67a5f3..8d0e5cc 100644
--- a/os/io.c
+++ b/os/io.c
@@ -815,7 +815,11 @@ WriteToClient(ClientPtr who, int count, const void *__buf)
     NewOutputPending = TRUE;
     FD_SET(oc->fd, &OutputPending);
     memmove((char *) oco->buf + oco->count, buf, count);
-    oco->count += count + padBytes;
+    oco->count += count;
+    if (padBytes) {
+        memset(oco->buf + oco->count, '\0', padBytes);
+        oco->count += padBytes;
+    }
     return count;
 }
 
commit eeefadf95ed764755bfb04b107f636c6ae60bdde
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:42 2012 -0700

    Use calloc to zero fill buffers being allocated for replies & events
    
    Ensures padding bytes are zero-filled
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>
    (cherry picked from commit cdf5bcd420e5bcf4a4a24a275d3133a4e16ce41e)

diff --git a/Xext/sync.c b/Xext/sync.c
index 37c59c2..532cb64 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -466,7 +466,7 @@ SyncSendCounterNotifyEvents(ClientPtr client, SyncAwait ** ppAwait,
 
     if (client->clientGone)
         return;
-    pev = pEvents = malloc(num_events * sizeof(xSyncCounterNotifyEvent));
+    pev = pEvents = calloc(num_events, sizeof(xSyncCounterNotifyEvent));
     if (!pEvents)
         return;
     UpdateCurrentTime();
diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c
index 9de7856..9d089f9 100644
--- a/Xext/xf86bigfont.c
+++ b/Xext/xf86bigfont.c
@@ -555,7 +555,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
                ? nUniqCharInfos * sizeof(xCharInfo)
                + (nCharInfos + 1) / 2 * 2 * sizeof(CARD16)
                : 0);
-        xXF86BigfontQueryFontReply *reply = malloc(rlength);
+        xXF86BigfontQueryFontReply *reply = calloc(1, rlength);
         char *p;
 
         if (!reply) {
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 24fed8f..f62fd79 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -2304,7 +2304,7 @@ __glXDisp_QueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
     reply.n = n;
 
     /* Allocate buffer to make sure it's a multiple of 4 bytes big. */
-    buf = (char *) malloc(length << 2);
+    buf = calloc(length, 4);
     if (buf == NULL)
         return BadAlloc;
     memcpy(buf, pGlxScreen->GLXextensions, n);
@@ -2365,7 +2365,7 @@ __glXDisp_QueryServerString(__GLXclientState * cl, GLbyte * pc)
     reply.length = length;
     reply.n = n;
 
-    buf = (char *) malloc(length << 2);
+    buf = calloc(length, 4);
     if (buf == NULL) {
         return BadAlloc;
     }
diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c
index d5d97c9..ac3bee0 100644
--- a/hw/xfree86/dixmods/extmod/xf86vmode.c
+++ b/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -1362,7 +1362,7 @@ ProcXF86VidModeGetDotClocks(ClientPtr client)
     rep.flags = 0;
 
     if (!ClockProg) {
-        Clocks = malloc(numClocks * sizeof(int));
+        Clocks = calloc(numClocks, sizeof(int));
         if (!Clocks)
             return BadValue;
         if (!VidModeGetClocks(stuff->screen, Clocks)) {
diff --git a/mi/miexpose.c b/mi/miexpose.c
index dbb29ca..2dc465d 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -327,7 +327,7 @@ miSendGraphicsExpose(ClientPtr client, RegionPtr pRgn, XID drawable,
 
         numRects = RegionNumRects(pRgn);
         pBox = RegionRects(pRgn);
-        if (!(pEvent = malloc(numRects * sizeof(xEvent))))
+        if (!(pEvent = calloc(numRects, sizeof(xEvent))))
             return;
         pe = pEvent;
 
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 0c596dd..71d53f2 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -1342,7 +1342,7 @@ ProcRRGetCrtcTransform(ClientPtr client)
     nextra = (transform_filter_length(pending) +
               transform_filter_length(current));
 
-    reply = malloc(sizeof(xRRGetCrtcTransformReply) + nextra);
+    reply = calloc(1, sizeof(xRRGetCrtcTransformReply) + nextra);
     if (!reply)
         return BadAlloc;
 
diff --git a/render/render.c b/render/render.c
index 344ca75..aa66020 100644
--- a/render/render.c
+++ b/render/render.c
@@ -531,7 +531,7 @@ ProcRenderQueryPictIndexValues(ClientPtr client)
     num = pFormat->index.nvalues;
     rlength = (sizeof(xRenderQueryPictIndexValuesReply) +
                num * sizeof(xIndexValue));
-    reply = (xRenderQueryPictIndexValuesReply *) malloc(rlength);
+    reply = (xRenderQueryPictIndexValuesReply *) calloc(1, rlength);
     if (!reply)
         return BadAlloc;
 
@@ -1688,7 +1688,7 @@ ProcRenderQueryFilters(ClientPtr client)
     }
     len = ((nnames + 1) >> 1) + bytes_to_int32(nbytesName);
     total_bytes = sizeof(xRenderQueryFiltersReply) + (len << 2);
-    reply = (xRenderQueryFiltersReply *) malloc(total_bytes);
+    reply = (xRenderQueryFiltersReply *) calloc(1, total_bytes);
     if (!reply)
         return BadAlloc;
     aliases = (INT16 *) (reply + 1);
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index 602b906..7d0b9a1 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -380,7 +380,8 @@ ProcXFixesGetCursorImage(ClientPtr client)
     width = pCursor->bits->width;
     height = pCursor->bits->height;
     npixels = width * height;
-    rep = malloc(sizeof(xXFixesGetCursorImageReply) + npixels * sizeof(CARD32));
+    rep = calloc(sizeof(xXFixesGetCursorImageReply) + npixels * sizeof(CARD32),
+                 1);
     if (!rep)
         return BadAlloc;
 
@@ -529,8 +530,8 @@ ProcXFixesGetCursorImageAndName(ClientPtr client)
     name = pCursor->name ? NameForAtom(pCursor->name) : "";
     nbytes = strlen(name);
     nbytesRound = pad_to_int32(nbytes);
-    rep = malloc(sizeof(xXFixesGetCursorImageAndNameReply) +
-                 npixels * sizeof(CARD32) + nbytesRound);
+    rep = calloc(sizeof(xXFixesGetCursorImageAndNameReply) +
+                 npixels * sizeof(CARD32) + nbytesRound, 1);
     if (!rep)
         return BadAlloc;
 
diff --git a/xfixes/region.c b/xfixes/region.c
index 624109d..7110177 100644
--- a/xfixes/region.c
+++ b/xfixes/region.c
@@ -558,7 +558,8 @@ ProcXFixesFetchRegion(ClientPtr client)
     pBox = RegionRects(pRegion);
     nBox = RegionNumRects(pRegion);
 
-    reply = malloc(sizeof(xXFixesFetchRegionReply) + nBox * sizeof(xRectangle));
+    reply = calloc(sizeof(xXFixesFetchRegionReply) + nBox * sizeof(xRectangle),
+                   1);
     if (!reply)
         return BadAlloc;
     reply->type = X_Reply;
commit 8cefa9bf0766f10a1fc09a8d414e6ddfaa4addd9
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:42 2012 -0700

    xf86dga2.c & xf86vmode.c: Move REQUEST_SIZE_MATCH checks before using stuff
    
    Seems silly waiting to check if the client failed to send us enough bytes
    until after we've already tried using them.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>
    (cherry picked from commit ef0f701c9245b0373eb0c7a84dd804af4738bb29)

diff --git a/hw/xfree86/dixmods/extmod/xf86dga2.c b/hw/xfree86/dixmods/extmod/xf86dga2.c
index 6b33941..4b3238f 100644
--- a/hw/xfree86/dixmods/extmod/xf86dga2.c
+++ b/hw/xfree86/dixmods/extmod/xf86dga2.c
@@ -96,13 +96,14 @@ ProcXDGAOpenFramebuffer(ClientPtr client)
     char *deviceName;
     int nameSize;
 
+    REQUEST_SIZE_MATCH(xXDGAOpenFramebufferReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (!DGAAvailable(stuff->screen))
         return DGAErrorBase + XF86DGANoDirectVideoMode;
 
-    REQUEST_SIZE_MATCH(xXDGAOpenFramebufferReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
@@ -129,14 +130,14 @@ ProcXDGACloseFramebuffer(ClientPtr client)
 {
     REQUEST(xXDGACloseFramebufferReq);
 
+    REQUEST_SIZE_MATCH(xXDGACloseFramebufferReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (!DGAAvailable(stuff->screen))
         return DGAErrorBase + XF86DGANoDirectVideoMode;
 
-    REQUEST_SIZE_MATCH(xXDGACloseFramebufferReq);
-
     DGACloseFramebuffer(stuff->screen);
 
     return Success;
@@ -152,10 +153,11 @@ ProcXDGAQueryModes(ClientPtr client)
     xXDGAModeInfo info;
     XDGAModePtr mode;
 
+    REQUEST_SIZE_MATCH(xXDGAQueryModesReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    REQUEST_SIZE_MATCH(xXDGAQueryModesReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.number = 0;
@@ -267,11 +269,12 @@ ProcXDGASetMode(ClientPtr client)
     ClientPtr owner;
     int size;
 
+    REQUEST_SIZE_MATCH(xXDGASetModeReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
     owner = DGA_GETCLIENT(stuff->screen);
 
-    REQUEST_SIZE_MATCH(xXDGASetModeReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.offset = 0;
@@ -357,14 +360,14 @@ ProcXDGASetViewport(ClientPtr client)
 {
     REQUEST(xXDGASetViewportReq);
 
+    REQUEST_SIZE_MATCH(xXDGASetViewportReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGASetViewportReq);
-
     DGASetViewport(stuff->screen, stuff->x, stuff->y, stuff->flags);
 
     return Success;
@@ -378,14 +381,14 @@ ProcXDGAInstallColormap(ClientPtr client)
 
     REQUEST(xXDGAInstallColormapReq);
 
+    REQUEST_SIZE_MATCH(xXDGAInstallColormapReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGAInstallColormapReq);
-
     rc = dixLookupResourceByType((pointer *) &cmap, stuff->cmap, RT_COLORMAP,
                                  client, DixInstallAccess);
     if (rc != Success)
@@ -399,14 +402,14 @@ ProcXDGASelectInput(ClientPtr client)
 {
     REQUEST(xXDGASelectInputReq);
 
+    REQUEST_SIZE_MATCH(xXDGASelectInputReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGASelectInputReq);
-
     if (DGA_GETCLIENT(stuff->screen) == client)
         DGASelectInput(stuff->screen, client, stuff->mask);
 
@@ -418,14 +421,14 @@ ProcXDGAFillRectangle(ClientPtr client)
 {
     REQUEST(xXDGAFillRectangleReq);
 
+    REQUEST_SIZE_MATCH(xXDGAFillRectangleReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGAFillRectangleReq);
-
     if (Success != DGAFillRect(stuff->screen, stuff->x, stuff->y,
                                stuff->width, stuff->height, stuff->color))
         return BadMatch;
@@ -438,14 +441,14 @@ ProcXDGACopyArea(ClientPtr client)
 {
     REQUEST(xXDGACopyAreaReq);
 
+    REQUEST_SIZE_MATCH(xXDGACopyAreaReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGACopyAreaReq);
-
     if (Success != DGABlitRect(stuff->screen, stuff->srcx, stuff->srcy,
                                stuff->width, stuff->height, stuff->dstx,
                                stuff->dsty))
@@ -459,14 +462,14 @@ ProcXDGACopyTransparentArea(ClientPtr client)
 {
     REQUEST(xXDGACopyTransparentAreaReq);
 
+    REQUEST_SIZE_MATCH(xXDGACopyTransparentAreaReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGACopyTransparentAreaReq);
-
     if (Success != DGABlitTransRect(stuff->screen, stuff->srcx, stuff->srcy,
                                     stuff->width, stuff->height, stuff->dstx,
                                     stuff->dsty, stuff->key))
@@ -481,13 +484,14 @@ ProcXDGAGetViewportStatus(ClientPtr client)
     REQUEST(xXDGAGetViewportStatusReq);
     xXDGAGetViewportStatusReply rep;
 
+    REQUEST_SIZE_MATCH(xXDGAGetViewportStatusReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGAGetViewportStatusReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
@@ -504,13 +508,14 @@ ProcXDGASync(ClientPtr client)
     REQUEST(xXDGASyncReq);
     xXDGASyncReply rep;
 
+    REQUEST_SIZE_MATCH(xXDGASyncReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGASyncReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
@@ -549,13 +554,14 @@ ProcXDGAChangePixmapMode(ClientPtr client)
     xXDGAChangePixmapModeReply rep;
     int x, y;
 
+    REQUEST_SIZE_MATCH(xXDGAChangePixmapModeReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGAChangePixmapModeReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
@@ -579,14 +585,14 @@ ProcXDGACreateColormap(ClientPtr client)
     REQUEST(xXDGACreateColormapReq);
     int result;
 
+    REQUEST_SIZE_MATCH(xXDGACreateColormapReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGACreateColormapReq);
-
     if (!stuff->mode)
         return BadValue;
 
@@ -615,10 +621,11 @@ ProcXF86DGAGetVideoLL(ClientPtr client)
     int num, offset, flags;
     char *name;
 
+    REQUEST_SIZE_MATCH(xXF86DGAGetVideoLLReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    REQUEST_SIZE_MATCH(xXF86DGAGetVideoLLReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
@@ -655,9 +662,10 @@ ProcXF86DGADirectVideo(ClientPtr client)
 
     REQUEST(xXF86DGADirectVideoReq);
 
+    REQUEST_SIZE_MATCH(xXF86DGADirectVideoReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
-    REQUEST_SIZE_MATCH(xXF86DGADirectVideoReq);
 
     if (!DGAAvailable(stuff->screen))
         return DGAErrorBase + XF86DGANoDirectVideoMode;
@@ -713,10 +721,11 @@ ProcXF86DGAGetViewPortSize(ClientPtr client)
     REQUEST(xXF86DGAGetViewPortSizeReq);
     xXF86DGAGetViewPortSizeReply rep;
 
+    REQUEST_SIZE_MATCH(xXF86DGAGetViewPortSizeReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    REQUEST_SIZE_MATCH(xXF86DGAGetViewPortSizeReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
@@ -741,14 +750,14 @@ ProcXF86DGASetViewPort(ClientPtr client)
 {
     REQUEST(xXF86DGASetViewPortReq);
 
+    REQUEST_SIZE_MATCH(xXF86DGASetViewPortReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXF86DGASetViewPortReq);
-
     if (!DGAAvailable(stuff->screen))
         return DGAErrorBase + XF86DGANoDirectVideoMode;
 
@@ -768,10 +777,11 @@ ProcXF86DGAGetVidPage(ClientPtr client)
     REQUEST(xXF86DGAGetVidPageReq);
     xXF86DGAGetVidPageReply rep;
 
+    REQUEST_SIZE_MATCH(xXF86DGAGetVidPageReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    REQUEST_SIZE_MATCH(xXF86DGAGetVidPageReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
@@ -786,11 +796,11 @@ ProcXF86DGASetVidPage(ClientPtr client)
 {
     REQUEST(xXF86DGASetVidPageReq);
 
+    REQUEST_SIZE_MATCH(xXF86DGASetVidPageReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    REQUEST_SIZE_MATCH(xXF86DGASetVidPageReq);
-
     /* silently fail */
 
     return Success;
@@ -804,14 +814,14 @@ ProcXF86DGAInstallColormap(ClientPtr client)
 
     REQUEST(xXF86DGAInstallColormapReq);
 
+    REQUEST_SIZE_MATCH(xXF86DGAInstallColormapReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXF86DGAInstallColormapReq);
-
     if (!DGAActive(stuff->screen))
         return DGAErrorBase + XF86DGADirectNotActivated;
 
@@ -832,10 +842,11 @@ ProcXF86DGAQueryDirectVideo(ClientPtr client)
     REQUEST(xXF86DGAQueryDirectVideoReq);
     xXF86DGAQueryDirectVideoReply rep;
 
+    REQUEST_SIZE_MATCH(xXF86DGAQueryDirectVideoReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    REQUEST_SIZE_MATCH(xXF86DGAQueryDirectVideoReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
@@ -854,14 +865,14 @@ ProcXF86DGAViewPortChanged(ClientPtr client)
     REQUEST(xXF86DGAViewPortChangedReq);
     xXF86DGAViewPortChangedReply rep;
 
+    REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq);
-
     if (!DGAActive(stuff->screen))
         return DGAErrorBase + XF86DGADirectNotActivated;
 
diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c
index 68c4b58..d5d97c9 100644
--- a/hw/xfree86/dixmods/extmod/xf86vmode.c
+++ b/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -1489,14 +1489,14 @@ ProcXF86VidModeGetGammaRamp(ClientPtr client)
 
     REQUEST(xXF86VidModeGetGammaRampReq);
 
+    REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (stuff->size != VidModeGetGammaRampSize(stuff->screen))
         return BadValue;
 
-    REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
-
     length = (stuff->size + 1) & ~1;
 
     if (stuff->size) {
@@ -1537,11 +1537,11 @@ ProcXF86VidModeGetGammaRampSize(ClientPtr client)
 
     REQUEST(xXF86VidModeGetGammaRampSizeReq);
 
+    REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
-
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
@@ -1564,11 +1564,11 @@ ProcXF86VidModeGetPermissions(ClientPtr client)
 
     REQUEST(xXF86VidModeGetPermissionsReq);
 
+    REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
-
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
commit 18863154bdb0f4ff79b2c79eae73ddd7a6ddc764
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:42 2012 -0700

    ProcRRGetScreenInfo: swap configTimestamp as well
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>
    (cherry picked from commit 15bc13c8d088e05f14c7262348e0066929c29251)

diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index c564d1f..a9c3f61 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -685,6 +685,7 @@ ProcRRGetScreenInfo(ClientPtr client)
         swaps(&rep.sequenceNumber);
         swapl(&rep.length);
         swapl(&rep.timestamp);
+        swapl(&rep.configTimestamp);
         swaps(&rep.rotation);
         swaps(&rep.nSizes);
         swaps(&rep.sizeID);
commit abffc882af655d2c8434e6eb7374dda472d6a8b0
Author: Jaroslav Šmíd <jardasmid at gmail.com>
Date:   Mon Jul 9 19:12:42 2012 -0700

    Bug 51375: Xorg doesn't set status for RRGetOutputInfo
    
    https://bugs.freedesktop.org/show_bug.cgi?id=51375
    https://bugs.freedesktop.org/attachment.cgi?id=63397
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>
    (cherry picked from commit 3a013b8816bc0bb765c99e8a2bf2ea536dc62c3b)

diff --git a/randr/rroutput.c b/randr/rroutput.c
index fbd0e32..cd6b365 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -426,6 +426,7 @@ ProcRRGetOutputInfo(ClientPtr client)
     pScrPriv = rrGetScrPriv(pScreen);
 
     rep.type = X_Reply;
+    rep.status = RRSetConfigSuccess;
     rep.sequenceNumber = client->sequence;
     rep.length = bytes_to_int32(OutputInfoExtra);
     rep.timestamp = pScrPriv->lastSetTime.milliseconds;
commit 5c6c4fc0820b4f7845ec43a1b784fa566713e566
Author: Keith Packard <keithp at keithp.com>
Date:   Mon Jul 9 16:29:04 2012 -0700

    Add 'install-headers' target in the top-level Makefile
    
    This target recursively locates directories with sdk headers and
    installs them all. Useful when you want to build a complete new X
    server and drivers without having to install the X server before the
    drivers are actually working.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit d1c639c006526b8cab14dac582508f3f54848967)

diff --git a/Makefile.am b/Makefile.am
index cea140b..9a62853 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -95,3 +95,10 @@ DIST_SUBDIRS = \
 # gross hack
 relink: all
 	$(AM_V_at)$(MAKE) -C hw relink
+
+install-headers: Makefile
+	+find . -name Makefile | while read m; do			\
+		if grep -q install-sdkHEADERS $$m; then			\
+			(cd `dirname "$$m"` && make install-sdkHEADERS)	\
+		fi							\
+	done
commit 4060ebfea066693f9d9dd5fab63278ebd4951533
Author: Dave Airlie <airlied at redhat.com>
Date:   Tue Jun 19 16:01:08 2012 +0100

    xf86: cursor code got mangled by indenting
    
    This fixes some really ugly code that got mangled by the indenting.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    (cherry picked from commit 2c52d776a42a28bb3e1463edf0cfe0672d0c08a9)

diff --git a/hw/xfree86/ramdac/xf86Cursor.c b/hw/xfree86/ramdac/xf86Cursor.c
index 678d2be..4a4def5 100644
--- a/hw/xfree86/ramdac/xf86Cursor.c
+++ b/hw/xfree86/ramdac/xf86Cursor.c
@@ -336,28 +336,19 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs,
         if (!infoPtr->pScrn->vtSema)
             ScreenPriv->SavedCursor = pCurs;
 
-        if (infoPtr->pScrn->vtSema && (ScreenPriv->ForceHWCursorCount || ((
+        if (infoPtr->pScrn->vtSema &&
+            (ScreenPriv->ForceHWCursorCount ||
+             ((
 #ifdef ARGB_CURSOR
-                                                                              pCurs->
-                                                                              bits->
-                                                                              argb
-                                                                              &&
-                                                                              infoPtr->
-                                                                              UseHWCursorARGB
-                                                                              &&
-                                                                              (*infoPtr->
-                                                                               UseHWCursorARGB)
-                                                                              (pScreen,
-                                                                               pCurs))
-                                                                          ||
-                                                                          (pCurs->
-                                                                           bits->
-                                                                           argb
-                                                                           == 0
-                                                                           &&
+               pCurs->bits->argb &&
+               infoPtr->UseHWCursorARGB &&
+               (*infoPtr->UseHWCursorARGB)(pScreen, pCurs)) ||
+              (pCurs->bits->argb == 0 &&
 #endif
-                                                                           (pCurs->bits->height <= infoPtr->MaxHeight) && (pCurs->bits->width <= infoPtr->MaxWidth) && (!infoPtr->UseHWCursor || (*infoPtr->UseHWCursor) (pScreen, pCurs)))))) {
-
+               (pCurs->bits->height <= infoPtr->MaxHeight) &&
+               (pCurs->bits->width <= infoPtr->MaxWidth) &&
+               (!infoPtr->UseHWCursor || (*infoPtr->UseHWCursor) (pScreen, pCurs)))))) {
+            
             if (ScreenPriv->SWCursor)   /* remove the SW cursor */
                 (*ScreenPriv->spriteFuncs->SetCursor) (pDev, pScreen,
                                                        NullCursor, x, y);
commit 31ca2e2d5d2f26826fe15d4537a57e1cbf863140
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Jul 5 16:17:56 2012 +1000

    list.h: don't crash when removing an element from a NULL list
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 167993254a5cbe11a1f44fad1e8ae042089c1619)

diff --git a/include/list.h b/include/list.h
index 96c0bcb..d54a207 100644
--- a/include/list.h
+++ b/include/list.h
@@ -453,7 +453,7 @@ xorg_list_is_empty(struct xorg_list *head)
 #define nt_list_del(_entry, _list, _type, _member)		\
 	do {							\
 		_type *__e = _entry;				\
-		if (__e == NULL) break;				\
+		if (__e == NULL || _list == NULL) break;        \
 		if ((_list) == __e) {				\
 		    _list = __e->_member;			\
 		} else {					\
commit 7197c1c571dab1ecef2dc57b8e3bd2689b589f6d
Author: Michal Srb <msrb at suse.com>
Date:   Thu Jun 28 17:17:12 2012 +0200

    Look for ModuleData only in appropriate library
    
    LoaderSymbol calls dlsym with RTLD_DEFAULT pseudo handle making it search in
    every loaded library. In addition glibc adds NODELETE flag to the library
    containing the symbol.
    
    It's used in doLoadModule to locate <modulename>ModuleData symbol, the
    module's library gets the flag and is kept in memory even after it is
    unloaded.
    
    This patch adds LoaderSymbolFromModule function that looks for symbol only in
    library specified by handle. That way the NODELETE flag isn't added.
    
    This glibc behavior doesn't seem to be documented, but even if other
    implementations differ, there is no reason to search ModuleData symbol outside
    the module's library.
    
    Signed-off-by: Michal Srb <msrb at suse.com>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    
    v2: Switch LoaderSymbolFromModule arguments order.
        Correct description.
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 258abbf823f753757e4dddc13ef495f4024680db)

diff --git a/hw/xfree86/loader/loader.c b/hw/xfree86/loader/loader.c
index b72b8b8..4836964 100644
--- a/hw/xfree86/loader/loader.c
+++ b/hw/xfree86/loader/loader.c
@@ -160,6 +160,12 @@ LoaderSymbol(const char *name)
     return NULL;
 }
 
+void *
+LoaderSymbolFromModule(void *handle, const char *name)
+{
+    return dlsym(handle, name);
+}
+
 void
 LoaderUnload(const char *name, void *handle)
 {
diff --git a/hw/xfree86/loader/loader.h b/hw/xfree86/loader/loader.h
index 5cadd5a..c89c641 100644
--- a/hw/xfree86/loader/loader.h
+++ b/hw/xfree86/loader/loader.h
@@ -72,5 +72,6 @@ extern unsigned long LoaderOptions;
 
 /* Internal Functions */
 void *LoaderOpen(const char *, int *, int *);
+void *LoaderSymbolFromModule(void *, const char *);
 
 #endif                          /* _LOADER_H */
diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index c6b5590..6fa9554 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -938,7 +938,7 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
             *errmin = 0;
         goto LoadModule_fail;
     }
-    initdata = LoaderSymbol(p);
+    initdata = LoaderSymbolFromModule(ret->handle, p);
     if (initdata) {
         ModuleSetupProc setup;
         ModuleTearDownProc teardown;
commit b0e3696e01ec69e17b74164f4b366baef316f86c
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Jun 25 14:22:31 2012 +1000

    dix: fix dereference before null check
    
    Found by Coverity.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    (cherry picked from commit 55ff20eb37f00a3ad07b5acff19d4497ab513a97)

diff --git a/dix/touch.c b/dix/touch.c
index 04733ab..ad48d8a 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -160,11 +160,13 @@ TouchBeginDDXTouch(DeviceIntPtr dev, uint32_t ddx_id)
     int i;
     TouchClassPtr t = dev->touch;
     DDXTouchPointInfoPtr ti = NULL;
-    Bool emulate_pointer = (t->mode == XIDirectTouch);
+    Bool emulate_pointer;
 
     if (!t)
         return NULL;
 
+    emulate_pointer = (t->mode == XIDirectTouch);
+
     /* Look for another active touchpoint with the same DDX ID. DDX
      * touchpoints must be unique. */
     if (TouchFindByDDXID(dev, ddx_id, FALSE))
commit b99a4ac32cc613337af79eb130247364f478dd21
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Jun 20 14:25:54 2012 +1000

    xkb: use local variable instead of casting arg
    
    No functional changes.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 252a69b592001b34714d0fe7508e1898883f9d01)

diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c
index 765772b..e19ef30 100644
--- a/xkb/xkbAccessX.c
+++ b/xkb/xkbAccessX.c
@@ -281,12 +281,12 @@ AccessXStickyKeysTurnOff(DeviceIntPtr dev, xkbControlsNotify * pCN)
 static CARD32
 AccessXKRGExpire(OsTimerPtr timer, CARD32 now, pointer arg)
 {
-    XkbSrvInfoPtr xkbi = ((DeviceIntPtr) arg)->key->xkbInfo;
     xkbControlsNotify cn;
+    DeviceIntPtr dev = arg;
+    XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
 
     if (xkbi->krgTimerActive == _KRG_WARN_TIMER) {
-        XkbDDXAccessXBeep((DeviceIntPtr) arg, _BEEP_SLOW_WARN,
-                          XkbStickyKeysMask);
+        XkbDDXAccessXBeep(dev, _BEEP_SLOW_WARN, XkbStickyKeysMask);
         xkbi->krgTimerActive = _KRG_TIMER;
         return 4000;
     }
@@ -296,11 +296,11 @@ AccessXKRGExpire(OsTimerPtr timer, CARD32 now, pointer arg)
     cn.requestMajor = 0;
     cn.requestMinor = 0;
     if (xkbi->desc->ctrls->enabled_ctrls & XkbSlowKeysMask) {
-        AccessXKRGTurnOff((DeviceIntPtr) arg, &cn);
+        AccessXKRGTurnOff(dev, &cn);
         LogMessage(X_INFO, "XKB SlowKeys are disabled.\n");
     }
     else {
-        AccessXKRGTurnOn((DeviceIntPtr) arg, XkbSlowKeysMask, &cn);
+        AccessXKRGTurnOn(dev, XkbSlowKeysMask, &cn);
         LogMessage(X_INFO, "XKB SlowKeys are now enabled. Hold shift to disable.\n");
     }
 
commit 465a7a253ae36a35d2d85a990c6c50c2a26a861e
Author: Aaron Plattner <aplattner at nvidia.com>
Date:   Fri Jun 29 13:33:58 2012 -0700

    randr: Fix REQUEST vs. REQUEST_SIZE_MATCH mismatch
    
    ProcRRGetScreenSizeRange uses REQUEST(xRRGetScreenSizeRangeReq) followed by
    REQUEST_SIZE_MATCH(xRRGetScreenInfoReq).  This happens to work out because both
    requests have the same size, so this is not a functional change, just a cosmetic
    one.
    
    Signed-off-by: Aaron Plattner <aplattner at nvidia.com>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 212b9803238d2de2e77cbe5de62d3f616ae50daf)

diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index 55110e0..c564d1f 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -195,7 +195,7 @@ ProcRRGetScreenSizeRange(ClientPtr client)
     rrScrPrivPtr pScrPriv;
     int rc;
 
-    REQUEST_SIZE_MATCH(xRRGetScreenInfoReq);
+    REQUEST_SIZE_MATCH(xRRGetScreenSizeRangeReq);
     rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
     if (rc != Success)
         return rc;
commit 6f4b6bca4c8f823adf83519b40f02b39a0c271ed
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Jun 21 18:45:18 2012 -0700

    randr: Catch two more potential unset rrScrPriv uses
    
    Ricardo Salveti <ricardo.salveti at linaro.org> found one place where the
    randr code could use the randr screen private data without checking
    for null first. This happens when the X server is running with
    multiple screens, some of which are randr enabled and some of which
    are not. Applications making protocol requests to the non-randr
    screens can cause segfaults where the server touches the unset private
    structure.
    
    I audited the code and found two more possible problem spots; the
    trick to auditing for this issue was to look for functions not taking
    a RandR data structure and where there was no null screen private
    check above them in the call graph.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 855003c333a0ead1db912695bc9705ef2b3144b4)

diff --git a/randr/rroutput.c b/randr/rroutput.c
index 091e06b..fbd0e32 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -546,7 +546,8 @@ ProcRRSetOutputPrimary(ClientPtr client)
     }
 
     pScrPriv = rrGetScrPriv(pWin->drawable.pScreen);
-    RRSetPrimaryOutput(pWin->drawable.pScreen, pScrPriv, output);
+    if (pScrPriv)
+        RRSetPrimaryOutput(pWin->drawable.pScreen, pScrPriv, output);
 
     return Success;
 }
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index f570afa..55110e0 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -248,6 +248,9 @@ ProcRRSetScreenSize(ClientPtr client)
 
     pScreen = pWin->drawable.pScreen;
     pScrPriv = rrGetScrPriv(pScreen);
+    if (!pScrPriv)
+        return BadMatch;
+
     if (stuff->width < pScrPriv->minWidth || pScrPriv->maxWidth < stuff->width) {
         client->errorValue = stuff->width;
         return BadValue;
commit 47c61c56472f885e355f4b5e932f5282c1a7b1f5
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Jun 21 18:42:46 2012 -0700

    randr: Clean up compiler warnings about unused and shadowing variables
    
    set but not used variables
    shadowing a previous local
    
    A hidden problem was that the VERIFY_RR_* macros define local 'rc'
    variables, any other local definitions for those would be shadowed and
    generate warnings from gcc. I've renamed the other locals 'ret'
    instead of 'rc'.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 4ba340cfaa8d430c808566495f8deda0ff1b4424)

diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 36caa58..0c596dd 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -825,10 +825,9 @@ ProcRRSetCrtcConfig(ClientPtr client)
     int numOutputs;
     RROutputPtr *outputs = NULL;
     RROutput *outputIds;
-    TimeStamp configTime;
     TimeStamp time;
     Rotation rotation;
-    int rc, i, j;
+    int ret, i, j;
 
     REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigReq);
     numOutputs = (stuff->length - bytes_to_int32(SIZEOF(xRRSetCrtcConfigReq)));
@@ -855,11 +854,11 @@ ProcRRSetCrtcConfig(ClientPtr client)
 
     outputIds = (RROutput *) (stuff + 1);
     for (i = 0; i < numOutputs; i++) {
-        rc = dixLookupResourceByType((pointer *) (outputs + i), outputIds[i],
+        ret = dixLookupResourceByType((pointer *) (outputs + i), outputIds[i],
                                      RROutputType, client, DixSetAttrAccess);
-        if (rc != Success) {
+        if (ret != Success) {
             free(outputs);
-            return rc;
+            return ret;
         }
         /* validate crtc for this output */
         for (j = 0; j < outputs[i]->numCrtcs; j++)
@@ -904,7 +903,6 @@ ProcRRSetCrtcConfig(ClientPtr client)
     pScrPriv = rrGetScrPriv(pScreen);
 
     time = ClientTimeToServerTime(stuff->timestamp);
-    configTime = ClientTimeToServerTime(stuff->configTimestamp);
 
     if (!pScrPriv) {
         time = currentTime;
diff --git a/randr/rrinfo.c b/randr/rrinfo.c
index 114ec34..1408d6f 100644
--- a/randr/rrinfo.c
+++ b/randr/rrinfo.c
@@ -82,6 +82,7 @@ RRScanOldConfig(ScreenPtr pScreen, Rotation rotations)
     int i;
     CARD16 minWidth = MAXSHORT, minHeight = MAXSHORT;
     CARD16 maxWidth = 0, maxHeight = 0;
+    CARD16 width, height;
 
     /*
      * First time through, create a crtc and output and hook
@@ -141,11 +142,11 @@ RRScanOldConfig(ScreenPtr pScreen, Rotation rotations)
 
     /* find size bounds */
     for (i = 0; i < output->numModes + output->numUserModes; i++) {
-        RRModePtr mode = (i < output->numModes ?
+        mode = (i < output->numModes ?
                           output->modes[i] :
                           output->userModes[i - output->numModes]);
-        CARD16 width = mode->mode.width;
-        CARD16 height = mode->mode.height;
+        width = mode->mode.width;
+        height = mode->mode.height;
 
         if (width < minWidth)
             minWidth = width;
diff --git a/randr/rrmode.c b/randr/rrmode.c
index b637c06..49a45c7 100644
--- a/randr/rrmode.c
+++ b/randr/rrmode.c
@@ -173,7 +173,7 @@ RRModesForScreen(ScreenPtr pScreen, int *num_ret)
      */
     for (o = 0; o < pScrPriv->numOutputs; o++) {
         RROutputPtr output = pScrPriv->outputs[o];
-        int m, n;
+        int n;
 
         for (m = 0; m < output->numModes + output->numUserModes; m++) {
             RRModePtr mode = (m < output->numModes ?
@@ -285,7 +285,6 @@ ProcRRCreateMode(ClientPtr client)
     xRRCreateModeReply rep = { 0 };
     WindowPtr pWin;
     ScreenPtr pScreen;
-    rrScrPrivPtr pScrPriv;
     xRRModeInfo *modeInfo;
     long units_after;
     char *name;
@@ -298,7 +297,6 @@ ProcRRCreateMode(ClientPtr client)
         return rc;
 
     pScreen = pWin->drawable.pScreen;
-    pScrPriv = rrGetScrPriv(pScreen);
 
     modeInfo = &stuff->modeInfo;
     name = (char *) (stuff + 1);
diff --git a/randr/rroutput.c b/randr/rroutput.c
index 0890c55..091e06b 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -528,13 +528,13 @@ ProcRRSetOutputPrimary(ClientPtr client)
     RROutputPtr output = NULL;
     WindowPtr pWin;
     rrScrPrivPtr pScrPriv;
-    int rc;
+    int ret;
 
     REQUEST_SIZE_MATCH(xRRSetOutputPrimaryReq);
 
-    rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
-    if (rc != Success)
-        return rc;
+    ret = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
+    if (ret != Success)
+        return ret;
 
     if (stuff->output) {
         VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
commit ba0fe0092c25556e682d7b51fa94cafb75c00f3e
Author: Ricardo Salveti de Araujo <ricardo.salveti at linaro.org>
Date:   Thu Jun 21 00:55:53 2012 -0300

    randr: first check pScrPriv before using the pointer at RRFirstOutput
    
    Fix a seg fault in case pScrPriv is NULL at ProcRRGetScreenInfo,
    which later calls RRFirstOutput.
    
    Signed-off-by: Ricardo Salveti de Araujo <ricardo.salveti at linaro.org>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 32603f57ca03b6390b109960f8bb5ea53ac95ecb)

diff --git a/randr/randr.c b/randr/randr.c
index 5c1f70c..dbd3810 100644
--- a/randr/randr.c
+++ b/randr/randr.c
@@ -446,6 +446,9 @@ RRFirstOutput(ScreenPtr pScreen)
     RROutputPtr output;
     int i, j;
 
+    if (!pScrPriv)
+        return NULL;
+
     if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc)
         return pScrPriv->primaryOutput;
 
commit b348cfd4b85e10e1ff36344473758325201c3816
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Wed Jun 13 21:20:51 2012 -0700

    Remove obsolete tab stop comments from hw/xfree86/parser/*.c
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit ff541e0a1f84bd98966148793f35afeaf71c271b)

diff --git a/hw/xfree86/parser/Device.c b/hw/xfree86/parser/Device.c
index f27b56f..bb1ba88 100644
--- a/hw/xfree86/parser/Device.c
+++ b/hw/xfree86/parser/Device.c
@@ -52,8 +52,6 @@
  * authorization from the copyright holder(s) and author(s).
  */
 
-/* View/edit this file with tab stops set to 4 */
-
 #ifdef HAVE_XORG_CONFIG_H
 #include <xorg-config.h>
 #endif
diff --git a/hw/xfree86/parser/Files.c b/hw/xfree86/parser/Files.c
index d8152c0..0d3e47a 100644
--- a/hw/xfree86/parser/Files.c
+++ b/hw/xfree86/parser/Files.c
@@ -51,8 +51,6 @@
  * authorization from the copyright holder(s) and author(s).
  */
 
-/* View/edit this file with tab stops set to 4 */
-
 #ifdef HAVE_XORG_CONFIG_H
 #include <xorg-config.h>
 #endif
diff --git a/hw/xfree86/parser/Flags.c b/hw/xfree86/parser/Flags.c
index 29a60a2..2461476 100644
--- a/hw/xfree86/parser/Flags.c
+++ b/hw/xfree86/parser/Flags.c
@@ -51,8 +51,6 @@
  * authorization from the copyright holder(s) and author(s).
  */
 
-/* View/edit this file with tab stops set to 4 */
-
 #ifdef HAVE_XORG_CONFIG_H
 #include <xorg-config.h>
 #endif
diff --git a/hw/xfree86/parser/Input.c b/hw/xfree86/parser/Input.c
index 6e00734..ff2b9ac 100644
--- a/hw/xfree86/parser/Input.c
+++ b/hw/xfree86/parser/Input.c
@@ -52,8 +52,6 @@
  * authorization from the copyright holder(s) and author(s).
  */
 
-/* View/edit this file with tab stops set to 4 */
-
 #ifdef HAVE_XORG_CONFIG_H
 #include <xorg-config.h>
 #endif
diff --git a/hw/xfree86/parser/InputClass.c b/hw/xfree86/parser/InputClass.c
index 8493685..de6a816 100644
--- a/hw/xfree86/parser/InputClass.c
+++ b/hw/xfree86/parser/InputClass.c
@@ -23,8 +23,6 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
-/* View/edit this file with tab stops set to 4 */
-
 #ifdef HAVE_XORG_CONFIG_H
 #include <xorg-config.h>
 #endif
diff --git a/hw/xfree86/parser/Layout.c b/hw/xfree86/parser/Layout.c
index bd33d6d..cbd8d24 100644
--- a/hw/xfree86/parser/Layout.c
+++ b/hw/xfree86/parser/Layout.c
@@ -52,8 +52,6 @@
  * authorization from the copyright holder(s) and author(s).
  */
 
-/* View/edit this file with tab stops set to 4 */
-
 #ifdef HAVE_XORG_CONFIG_H
 #include <xorg-config.h>
 #endif
diff --git a/hw/xfree86/parser/Module.c b/hw/xfree86/parser/Module.c
index 1c458ae..87ddfc6 100644
--- a/hw/xfree86/parser/Module.c
+++ b/hw/xfree86/parser/Module.c
@@ -52,8 +52,6 @@
  * authorization from the copyright holder(s) and author(s).
  */
 
-/* View/edit this file with tab stops set to 4 */
-
 #ifdef HAVE_XORG_CONFIG_H
 #include <xorg-config.h>
 #endif
diff --git a/hw/xfree86/parser/Monitor.c b/hw/xfree86/parser/Monitor.c
index b237dfb..36b4ebe 100644
--- a/hw/xfree86/parser/Monitor.c
+++ b/hw/xfree86/parser/Monitor.c
@@ -52,8 +52,6 @@
  * authorization from the copyright holder(s) and author(s).
  */
 
-/* View/edit this file with tab stops set to 4 */
-
 #ifdef HAVE_XORG_CONFIG_H
 #include <xorg-config.h>
 #endif
diff --git a/hw/xfree86/parser/Pointer.c b/hw/xfree86/parser/Pointer.c
index cdbc09c..ff748d9 100644
--- a/hw/xfree86/parser/Pointer.c
+++ b/hw/xfree86/parser/Pointer.c
@@ -52,8 +52,6 @@
  * authorization from the copyright holder(s) and author(s).
  */
 
-/* View/edit this file with tab stops set to 4 */
-
 #ifdef HAVE_XORG_CONFIG_H
 #include <xorg-config.h>
 #endif
diff --git a/hw/xfree86/parser/Screen.c b/hw/xfree86/parser/Screen.c
index 71778d8..f294ec4 100644
--- a/hw/xfree86/parser/Screen.c
+++ b/hw/xfree86/parser/Screen.c
@@ -52,8 +52,6 @@
  * authorization from the copyright holder(s) and author(s).
  */
 
-/* View/edit this file with tab stops set to 4 */
-
 #ifdef HAVE_XORG_CONFIG_H
 #include <xorg-config.h>
 #endif
diff --git a/hw/xfree86/parser/Vendor.c b/hw/xfree86/parser/Vendor.c
index b4e2165..9b7695c 100644
--- a/hw/xfree86/parser/Vendor.c
+++ b/hw/xfree86/parser/Vendor.c
@@ -52,8 +52,6 @@
  * authorization from the copyright holder(s) and author(s).
  */
 
-/* View/edit this file with tab stops set to 4 */
-
 #ifdef HAVE_XORG_CONFIG_H
 #include <xorg-config.h>
 #endif
diff --git a/hw/xfree86/parser/Video.c b/hw/xfree86/parser/Video.c
index fc1f1e5..68d611a 100644
--- a/hw/xfree86/parser/Video.c
+++ b/hw/xfree86/parser/Video.c
@@ -52,8 +52,6 @@
  * authorization from the copyright holder(s) and author(s).
  */
 
-/* View/edit this file with tab stops set to 4 */
-
 #ifdef HAVE_XORG_CONFIG_H
 #include <xorg-config.h>
 #endif
diff --git a/hw/xfree86/parser/read.c b/hw/xfree86/parser/read.c
index eef873e..6545bcd 100644
--- a/hw/xfree86/parser/read.c
+++ b/hw/xfree86/parser/read.c
@@ -52,8 +52,6 @@
  * authorization from the copyright holder(s) and author(s).
  */
 
-/* View/edit this file with tab stops set to 4 */
-
 #ifdef HAVE_XORG_CONFIG_H
 #include <xorg-config.h>
 #endif
diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
index 795da61..f852b83 100644
--- a/hw/xfree86/parser/scan.c
+++ b/hw/xfree86/parser/scan.c
@@ -51,8 +51,6 @@
  * authorization from the copyright holder(s) and author(s).
  */
 
-/* View/edit this file with tab stops set to 4 */
-
 #ifdef HAVE_XORG_CONFIG_H
 #include <xorg-config.h>
 #endif
diff --git a/hw/xfree86/parser/write.c b/hw/xfree86/parser/write.c
index c001c3d..9c706a0 100644
--- a/hw/xfree86/parser/write.c
+++ b/hw/xfree86/parser/write.c
@@ -51,8 +51,6 @@
  * authorization from the copyright holder(s) and author(s).
  */
 
-/* View/edit this file with tab stops set to 4 */
-
 #ifdef HAVE_XORG_CONFIG_H
 #include <xorg-config.h>
 #endif
commit 94c7d0f8b979ccadd8e5c95f030b8b2cd7ef6f98
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Tue Jun 12 22:38:46 2012 -0700

    Fix some overly indented/poorly line wrapped comments in dix/events.c
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 687536b1044a3297f6b9a45f6a2d2987daa7be59)

diff --git a/dix/events.c b/dix/events.c
index 64edf18..822b6e9 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -4336,12 +4336,10 @@ EventSelectForWindow(WindowPtr pWin, ClientPtr client, Mask mask)
             return rc;
     }
     check = (mask & AtMostOneClient);
-    if (check & (pWin->eventMask | wOtherEventMasks(pWin))) {   /* It is illegal for two different
-                                                                   clients to select on any of the
-                                                                   events for AtMostOneClient. However,
-                                                                   it is OK, for some client to
-                                                                   continue selecting on one of those
-                                                                   events.  */
+    if (check & (pWin->eventMask | wOtherEventMasks(pWin))) {
+        /* It is illegal for two different clients to select on any of the
+           events for AtMostOneClient. However, it is OK, for some client to
+           continue selecting on one of those events.  */
         if ((wClient(pWin) != client) && (check & pWin->eventMask))
             return BadAccess;
         for (others = wOtherClients(pWin); others; others = others->next) {
@@ -5621,8 +5619,8 @@ DeleteWindowFromAnyEvents(WindowPtr pWin, Bool freeResources)
         if (IsKeyboardDevice(keybd)) {
             focus = keybd->focus;
 
-            /* If the focus window is a root window (ie. has no parent) then don't
-               delete the focus from it. */
+            /* If the focus window is a root window (ie. has no parent)
+               then don't delete the focus from it. */
 
             if ((pWin == focus->win) && (pWin->parent != NullWindow)) {
                 int focusEventMode = NotifyNormal;
@@ -5644,12 +5642,12 @@ DeleteWindowFromAnyEvents(WindowPtr pWin, Bool freeResources)
                         parent = parent->parent;
                         focus->traceGood--;
                     } while (!parent->realized
-                             /* This would be a good protocol change -- windows being reparented
-                                during SaveSet processing would cause the focus to revert to the
-                                nearest enclosing window which will survive the death of the exiting
-                                client, instead of ending up reverting to a dying window and thence
-                                to None
-                              */
+                    /* This would be a good protocol change -- windows being
+                       reparented during SaveSet processing would cause the
+                       focus to revert to the nearest enclosing window which
+                       will survive the death of the exiting client, instead
+                       of ending up reverting to a dying window and thence
+                       to None */
 #ifdef NOTDEF
                              || wClient(parent)->clientGone
 #endif
commit 49bb2694f10149fbd27c04375939dcfe7cde1e4e
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Tue Jun 12 22:29:51 2012 -0700

    OtherClientGone: Remove unreachable return statement
    
    Now that FatalError is marked as _X_NORETURN, the compilers know we
    can't get here, and the return statement added to make them happy in
    the past now makes them unhappy.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 93a378aad4a4a03f37ddafccfedeb9d6e2be2a6a)

diff --git a/dix/events.c b/dix/events.c
index 86336fe..64edf18 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -4314,7 +4314,6 @@ OtherClientGone(pointer value, XID id)
         prev = other;
     }
     FatalError("client not on event list");
-     /*NOTREACHED*/ return -1;  /* make compiler happy */
 }
 
 int
commit e08f1c261c75d50a3581e8791700436cba6e4b21
Author: Julien Cristau <jcristau at debian.org>
Date:   Mon Jul 30 19:24:38 2012 +0200

    Bump video ABI version to 12.1
    
    Track the addition of DRI2CreateDrawable2.
    
    Signed-off-by: Julien Cristau <jcristau at debian.org>

diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h
index 894b93f..0036c59 100644
--- a/hw/xfree86/common/xf86Module.h
+++ b/hw/xfree86/common/xf86Module.h
@@ -82,7 +82,7 @@ typedef enum {
  * mask is 0xFFFF0000.
  */
 #define ABI_ANSIC_VERSION	SET_ABI_VERSION(0, 4)
-#define ABI_VIDEODRV_VERSION	SET_ABI_VERSION(12, 0)
+#define ABI_VIDEODRV_VERSION	SET_ABI_VERSION(12, 1)
 #define ABI_XINPUT_VERSION	SET_ABI_VERSION(16, 0)
 #define ABI_EXTENSION_VERSION	SET_ABI_VERSION(6, 0)
 #define ABI_FONT_VERSION	SET_ABI_VERSION(0, 6)
commit 953c8df9fb7515f70ee6dac7e210e909d26e1490
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Thu Jul 12 13:16:37 2012 +0200

    glx: Free DRI2 drawable reference to destroyed GLX drawable.
    
    Otherwise the reference can lead to use after free in
    __glXDRIinvalidateBuffers().
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50019
    
    Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
    Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit a2d0829531249e24dbca25fc20ed30a2bb2d8ed8)
    
    Signed-off-by: Julien Cristau <jcristau at debian.org>

diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index aa38295..29af190 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -95,6 +95,7 @@ struct __GLXDRIdrawable {
     int height;
     __DRIbuffer buffers[MAX_DRAWABLE_BUFFERS];
     int count;
+    XID dri2_id;
 };
 
 static void
@@ -103,6 +104,8 @@ __glXDRIdrawableDestroy(__GLXdrawable * drawable)
     __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
     const __DRIcoreExtension *core = private->screen->core;
 
+    FreeResource(private->dri2_id, FALSE);
+
     (*core->destroyDrawable) (private->driDrawable);
 
     __glXDrawableRelease(drawable);
@@ -456,8 +459,9 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
     private->base.waitGL = __glXDRIdrawableWaitGL;
     private->base.waitX = __glXDRIdrawableWaitX;
 
-    if (DRI2CreateDrawable(client, pDraw, drawId,
-                           __glXDRIinvalidateBuffers, private)) {
+    if (DRI2CreateDrawable2(client, pDraw, drawId,
+                            __glXDRIinvalidateBuffers, private,
+                            &private->dri2_id)) {
         free(private);
         return NULL;
     }
commit 60da5029634ca6258e4e2924ed204096437a0503
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Thu Jul 12 13:16:36 2012 +0200

    dri2: Add DRI2CreateDrawable2.
    
    Same as DRI2CreateDrawable, except it can return the DRI2 specific XID of the
    DRI2 drawable reference to the base drawable.
    
    Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
    Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 8a87acc9e57be740e3bd252567622246051a0723)
    
    Signed-off-by: Julien Cristau <jcristau at debian.org>

diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 591ff3a..156d498 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -280,8 +280,9 @@ DRI2AddDrawableRef(DRI2DrawablePtr pPriv, XID id, XID dri2_id,
 }
 
 int
-DRI2CreateDrawable(ClientPtr client, DrawablePtr pDraw, XID id,
-                   DRI2InvalidateProcPtr invalidate, void *priv)
+DRI2CreateDrawable2(ClientPtr client, DrawablePtr pDraw, XID id,
+                    DRI2InvalidateProcPtr invalidate, void *priv,
+                    XID *dri2_id_out)
 {
     DRI2DrawablePtr pPriv;
     XID dri2_id;
@@ -298,9 +299,19 @@ DRI2CreateDrawable(ClientPtr client, DrawablePtr pDraw, XID id,
     if (rc != Success)
         return rc;
 
+    if (dri2_id_out)
+        *dri2_id_out = dri2_id;
+
     return Success;
 }
 
+int
+DRI2CreateDrawable(ClientPtr client, DrawablePtr pDraw, XID id,
+                   DRI2InvalidateProcPtr invalidate, void *priv)
+{
+    return DRI2CreateDrawable2(client, pDraw, id, invalidate, priv, NULL);
+}
+
 static int
 DRI2DrawableGone(pointer p, XID id)
 {
diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h
index 204fec5..06546bb 100644
--- a/hw/xfree86/dri2/dri2.h
+++ b/hw/xfree86/dri2/dri2.h
@@ -235,6 +235,13 @@ extern _X_EXPORT int DRI2CreateDrawable(ClientPtr client,
                                         DRI2InvalidateProcPtr invalidate,
                                         void *priv);
 
+extern _X_EXPORT int DRI2CreateDrawable2(ClientPtr client,
+                                         DrawablePtr pDraw,
+                                         XID id,
+                                         DRI2InvalidateProcPtr invalidate,
+                                         void *priv,
+                                         XID *dri2_id_out);
+
 extern _X_EXPORT DRI2BufferPtr *DRI2GetBuffers(DrawablePtr pDraw,
                                                int *width,
                                                int *height,
commit cdeb178cd020bbbd0ebbdb512de1d1d16474858a
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Tue Jul 10 02:03:17 2012 +0100

    DRI2: Remove prototype for DRI2DestroyDrawable
    
    DRI2DestroyDrawable() was still being _X_EXPORTed, but hasn't existed
    since 1da1f33f last year.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Cyril Brulebois <kibi at debian.org>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit b8a3267c36e2e335b888bd4f2ef2f2c477cdfdce)
    
    Signed-off-by: Julien Cristau <jcristau at debian.org>

diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h
index 00b3668..204fec5 100644
--- a/hw/xfree86/dri2/dri2.h
+++ b/hw/xfree86/dri2/dri2.h
@@ -235,8 +235,6 @@ extern _X_EXPORT int DRI2CreateDrawable(ClientPtr client,
                                         DRI2InvalidateProcPtr invalidate,
                                         void *priv);
 
-extern _X_EXPORT void DRI2DestroyDrawable(DrawablePtr pDraw);
-
 extern _X_EXPORT DRI2BufferPtr *DRI2GetBuffers(DrawablePtr pDraw,
                                                int *width,
                                                int *height,


More information about the Xquartz-changes mailing list