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

Jeremy Huddleston jeremyhu at freedesktop.org
Tue Apr 24 00:41:42 PDT 2012


Rebased ref, commits from common ancestor:
commit 2e2f3d9e7d79573291954566cf4e41aefaf92b35
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 fbef6bd1ecd4062592a4c1e764dd4a05bec71b4c
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 dbb29ca..93fd8a1 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 e081be4cf029630eab90e69bf413c744d2138813
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 72be889..c0b81c3 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 79208839a9bac904326e4949e5b3e194fb073cbf
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 7fd3d16..7724b8c 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;
@@ -1074,6 +1075,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 317d199..03030ad 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
@@ -663,7 +665,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
 void
 OsVendorFatalError(const char *f, va_list args)
 {
-    ErrorF("   OsVendorFatalError\n");
+    X11ApplicationFatalError(f, args);
 }
 
 /*
commit 10a4d5713e6ef6ad719597e453ac3ea927b13739
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 d913449..501fd45 100644
--- a/os/log.c
+++ b/os/log.c
@@ -596,6 +596,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 fa597bbb45fcdc230e0821e02c43e949892f20f7
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 b56bb93..33aee59 100644
--- a/hw/dmx/dmxlog.c
+++ b/hw/dmx/dmxlog.c
@@ -110,9 +110,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 f65ab96..ecdae19 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 0974893..2a7d0a3 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1053,7 +1053,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 2d5174a..317d199 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -661,7 +661,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 0ccd126..d913449 100644
--- a/os/log.c
+++ b/os/log.c
@@ -588,6 +588,7 @@ void
 FatalError(const char *f, ...)
 {
     va_list args;
+    va_list args2;
     static Bool beenhere = FALSE;
 
     if (beenhere)
@@ -595,22 +596,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 38e73f7fc29fe8e9defa8a0516a50ac3a84e10c2
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Apr 13 15:44:08 2012 -0700

    configure.ac: Bump to 1.12.1
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/configure.ac b/configure.ac
index b26da71..a12783c 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.0.902, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2012-04-09"
+AC_INIT([xorg-server], 1.12.1, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2012-04-13"
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
commit d603515dbfef94ec9cf7f5538815a954511e9e70
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Mon Apr 9 19:37:31 2012 -0700

    configure.ac: Bump to 1.12.0.902 (1.12.1 RC2)
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/configure.ac b/configure.ac
index cc21fd8..b26da71 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.0.901, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2012-03-30"
+AC_INIT([xorg-server], 1.12.0.902, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2012-04-09"
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
commit 7e62bc31c65aedcdf55cd7dc02b349b6b5c0812c
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Sat Apr 7 15:26:53 2012 -0700

    test: Fix make dist
    
    I don't know why this fixes the problem with make dist, but it does...
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/test/Makefile.am b/test/Makefile.am
index eb61470..32be00d 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -53,8 +53,6 @@ libxservertest_la_LIBADD += \
             $(top_builddir)/hw/xfree86/dixmods/libxorgxkb.la \
             @XORG_LIBS@
 
-EXTRA_DIST = ddxstubs.c
-
 else
 nodist_libxservertest_la_SOURCES = \
             ddxstubs.c \
@@ -110,3 +108,6 @@ endif
 
 libxservertest_la_DEPENDENCIES = $(libxservertest_la_LIBADD)
 endif
+
+EXTRA_DIST = ddxstubs.c
+
commit ad89533327919223204021738dd108d7dd814e8c
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Mon Apr 9 19:36:04 2012 -0700

    Revert "xfree86: workaround crash on close"
    
    This reverts commit b704d9146336c3044be2be7ae38ce2c5b5a47f86.
    
    This was causing some regressions.  Reverting as discussed on xorg-devel.

diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c
index f9602fa..85d7557 100644
--- a/hw/xfree86/modes/xf86Rotate.c
+++ b/hw/xfree86/modes/xf86Rotate.c
@@ -272,7 +272,6 @@ xf86RotateDestroy(xf86CrtcPtr crtc)
     ScrnInfoPtr pScrn = crtc->scrn;
     ScreenPtr pScreen = pScrn->pScreen;
     xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
-    DrawablePtr screenDrawable = &pScreen->root->drawable;
     int c;
 
     /* Free memory from rotation */
