Rename region macros to eliminate screen argument

This is a combination of a huge mechanical patch and a few small
fixups required to finish the job. They were reviewed separately, but
because the server does not build without both pieces, I've merged
them together at this time.

The mechanical changes were performed by running the included
'fix-region' script over the whole tree:

$ git ls-files | grep -v '^fix-' | xargs ./fix-region

And then, the white space errors in the resulting patch were fixed
using the provided fix-patch-whitespace script.

$ sh ./fix-patch-whitespace

Thanks to Jamey Sharp for the mighty fine sed-generating sed script.

The hand-done changes involve removing functions from dix/region.c
that duplicate inline functions in include/regionstr.h, along with
their declarations in regionstr.h, mi.h and mispans.h.

Reviewed-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Keith Packard 2010-05-21 15:05:48 -07:00
commit 2dc138922b
130 changed files with 1817 additions and 1865 deletions

View file

@ -39,20 +39,20 @@ RegionResFree (pointer data, XID id)
{
RegionPtr pRegion = (RegionPtr) data;
REGION_DESTROY (0, pRegion);
RegionDestroy(pRegion);
return Success;
}
RegionPtr
XFixesRegionCopy (RegionPtr pRegion)
{
RegionPtr pNew = REGION_CREATE (0, REGION_EXTENTS(0, pRegion),
REGION_NUM_RECTS(pRegion));
RegionPtr pNew = RegionCreate(RegionExtents(pRegion),
RegionNumRects(pRegion));
if (!pNew)
return 0;
if (!REGION_COPY (0, pNew, pRegion))
if (!RegionCopy(pNew, pRegion))
{
REGION_DESTROY (0, pNew);
RegionDestroy(pNew);
return 0;
}
return pNew;
@ -81,7 +81,7 @@ ProcXFixesCreateRegion (ClientPtr client)
return BadLength;
things >>= 3;
pRegion = RECTS_TO_REGION(0, things, (xRectangle *) (stuff + 1), CT_UNSORTED);
pRegion = RegionFromRects(things, (xRectangle *) (stuff + 1), CT_UNSORTED);
if (!pRegion)
return BadAlloc;
if (!AddResource (stuff->region, RegionResType, (pointer) pRegion))
@ -124,7 +124,7 @@ ProcXFixesCreateRegionFromBitmap (ClientPtr client)
if (pPixmap->drawable.depth != 1)
return BadMatch;
pRegion = BITMAP_TO_REGION(pPixmap->drawable.pScreen, pPixmap);
pRegion = BitmapToRegion(pPixmap->drawable.pScreen, pPixmap);
if (!pRegion)
return BadAlloc;
@ -227,7 +227,7 @@ ProcXFixesCreateRegionFromGC (ClientPtr client)
switch (pGC->clientClipType) {
case CT_PIXMAP:
pRegion = BITMAP_TO_REGION(pGC->pScreen, (PixmapPtr) pGC->clientClip);
pRegion = BitmapToRegion(pGC->pScreen, (PixmapPtr) pGC->clientClip);
if (!pRegion)
return BadAlloc;
break;
@ -274,7 +274,7 @@ ProcXFixesCreateRegionFromPicture (ClientPtr client)
switch (pPicture->clientClipType) {
case CT_PIXMAP:
pRegion = BITMAP_TO_REGION(pPicture->pDrawable->pScreen,
pRegion = BitmapToRegion(pPicture->pDrawable->pScreen,
(PixmapPtr) pPicture->clientClip);
if (!pRegion)
return BadAlloc;
@ -346,15 +346,15 @@ ProcXFixesSetRegion (ClientPtr client)
return BadLength;
things >>= 3;
pNew = RECTS_TO_REGION(0, things, (xRectangle *) (stuff + 1), CT_UNSORTED);
pNew = RegionFromRects(things, (xRectangle *) (stuff + 1), CT_UNSORTED);
if (!pNew)
return BadAlloc;
if (!REGION_COPY (0, pRegion, pNew))
if (!RegionCopy(pRegion, pNew))
{
REGION_DESTROY (0, pNew);
RegionDestroy(pNew);
return BadAlloc;
}
REGION_DESTROY (0, pNew);
RegionDestroy(pNew);
return Success;
}
@ -380,7 +380,7 @@ ProcXFixesCopyRegion (ClientPtr client)
VERIFY_REGION(pSource, stuff->source, client, DixReadAccess);
VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess);
if (!REGION_COPY(pScreen, pDestination, pSource))
if (!RegionCopy(pDestination, pSource))
return BadAlloc;
return Success;
@ -412,15 +412,15 @@ ProcXFixesCombineRegion (ClientPtr client)
switch (stuff->xfixesReqType) {
case X_XFixesUnionRegion:
if (!REGION_UNION (0, pDestination, pSource1, pSource2))
if (!RegionUnion(pDestination, pSource1, pSource2))
return BadAlloc;
break;
case X_XFixesIntersectRegion:
if (!REGION_INTERSECT (0, pDestination, pSource1, pSource2))
if (!RegionIntersect(pDestination, pSource1, pSource2))
return BadAlloc;
break;
case X_XFixesSubtractRegion:
if (!REGION_SUBTRACT (0, pDestination, pSource1, pSource2))
if (!RegionSubtract(pDestination, pSource1, pSource2))
return BadAlloc;
break;
}
@ -466,7 +466,7 @@ ProcXFixesInvertRegion (ClientPtr client)
else
bounds.y2 = stuff->y + stuff->height;
if (!REGION_INVERSE(0, pDestination, pSource, &bounds))
if (!RegionInverse(pDestination, pSource, &bounds))
return BadAlloc;
return Success;
@ -498,7 +498,7 @@ ProcXFixesTranslateRegion (ClientPtr client)
REQUEST_SIZE_MATCH(xXFixesTranslateRegionReq);
VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess);
REGION_TRANSLATE(pScreen, pRegion, stuff->dx, stuff->dy);
RegionTranslate(pRegion, stuff->dx, stuff->dy);
return Success;
}
@ -526,7 +526,7 @@ ProcXFixesRegionExtents (ClientPtr client)
VERIFY_REGION(pSource, stuff->source, client, DixReadAccess);
VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess);
REGION_RESET (0, pDestination, REGION_EXTENTS (0, pSource));
RegionReset(pDestination, RegionExtents(pSource));
return Success;
}
@ -558,9 +558,9 @@ ProcXFixesFetchRegion (ClientPtr client)
REQUEST_SIZE_MATCH(xXFixesFetchRegionReq);
VERIFY_REGION(pRegion, stuff->region, client, DixReadAccess);
pExtent = REGION_EXTENTS (0, pRegion);
pBox = REGION_RECTS (pRegion);
nBox = REGION_NUM_RECTS (pRegion);
pExtent = RegionExtents(pRegion);
pBox = RegionRects (pRegion);
nBox = RegionNumRects (pRegion);
reply = malloc(sizeof (xXFixesFetchRegionReply) +
nBox * sizeof (xRectangle));
@ -708,7 +708,7 @@ ProcXFixesSetWindowShapeRegion (ClientPtr client)
break;
}
if (stuff->xOff || stuff->yOff)
REGION_TRANSLATE (0, pRegion, stuff->xOff, stuff->yOff);
RegionTranslate(pRegion, stuff->xOff, stuff->yOff);
}
else
{
@ -731,7 +731,7 @@ ProcXFixesSetWindowShapeRegion (ClientPtr client)
pDestRegion = &pRegion; /* a NULL region pointer */
}
if (*pDestRegion)
REGION_DESTROY(pScreen, *pDestRegion);
RegionDestroy(*pDestRegion);
*pDestRegion = pRegion;
(*pScreen->SetShape) (pWin, stuff->destKind);
SendShapeNotify (pWin, stuff->destKind);
@ -801,8 +801,8 @@ ProcXFixesExpandRegion (ClientPtr client)
VERIFY_REGION(pSource, stuff->source, client, DixReadAccess);
VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess);
nBoxes = REGION_NUM_RECTS(pSource);
pSrc = REGION_RECTS(pSource);
nBoxes = RegionNumRects(pSource);
pSrc = RegionRects(pSource);
if (nBoxes)
{
pTmp = malloc(nBoxes * sizeof (BoxRec));
@ -815,12 +815,12 @@ ProcXFixesExpandRegion (ClientPtr client)
pTmp[i].y1 = pSrc[i].y1 - stuff->top;
pTmp[i].y2 = pSrc[i].y2 + stuff->bottom;
}
REGION_EMPTY (pScreen, pDestination);
RegionEmpty(pDestination);
for (i = 0; i < nBoxes; i++)
{
RegionRec r;
REGION_INIT (pScreen, &r, &pTmp[i], 0);
REGION_UNION (pScreen, pDestination, pDestination, &r);
RegionInit(&r, &pTmp[i], 0);
RegionUnion(pDestination, pDestination, &r);
}
free(pTmp);
}