--- xc/programs/Xserver/miext/damage/damage.c.orig Fri Sep 3 12:18:23 2004 +++ xc/programs/Xserver/miext/damage/damage.c Thu Feb 3 14:20:25 2005 @@ -112,11 +112,12 @@ getDrawableDamageRef (DrawablePtr pDrawa #if DAMAGE_DEBUG_ENABLE static void -_damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, char *where) -#define damageDamageRegion(d,r,c) _damageDamageRegion(d,r,c,__FUNCTION__) +_damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, int subWindowMode, const char *where) +#define damageDamageRegion(d,r,c,m) _damageDamageRegion(d,r,c,m,__FUNCTION__) #else static void -damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip) +damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, + int subWindowMode) #endif { ScreenPtr pScreen = pDrawable->pScreen; @@ -154,6 +155,26 @@ damageDamageRegion (DrawablePtr pDrawabl REGION_TRANSLATE (pScreen, pRegion, screen_x, screen_y); #endif + if (pDrawable->type == DRAWABLE_WINDOW && + ((WindowPtr)(pDrawable))->backingStore == NotUseful) + { + if (subWindowMode == ClipByChildren) + { + REGION_INTERSECT(pScreen, pRegion, pRegion, + &((WindowPtr)(pDrawable))->clipList); + } + else if (subWindowMode == IncludeInferiors) + { + RegionPtr pTempRegion = + NotClippedByChildren((WindowPtr)(pDrawable)); + REGION_INTERSECT(pScreen, pRegion, pRegion, pTempRegion); + REGION_UNINIT(pScreen, pTempRegion); + } + /* If subWindowMode is set to an invalid value, don't perform + * any drawable-based clipping. */ + } + + REGION_NULL (pScreen, &clippedRec); for (; pDamage; pDamage = pNext) { @@ -282,21 +303,21 @@ damageDamageRegion (DrawablePtr pDrawabl } #if DAMAGE_DEBUG_ENABLE -#define damageDamageBox(d,b) _damageDamageBox(d,b,__FUNCTION__) +#define damageDamageBox(d,b,m) _damageDamageBox(d,b,m,__FUNCTION__) static void -_damageDamageBox (DrawablePtr pDrawable, BoxPtr pBox, char *where) +_damageDamageBox (DrawablePtr pDrawable, BoxPtr pBox, int subWindowMode, const char *where) #else static void -damageDamageBox (DrawablePtr pDrawable, BoxPtr pBox) +damageDamageBox (DrawablePtr pDrawable, BoxPtr pBox, int subWindowMode) #endif { RegionRec region; REGION_INIT (pDrawable->pScreen, ®ion, pBox, 1); #if DAMAGE_DEBUG_ENABLE - _damageDamageRegion (pDrawable, ®ion, TRUE, where); + _damageDamageRegion (pDrawable, ®ion, TRUE, subWindowMode, where); #else - damageDamageRegion (pDrawable, ®ion, TRUE); + damageDamageRegion (pDrawable, ®ion, TRUE, subWindowMode); #endif REGION_UNINIT (pDrawable->pScreen, ®ion); } @@ -511,7 +532,7 @@ damageComposite (CARD8 op, box.y2 = box.y1 + height; TRIM_PICTURE_BOX(box, pDst); if (BOX_NOT_EMPTY(box)) - damageDamageBox (pDst->pDrawable, &box); + damageDamageBox (pDst->pDrawable, &box, pDst->subWindowMode); } unwrap (pScrPriv, ps, Composite); (*ps->Composite) (op, @@ -588,7 +609,7 @@ damageGlyphs (CARD8 op, } TRIM_PICTURE_BOX (box, pDst); if (BOX_NOT_EMPTY(box)) - damageDamageBox (pDst->pDrawable, &box); + damageDamageBox (pDst->pDrawable, &box, pDst->subWindowMode); } unwrap (pScrPriv, ps, Glyphs); (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs); @@ -639,7 +660,7 @@ damageFillSpans(DrawablePtr pDrawable, TRIM_BOX(box, pGC); if(BOX_NOT_EMPTY(box)) - damageDamageBox (pDrawable, &box); + damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->FillSpans)(pDrawable, pGC, npt, ppt, pwidth, fSorted); @@ -688,7 +709,7 @@ damageSetSpans(DrawablePtr pDrawable, TRIM_BOX(box, pGC); if(BOX_NOT_EMPTY(box)) - damageDamageBox (pDrawable, &box); + damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->SetSpans)(pDrawable, pGC, pcharsrc, ppt, pwidth, npt, fSorted); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); @@ -718,7 +739,7 @@ damagePutImage(DrawablePtr pDrawable, TRIM_BOX(box, pGC); if(BOX_NOT_EMPTY(box)) - damageDamageBox (pDrawable, &box); + damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->PutImage)(pDrawable, pGC, depth, x, y, w, h, leftPad, format, pImage); @@ -756,7 +777,7 @@ damageCopyArea(DrawablePtr pSrc, TRIM_BOX(box, pGC); if(BOX_NOT_EMPTY(box)) - damageDamageBox (pDst, &box); + damageDamageBox (pDst, &box, pGC->subWindowMode); } ret = (*pGC->ops->CopyArea)(pSrc, pDst, @@ -797,7 +818,7 @@ damageCopyPlane(DrawablePtr pSrc, TRIM_BOX(box, pGC); if(BOX_NOT_EMPTY(box)) - damageDamageBox (pDst, &box); + damageDamageBox (pDst, &box, pGC->subWindowMode); } ret = (*pGC->ops->CopyPlane)(pSrc, pDst, @@ -840,7 +861,7 @@ damagePolyPoint(DrawablePtr pDrawable, TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC); if(BOX_NOT_EMPTY(box)) - damageDamageBox (pDrawable, &box); + damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->PolyPoint)(pDrawable, pGC, mode, npt, ppt); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); @@ -913,7 +934,7 @@ damagePolylines(DrawablePtr pDrawable, TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC); if(BOX_NOT_EMPTY(box)) - damageDamageBox (pDrawable, &box); + damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->Polylines)(pDrawable, pGC, mode, npt, ppt); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); @@ -991,7 +1012,7 @@ damagePolySegment(DrawablePtr pDrawable, TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC); if(BOX_NOT_EMPTY(box)) - damageDamageBox (pDrawable, &box); + damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->PolySegment)(pDrawable, pGC, nSeg, pSeg); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); @@ -1025,7 +1046,7 @@ damagePolyRectangle(DrawablePtr pDrawab box.y2 = box.y1 + offset2; TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC); if(BOX_NOT_EMPTY(box)) - damageDamageBox (pDrawable, &box); + damageDamageBox (pDrawable, &box, pGC->subWindowMode); box.x1 = pRectsTmp->x - offset1; box.y1 = pRectsTmp->y + offset3; @@ -1033,7 +1054,7 @@ damagePolyRectangle(DrawablePtr pDrawab box.y2 = box.y1 + pRectsTmp->height - offset2; TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC); if(BOX_NOT_EMPTY(box)) - damageDamageBox (pDrawable, &box); + damageDamageBox (pDrawable, &box, pGC->subWindowMode); box.x1 = pRectsTmp->x + pRectsTmp->width - offset1; box.y1 = pRectsTmp->y + offset3; @@ -1041,7 +1062,7 @@ damagePolyRectangle(DrawablePtr pDrawab box.y2 = box.y1 + pRectsTmp->height - offset2; TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC); if(BOX_NOT_EMPTY(box)) - damageDamageBox (pDrawable, &box); + damageDamageBox (pDrawable, &box, pGC->subWindowMode); box.x1 = pRectsTmp->x - offset1; box.y1 = pRectsTmp->y + pRectsTmp->height - offset1; @@ -1049,7 +1070,7 @@ damagePolyRectangle(DrawablePtr pDrawab box.y2 = box.y1 + offset2; TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC); if(BOX_NOT_EMPTY(box)) - damageDamageBox (pDrawable, &box); + damageDamageBox (pDrawable, &box, pGC->subWindowMode); pRectsTmp++; } @@ -1104,7 +1125,7 @@ damagePolyArc(DrawablePtr pDrawable, TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC); if(BOX_NOT_EMPTY(box)) - damageDamageBox (pDrawable, &box); + damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->PolyArc)(pDrawable, pGC, nArcs, pArcs); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); @@ -1161,7 +1182,7 @@ damageFillPolygon(DrawablePtr pDrawable, TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC); if(BOX_NOT_EMPTY(box)) - damageDamageBox (pDrawable, &box); + damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->FillPolygon)(pDrawable, pGC, shape, mode, npt, ppt); @@ -1200,7 +1221,7 @@ damagePolyFillRect(DrawablePtr pDrawable TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC); if(BOX_NOT_EMPTY(box)) - damageDamageBox (pDrawable, &box); + damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->PolyFillRect)(pDrawable, pGC, nRects, pRects); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); @@ -1241,7 +1262,7 @@ damagePolyFillArc(DrawablePtr pDrawable, TRIM_AND_TRANSLATE_BOX(box, pDrawable, pGC); if(BOX_NOT_EMPTY(box)) - damageDamageBox (pDrawable, &box); + damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->PolyFillArc)(pDrawable, pGC, nArcs, pArcs); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); @@ -1259,7 +1280,8 @@ damageDamageChars (DrawablePtr pDrawable int y, unsigned int n, CharInfoPtr *charinfo, - Bool imageblt) + Bool imageblt, + int subWindowMode) { ExtentInfoRec extents; BoxRec box; @@ -1282,7 +1304,7 @@ damageDamageChars (DrawablePtr pDrawable box.y1 = y - extents.overallAscent; box.x2 = x + extents.overallRight; box.y2 = y + extents.overallDescent; - damageDamageBox (pDrawable, &box); + damageDamageBox (pDrawable, &box, subWindowMode); } /* @@ -1326,7 +1348,7 @@ damageText (DrawablePtr pDrawable, if (n != 0) { damageDamageChars (pDrawable, pGC->font, x + pDrawable->x, y + pDrawable->y, n, - charinfo, imageblt); + charinfo, imageblt, pGC->subWindowMode); if (imageblt) (*pGC->ops->ImageGlyphBlt)(pDrawable, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font)); @@ -1426,7 +1448,7 @@ damageImageGlyphBlt(DrawablePtr pDra { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); damageDamageChars (pDrawable, pGC->font, x + pDrawable->x, y + pDrawable->y, - nglyph, ppci, TRUE); + nglyph, ppci, TRUE, pGC->subWindowMode); (*pGC->ops->ImageGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); @@ -1443,7 +1465,7 @@ damagePolyGlyphBlt(DrawablePtr pDrawable { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); damageDamageChars (pDrawable, pGC->font, x + pDrawable->x, y + pDrawable->y, - nglyph, ppci, FALSE); + nglyph, ppci, FALSE, pGC->subWindowMode); (*pGC->ops->PolyGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); @@ -1476,7 +1498,7 @@ damagePushPixels(GCPtr pGC, TRIM_BOX(box, pGC); if(BOX_NOT_EMPTY(box)) - damageDamageBox (pDrawable, &box); + damageDamageBox (pDrawable, &box, pGC->subWindowMode); } (*pGC->ops->PushPixels)(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); @@ -1554,7 +1576,7 @@ damagePaintWindow(WindowPtr pWindow, */ if ((what != PW_BACKGROUND || pWindow->backgroundState != None) && getWindowDamage (pWindow)) - damageDamageRegion (&pWindow->drawable, prgn, FALSE); + damageDamageRegion (&pWindow->drawable, prgn, FALSE, -1); if(what == PW_BACKGROUND) { unwrap (pScrPriv, pScreen, PaintWindowBackground); (*pScreen->PaintWindowBackground) (pWindow, prgn, what); @@ -1585,7 +1607,7 @@ damageCopyWindow(WindowPtr pWindow, * at the destination location. Translate back and forth. */ REGION_TRANSLATE (pScreen, prgnSrc, dx, dy); - damageDamageRegion (&pWindow->drawable, prgnSrc, FALSE); + damageDamageRegion (&pWindow->drawable, prgnSrc, FALSE, -1); REGION_TRANSLATE (pScreen, prgnSrc, -dx, -dy); } unwrap (pScrPriv, pScreen, CopyWindow); @@ -1620,7 +1642,7 @@ damageRestoreAreas (PixmapPtr pPixmap, ScreenPtr pScreen = pWindow->drawable.pScreen; damageScrPriv(pScreen); - damageDamageRegion (&pWindow->drawable, prgn, FALSE); + damageDamageRegion (&pWindow->drawable, prgn, FALSE, -1); unwrap (pScrPriv, pScreen, BackingStoreFuncs.RestoreAreas); (*pScreen->BackingStoreFuncs.RestoreAreas) (pPixmap, prgn, xorg, yorg, pWindow); @@ -1929,5 +1951,5 @@ void DamageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion) { - damageDamageRegion (pDrawable, pRegion, FALSE); + damageDamageRegion (pDrawable, pRegion, FALSE, -1); }