@@ -290,7 +289,7 @@ xf86RotateDestroy(xf86CrtcPtr crtc)
     /*
      * Clean up damage structures when no crtcs are rotated
      */
-    if (screenDrawable && xf86_config->rotation_damage) {
+    if (xf86_config->rotation_damage) {
         /* Free damage structure */
         if (xf86_config->rotation_damage_registered) {
             DamageUnregister(&pScreen->root->drawable,
commit 259aa5a69b69aa72be3fb7402b68560f9a6b05d6
Author: Chase Douglas <chase.douglas at canonical.com>
Date:   Thu Mar 29 18:06:03 2012 -0700

    Implement passive touch ungrabbing
    
    Whoops. Forgot to implement this. The code currently generates an error
    due to the unhandled grab type.
    
    X.Org Bug 48069 <https://bugs.freedesktop.org/show_bug.cgi?id=48069>
    
    Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 1110facdfeb95b1ad47d03c0ca3d73933b86dbd6)

diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c
index 8a1c599..7130328 100644
--- a/Xi/xipassivegrab.c
+++ b/Xi/xipassivegrab.c
@@ -290,13 +290,15 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
     if (stuff->grab_type != XIGrabtypeButton &&
         stuff->grab_type != XIGrabtypeKeycode &&
         stuff->grab_type != XIGrabtypeEnter &&
-        stuff->grab_type != XIGrabtypeFocusIn) {
+        stuff->grab_type != XIGrabtypeFocusIn &&
+        stuff->grab_type != XIGrabtypeTouchBegin) {
         client->errorValue = stuff->grab_type;
         return BadValue;
     }
 
     if ((stuff->grab_type == XIGrabtypeEnter ||
-         stuff->grab_type == XIGrabtypeFocusIn) && stuff->detail != 0) {
+         stuff->grab_type == XIGrabtypeFocusIn ||
+         stuff->grab_type == XIGrabtypeTouchBegin) && stuff->detail != 0) {
         client->errorValue = stuff->detail;
         return BadValue;
     }
@@ -327,6 +329,9 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
     case XIGrabtypeFocusIn:
         tempGrab->type = XI_FocusIn;
         break;
+    case XIGrabtypeTouchBegin:
+        tempGrab->type = XI_TouchBegin;
+        break;
     }
     tempGrab->grabtype = XI2;
     tempGrab->modifierDevice = mod_dev;
commit 42474e98ec4245c9e80fc0e9a4b287f3999324f2
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Thu Apr 5 14:03:35 2012 -0700

    XQuartz: Automatically start our virtual tablet devices
    
    Fixes: https://bugs.launchpad.net/inkscape/+bug/972914
    Regression introduced by: 7790dc86384cc451ac44663737fde84dd81ad4e1
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit e9d3848d7bda7f7de4c0f497aee4482d0b30ad49)

diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index ff6581c..2d5174a 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -539,15 +539,15 @@ InitInput(int argc, char **argv)
        gdkdev->info.source = GDK_SOURCE_PEN;
      */
 
-    darwinTabletStylus = AddInputDevice(serverClient, DarwinTabletProc, FALSE);
+    darwinTabletStylus = AddInputDevice(serverClient, DarwinTabletProc, TRUE);
     assert(darwinTabletStylus);
     darwinTabletStylus->name = strdup("pen");
 
-    darwinTabletCursor = AddInputDevice(serverClient, DarwinTabletProc, FALSE);
+    darwinTabletCursor = AddInputDevice(serverClient, DarwinTabletProc, TRUE);
     assert(darwinTabletCursor);
     darwinTabletCursor->name = strdup("cursor");
 
-    darwinTabletEraser = AddInputDevice(serverClient, DarwinTabletProc, FALSE);
+    darwinTabletEraser = AddInputDevice(serverClient, DarwinTabletProc, TRUE);
     assert(darwinTabletEraser);
     darwinTabletEraser->name = strdup("eraser");
 
commit 4b3ac1b563c3de32ad13e794fefabd5124648393
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Mar 30 14:29:48 2012 -0700

    XQuartz: Tiger build fix
    
    Fixes: https://trac.macports.org/ticket/33818
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit 6cb83b78c47b80556cb4d573524d60f0cd1a64ac)

diff --git a/hw/xquartz/mach-startup/Makefile.am b/hw/xquartz/mach-startup/Makefile.am
index 21ad5b5..77962b1 100644
--- a/hw/xquartz/mach-startup/Makefile.am
+++ b/hw/xquartz/mach-startup/Makefile.am
@@ -23,7 +23,7 @@ nodist_X11_bin_SOURCES = \
 	mach_startupServer.c \
 	mach_startupUser.c
 
-X11_bin_LDADD = \
+X11_bin_DEPENDENCIES = \
 	$(top_builddir)/hw/xquartz/libXquartz.la \
 	$(top_builddir)/hw/xquartz/xpr/libXquartzXpr.la \
 	$(top_builddir)/dix/dixfonts.lo \
@@ -31,8 +31,12 @@ X11_bin_LDADD = \
 	$(top_builddir)/hw/xquartz/pbproxy/libxpbproxy.la \
 	$(XQUARTZ_LIBS) $(XSERVER_LIBS)
 
+# $(XSERVER_SYS_LIBS) is placed here in order to set command line ordering
+# to work around build issues on Tiger.
+X11_bin_LDADD = $(X11_bin_DEPENDENCIES) $(XSERVER_SYS_LIBS)
+
 X11_bin_LDFLAGS =  \
-	$(XSERVER_SYS_LIBS) -lXplugin \
+	-lXplugin \
 	-XCClinker -Objc \
 	-Wl,-u,_miDCInitialize \
 	-Wl,-framework,Carbon \
@@ -41,7 +45,7 @@ X11_bin_LDFLAGS =  \
 	-Wl,-framework,IOKit
 
 if GLX
-X11_bin_LDADD += \
+X11_bin_DEPENDENCIES += \
 	$(top_builddir)/hw/xquartz/GL/libCGLCore.la \
 	$(top_builddir)/glx/libglx.la
 
@@ -55,12 +59,10 @@ X11_bin_LDFLAGS += \
 endif
 
 if RECORD
-X11_bin_LDADD += \
+X11_bin_DEPENDENCIES += \
 	$(top_builddir)/record/librecord.la
 endif
 
-X11_bin_DEPENDENCIES = $(X11_bin_LDADD)
-
 bin_PROGRAMS = Xquartz
 
 dist_Xquartz_SOURCES = \
commit b704d9146336c3044be2be7ae38ce2c5b5a47f86
Author: Michal Suchanek <hramrach at gmail.com>
Date:   Wed Mar 28 18:12:39 2012 -0700

    xfree86: workaround crash on close
    
    Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=41653
    
    Signed-off-by: Michal Suchanek <hramrach at gmail.com>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    (cherry picked from commit 55f552adb651715d2620db7248cd5b9b8187654a)

diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c
index 85d7557..f9602fa 100644
--- a/hw/xfree86/modes/xf86Rotate.c
+++ b/hw/xfree86/modes/xf86Rotate.c
@@ -272,6 +272,7 @@ xf86RotateDestroy(xf86CrtcPtr crtc)
     ScrnInfoPtr pScrn = crtc->scrn;
     ScreenPtr pScreen = pScrn->pScreen;
     xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+    DrawablePtr screenDrawable = &pScreen->root->drawable;
     int c;
 
     /* Free memory from rotation */
@@ -289,7 +290,7 @@ xf86RotateDestroy(xf86CrtcPtr crtc)
     /*
      * Clean up damage structures when no crtcs are rotated
      */
-    if (xf86_config->rotation_damage) {
+    if (screenDrawable && xf86_config->rotation_damage) {
         /* Free damage structure */
         if (xf86_config->rotation_damage_registered) {
             DamageUnregister(&pScreen->root->drawable,
commit 391f75e87515fcc89b8e5cd058401c4a056d9139
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Fri Mar 30 16:01:57 2012 -0700

    configure.ac: Bump to 1.12.0.901 (1.12.1 RC1)
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/configure.ac b/configure.ac
index 2693ce7..cc21fd8 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.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2012-03-04"
+AC_INIT([xorg-server], 1.12.0.901, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2012-03-30"
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
commit 5eb20062208177172ff3443e522096a2e8f2f1e8
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Mar 21 14:05:29 2012 +1000

    dix: set raw event values before adding up relative values (#46976)
    
    Regression introduced in 4e52cc0ef48145134cd58d357fb7289e6f8bb709
    
    Raw event values are values as-is from the driver, modified only be
    transformation or acceleration. 4e52cc caused the mask to be updated from
    relative to absolute coordinates which then got written into the raw events.
    
    Move the raw event update into the respective branches for absolute/relative
    events.
    
    X.Org Bug 46976 <http://bugs.freedesktop.org/show_bug.cgi?id=46976>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Tested-by: Sven Arvidsson <sa at whiz.se>
    Reviewed-by: Simon Thum <simon.thum at gmx.de>
    (cherry picked from commit 908ab3d580188533168c8cdfd2cab9dc689b4218)

diff --git a/dix/getevents.c b/dix/getevents.c
index 260955b..fa85fe7 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -1314,18 +1314,19 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type,
 
         transformAbsolute(pDev, &mask);
         clipAbsolute(pDev, &mask);
+        if ((flags & POINTER_NORAW) == 0)
+            set_raw_valuators(raw, &mask, raw->valuators.data);
     }
     else {
         if (flags & POINTER_ACCELERATE)
             accelPointer(pDev, &mask, ms);
+        if ((flags & POINTER_NORAW) == 0)
+            set_raw_valuators(raw, &mask, raw->valuators.data);
+
         moveRelative(pDev, &mask);
     }
 
     /* valuators are in device coordinate system in absolute coordinates */
-
-    if ((flags & POINTER_NORAW) == 0)
-        set_raw_valuators(raw, &mask, raw->valuators.data);
-
     scale_to_desktop(pDev, &mask, &devx, &devy, &screenx, &screeny);
     scr = positionSprite(pDev, (flags & POINTER_ABSOLUTE) ? Absolute : Relative,
                          &mask, &devx, &devy, &screenx, &screeny);
commit a095f7ae96a353073add83e78f88f29d854d289d
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Mar 21 14:03:27 2012 +1000

    dix: fix compiler warning "unused variable 'scr'"
    
    getevents.c: In function 'updateSlaveDeviceCoords':
    getevents.c:326:15: warning: unused variable 'scr' [-Wunused-variable]
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 9c3bd3ae652af386b6821b197d24528f20ba867d)

diff --git a/dix/getevents.c b/dix/getevents.c
index 68bf58c..260955b 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -328,7 +328,6 @@ rescaleValuatorAxis(double coord, AxisInfoPtr from, AxisInfoPtr to,
 static void
 updateSlaveDeviceCoords(DeviceIntPtr master, DeviceIntPtr pDev)
 {
-    ScreenPtr scr = miPointerGetScreen(pDev);
     int i;
     DeviceIntPtr lastSlave;
 
commit d0a6d9bcefaf56aa63708ea69e5c399dbf266d63
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Mar 12 16:26:29 2012 +1000

    Xext: drop InitServertime() declaration.
    
    Not implemented anywhere.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Bryce Harrington <bryce at canonical.com>
    (cherry picked from commit 5910f2df58beaae2187438fef0b62c29a563e853)

diff --git a/Xext/syncsrv.h b/Xext/syncsrv.h
index e7ef1f4..b0464b3 100644
--- a/Xext/syncsrv.h
+++ b/Xext/syncsrv.h
@@ -141,7 +141,5 @@ extern void SyncChangeCounter(SyncCounter * /* pCounter */ ,
 
 extern void SyncDestroySystemCounter(pointer pCounter);
 
-extern void InitServertime(void);
-
 extern void SyncExtensionInit(void);
 #endif                          /* _SYNCSRV_H_ */
commit f8446ad3d71cdf9c2200f5584bd156c629fe3c90
Author: Chase Douglas <chase.douglas at canonical.com>
Date:   Wed Mar 7 16:06:27 2012 -0800

    Use a new sprite trace for indirect touches when all touches have physically ended
    
    All touches of an indirect device, such as a trackpad, are sent to the
    same window set. When there are no active touches, a new window set is
    created; otherwise, the window set of an existing touch is copied.
    
    The current code checks for any logically active touches. This includes
    touches that have physically ended but are still logically active due to
    unhandled touch grabs. Instead, we want a new window set whenever there
    are no physically active touches.
    
    This change skips over logically active but pending end touches, which
    are touches that have physically ended.
    
    Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 31df08a449cf9b6e1740e1c02257997490630d93)

diff --git a/dix/touch.c b/dix/touch.c
index 5d7132e..0829b65 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -510,7 +510,8 @@ TouchBuildDependentSpriteTrace(DeviceIntPtr dev, SpritePtr sprite)
     /* All touches should have the same sprite trace, so find and reuse an
      * existing touch's sprite if possible, else use the device's sprite. */
     for (i = 0; i < t->num_touches; i++)
-        if (t->touches[i].sprite.spriteTraceGood > 0)
+        if (!t->touches[i].pending_finish &&
+            t->touches[i].sprite.spriteTraceGood > 0)
             break;
     if (i < t->num_touches)
         srcsprite = &t->touches[i].sprite;
commit 5a3ec826e653377e8b70e7553d1f0ca72210447c
Author: Chase Douglas <chase.douglas at canonical.com>
Date:   Wed Mar 7 16:06:26 2012 -0800

    Xi: Fix TouchEnd to TouchUpdate change for one accepted grab
    
    If there is only one listener of a touch, the listener is a grab, and is
    accepted before the touch has ended, the current code will not end the
    touch record when the touch does end.
    
    This change adds a listener state for when a touch is accepted but has
    not yet ended. We now keep the touch record alive in this state, but end
    it when the touch ends.
    
    Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 58427e08a4a36ce9e213e4b4fe5249d5db2c764d)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index a690a19..f681a8b 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1210,6 +1210,8 @@ ProcessTouchOwnershipEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
         /* Owner accepted after receiving end */
         if (ti->listeners[0].state == LISTENER_HAS_END)
             TouchEndTouch(dev, ti);
+        else
+            ti->listeners[0].state = LISTENER_HAS_ACCEPTED;
     }
     else {                      /* this is the very first ownership event for a grab */
         DeliverTouchEvents(dev, ti, (InternalEvent *) ev, ev->resource);
@@ -1730,7 +1732,11 @@ DeliverTouchBeginEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
     else {
         if (has_ownershipmask)
             TouchSendOwnershipEvent(dev, ti, 0, listener->listener);
-        state = LISTENER_IS_OWNER;
+
+        if (!has_ownershipmask || listener->type == LISTENER_REGULAR)
+            state = LISTENER_HAS_ACCEPTED;
+        else
+            state = LISTENER_IS_OWNER;
     }
     listener->state = state;
 
@@ -1759,20 +1765,22 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
         listener->state = LISTENER_HAS_END;
     }
     else if (TouchResourceIsOwner(ti, listener->listener)) {
+        Bool normal_end = !(ev->device_event.flags & TOUCH_ACCEPT);
+
         /* FIXME: what about early acceptance */
-        if (!(ev->device_event.flags & TOUCH_ACCEPT)) {
-            if (listener->state != LISTENER_HAS_END)
-                rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
-            listener->state = LISTENER_HAS_END;
-        }
+        if (normal_end && listener->state != LISTENER_HAS_END)
+            rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
+
         if ((ti->num_listeners > 1 ||
-             (listener->type == LISTENER_GRAB &&
-              xi2mask_isset(xi2mask, dev, XI_TouchOwnership))) &&
+             listener->state != LISTENER_HAS_ACCEPTED) &&
             (ev->device_event.flags & (TOUCH_ACCEPT | TOUCH_REJECT)) == 0) {
             ev->any.type = ET_TouchUpdate;
             ev->device_event.flags |= TOUCH_PENDING_END;
             ti->pending_finish = TRUE;
         }
+
+        if (normal_end)
+            listener->state = LISTENER_HAS_END;
     }
 
  out:
diff --git a/include/input.h b/include/input.h
index a9d0944..d891fe5 100644
--- a/include/input.h
+++ b/include/input.h
@@ -523,7 +523,8 @@ enum TouchListenerState {
     LISTENER_AWAITING_OWNER,       /**< Waiting for a TouchOwnership event */
     LISTENER_EARLY_ACCEPT,         /**< Waiting for ownership, has already
                                         accepted */
-    LISTENER_IS_OWNER,             /**< Is the current owner */
+    LISTENER_IS_OWNER,             /**< Is the current owner, hasn't accepted */
+    LISTENER_HAS_ACCEPTED,         /**< Is the current owner, has accepted */
     LISTENER_HAS_END,              /**< Has already received the end event */
 };
 
commit a8c9a93c66edce893af3ba460d728fe2bc48c2af
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Feb 27 10:09:44 2012 +1000

    dix: when rescaling from master, rescale from desktop dimensions (#46657)
    
    master->last.valuators[] is in desktop dimensions, so use those as
    rescale axis ranges, not the screen. Otherwise, a rescale on any screen
    not the top-left will cause out-of-bounds coordinates which will always
    map to the bottom-right screen, causing the device to be stuck on that
    screen.
    
    X.Org Bug 46657 <http://bugs.freedesktop.org/show_bug.cgi?id=46657>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Chase Douglas <chase.douglas at canonical.com>
    (cherry picked from commit eb84c154ed38194c32651727b6dfe2d1bde4c599)

diff --git a/dix/getevents.c b/dix/getevents.c
index 2f6f06c..68bf58c 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -345,13 +345,15 @@ updateSlaveDeviceCoords(DeviceIntPtr master, DeviceIntPtr pDev)
         pDev->last.valuators[0] = rescaleValuatorAxis(pDev->last.valuators[0],
                                                       NULL,
                                                       pDev->valuator->axes + 0,
-                                                      0, scr->width);
+                                                      screenInfo.x,
+                                                      screenInfo.width);
     }
     if (pDev->valuator->numAxes > 1) {
         pDev->last.valuators[1] = rescaleValuatorAxis(pDev->last.valuators[1],
                                                       NULL,
                                                       pDev->valuator->axes + 1,
-                                                      0, scr->height);
+                                                      screenInfo.y,
+                                                      screenInfo.height);
     }
 
     /* calculate the other axis as well based on info from the old
commit bc8dc7183b50800470080eaa9c04cfd6ecc3591b
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Feb 16 15:11:40 2012 +1000

    Xext: return BadAccess if PickPointer fails (#45796)
    
    PickPointer or PickKeyboard return NULL, all MDs are currently disabled and
    we cannot emulate a core event. This wasn't anticipated by the protocol, so
    we don't really have an error code we may use here - BadAccess is simply the
    least bad of the possible ones.
    
    And returning BadAccess beats crashing the server.
    
    X.Org Bug 45796 <http://bugs.freedesktop.org/show_bug.cgi?id=45796>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 6b6afd3d013e3f4910fae3520d1d786df2b0e47a)

diff --git a/Xext/xtest.c b/Xext/xtest.c
index 2414457..e659b41 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -118,6 +118,10 @@ ProcXTestCompareCursor(ClientPtr client)
     rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
     if (rc != Success)
         return rc;
+
+    if (!ptr)
+        return BadAccess;
+
     if (stuff->cursor == None)
         pCursor = NullCursor;
     else if (stuff->cursor == XTestCurrentCursor)
@@ -307,9 +311,15 @@ ProcXTestFakeInput(ClientPtr client)
             return BadValue;
         }
 
+        /* Technically the protocol doesn't allow for BadAccess here but
+         * this can only happen when all MDs are disabled.  */
+        if (!dev)
+            return BadAccess;
+
         dev = GetXTestDevice(dev);
     }
 
+
     /* If the event has a time set, wait for it to pass */
     if (ev->u.keyButtonPointer.time) {
         TimeStamp activateTime;


More information about the Xquartz-changes mailing list