Skip to content

Commit 2dc1389

Browse files
committed
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 <[email protected]> Signed-off-by: Keith Packard <[email protected]>
1 parent d17e726 commit 2dc1389

File tree

130 files changed

+1817
-1865
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+1817
-1865
lines changed

Xext/panoramiX.c

+18-18
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ XineramaCloseScreen (int i, ScreenPtr pScreen)
152152
pScreen->CreateGC = pScreenPriv->CreateGC;
153153

154154
if (pScreen->myNum == 0)
155-
REGION_UNINIT(pScreen, &PanoramiXScreenRegion);
155+
RegionUninit(&PanoramiXScreenRegion);
156156

157157
free((pointer) pScreenPriv);
158158

@@ -386,7 +386,7 @@ static void XineramaInitData(ScreenPtr pScreen)
386386
{
387387
int i, w, h;
388388

389-
REGION_NULL(pScreen, &PanoramiXScreenRegion)
389+
RegionNull(&PanoramiXScreenRegion)
390390
for (i = 0; i < PanoramiXNumScreens; i++) {
391391
BoxRec TheBox;
392392
RegionRec ScreenRegion;
@@ -398,10 +398,10 @@ static void XineramaInitData(ScreenPtr pScreen)
398398
TheBox.y1 = pScreen->y;
399399
TheBox.y2 = TheBox.y1 + pScreen->height;
400400

401-
REGION_INIT(pScreen, &ScreenRegion, &TheBox, 1);
402-
REGION_UNION(pScreen, &PanoramiXScreenRegion, &PanoramiXScreenRegion,
401+
RegionInit(&ScreenRegion, &TheBox, 1);
402+
RegionUnion(&PanoramiXScreenRegion, &PanoramiXScreenRegion,
403403
&ScreenRegion);
404-
REGION_UNINIT(pScreen, &ScreenRegion);
404+
RegionUninit(&ScreenRegion);
405405
}
406406

407407
PanoramiXPixWidth = screenInfo.screens[0]->x + screenInfo.screens[0]->width;
@@ -421,7 +421,7 @@ static void XineramaInitData(ScreenPtr pScreen)
421421

422422
void XineramaReinitData(ScreenPtr pScreen)
423423
{
424-
REGION_UNINIT(pScreen, &PanoramiXScreenRegion);
424+
RegionUninit(&PanoramiXScreenRegion);
425425
XineramaInitData(pScreen);
426426
}
427427

@@ -1153,8 +1153,8 @@ XineramaGetImageData(
11531153
SrcBox.x2 = SrcBox.x1 + width;
11541154
SrcBox.y2 = SrcBox.y1 + height;
11551155

1156-
REGION_INIT(pScreen, &SrcRegion, &SrcBox, 1);
1157-
REGION_NULL(pScreen, &GrabRegion);
1156+
RegionInit(&SrcRegion, &SrcBox, 1);
1157+
RegionNull(&GrabRegion);
11581158

11591159
depth = (format == XYPixmap) ? 1 : pDraw->depth;
11601160

@@ -1169,11 +1169,11 @@ XineramaGetImageData(
11691169
TheBox.y1 = pScreen->y;
11701170
TheBox.y2 = TheBox.y1 + pScreen->height;
11711171

1172-
REGION_INIT(pScreen, &ScreenRegion, &TheBox, 1);
1173-
inOut = RECT_IN_REGION(pScreen, &ScreenRegion, &SrcBox);
1172+
RegionInit(&ScreenRegion, &TheBox, 1);
1173+
inOut = RegionContainsRect(&ScreenRegion, &SrcBox);
11741174
if(inOut == rgnPART)
1175-
REGION_INTERSECT(pScreen, &GrabRegion, &SrcRegion, &ScreenRegion);
1176-
REGION_UNINIT(pScreen, &ScreenRegion);
1175+
RegionIntersect(&GrabRegion, &SrcRegion, &ScreenRegion);
1176+
RegionUninit(&ScreenRegion);
11771177

11781178
if(inOut == rgnIN) {
11791179
(*pScreen->GetImage)(pDraw,
@@ -1184,10 +1184,10 @@ XineramaGetImageData(
11841184
} else if (inOut == rgnOUT)
11851185
continue;
11861186

1187-
nbox = REGION_NUM_RECTS(&GrabRegion);
1187+
nbox = RegionNumRects(&GrabRegion);
11881188

11891189
if(nbox) {
1190-
pbox = REGION_RECTS(&GrabRegion);
1190+
pbox = RegionRects(&GrabRegion);
11911191

11921192
while(nbox--) {
11931193
w = pbox->x2 - pbox->x1;
@@ -1264,8 +1264,8 @@ XineramaGetImageData(
12641264
pbox++;
12651265
}
12661266

1267-
REGION_SUBTRACT(pScreen, &SrcRegion, &SrcRegion, &GrabRegion);
1268-
if(!REGION_NOTEMPTY(pScreen, &SrcRegion))
1267+
RegionSubtract(&SrcRegion, &SrcRegion, &GrabRegion);
1268+
if(!RegionNotEmpty(&SrcRegion))
12691269
break;
12701270
}
12711271

@@ -1274,6 +1274,6 @@ XineramaGetImageData(
12741274
if(ScratchMem)
12751275
free(ScratchMem);
12761276

1277-
REGION_UNINIT(pScreen, &SrcRegion);
1278-
REGION_UNINIT(pScreen, &GrabRegion);
1277+
RegionUninit(&SrcRegion);
1278+
RegionUninit(&GrabRegion);
12791279
}

Xext/panoramiXprocs.c

+12-12
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ int PanoramiXTranslateCoords(ClientPtr client)
620620
* borderSize
621621
*/
622622
&& (!wBoundingShape(pWin) ||
623-
POINT_IN_REGION(pWin->drawable.pScreen,
623+
RegionContainsPoint(
624624
wBoundingShape(pWin),
625625
x - pWin->drawable.x,
626626
y - pWin->drawable.y, &box))
@@ -1087,7 +1087,7 @@ int PanoramiXCopyArea(ClientPtr client)
10871087
RegionRec totalReg;
10881088
int rc;
10891089

1090-
REGION_NULL(unusedScreen, &totalReg);
1090+
RegionNull(&totalReg);
10911091
FOR_NSCREENS_BACKWARD(j) {
10921092
RegionPtr pRgn;
10931093
stuff->dstDrawable = dst->info[j].id;
@@ -1124,11 +1124,11 @@ int PanoramiXCopyArea(ClientPtr client)
11241124
stuff->dstX, stuff->dstY);
11251125
if(pGC->graphicsExposures && pRgn) {
11261126
if(srcIsRoot) {
1127-
REGION_TRANSLATE(unusedScreen, pRgn,
1127+
RegionTranslate(pRgn,
11281128
screenInfo.screens[j]->x, screenInfo.screens[j]->y);
11291129
}
1130-
REGION_APPEND(unusedScreen, &totalReg, pRgn);
1131-
REGION_DESTROY(unusedScreen, pRgn);
1130+
RegionAppend(&totalReg, pRgn);
1131+
RegionDestroy(pRgn);
11321132
}
11331133

11341134
if(dstShared)
@@ -1138,10 +1138,10 @@ int PanoramiXCopyArea(ClientPtr client)
11381138
if(pGC->graphicsExposures) {
11391139
ScreenPtr pScreen = pDst->pScreen;
11401140
Bool overlap;
1141-
REGION_VALIDATE(unusedScreen, &totalReg, &overlap);
1141+
RegionValidate(&totalReg, &overlap);
11421142
(*pScreen->SendGraphicsExpose)(
11431143
client, &totalReg, stuff->dstDrawable, X_CopyArea, 0);
1144-
REGION_UNINIT(unusedScreen, &totalReg);
1144+
RegionUninit(&totalReg);
11451145
}
11461146
}
11471147

@@ -1193,7 +1193,7 @@ int PanoramiXCopyPlane(ClientPtr client)
11931193
srcx = stuff->srcX; srcy = stuff->srcY;
11941194
dstx = stuff->dstX; dsty = stuff->dstY;
11951195

1196-
REGION_NULL(unusedScreen, &totalReg);
1196+
RegionNull(&totalReg);
11971197
FOR_NSCREENS_BACKWARD(j) {
11981198
RegionPtr pRgn;
11991199
stuff->dstDrawable = dst->info[j].id;
@@ -1233,8 +1233,8 @@ int PanoramiXCopyPlane(ClientPtr client)
12331233
stuff->width, stuff->height,
12341234
stuff->dstX, stuff->dstY, stuff->bitPlane);
12351235
if(pGC->graphicsExposures && pRgn) {
1236-
REGION_APPEND(unusedScreen, &totalReg, pRgn);
1237-
REGION_DESTROY(unusedScreen, pRgn);
1236+
RegionAppend(&totalReg, pRgn);
1237+
RegionDestroy(pRgn);
12381238
}
12391239

12401240
if(dstShared)
@@ -1244,10 +1244,10 @@ int PanoramiXCopyPlane(ClientPtr client)
12441244
if(pGC->graphicsExposures) {
12451245
ScreenPtr pScreen = pdstDraw->pScreen;
12461246
Bool overlap;
1247-
REGION_VALIDATE(unusedScreen, &totalReg, &overlap);
1247+
RegionValidate(&totalReg, &overlap);
12481248
(*pScreen->SendGraphicsExpose)(
12491249
client, &totalReg, stuff->dstDrawable, X_CopyPlane, 0);
1250-
REGION_UNINIT(unusedScreen, &totalReg);
1250+
RegionUninit(&totalReg);
12511251
}
12521252

12531253
return Success;

Xext/shape.c

+24-24
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,11 @@ RegionOperate (
153153
ScreenPtr pScreen = pWin->drawable.pScreen;
154154

155155
if (srcRgn && (xoff || yoff))
156-
REGION_TRANSLATE(pScreen, srcRgn, xoff, yoff);
156+
RegionTranslate(srcRgn, xoff, yoff);
157157
if (!pWin->parent)
158158
{
159159
if (srcRgn)
160-
REGION_DESTROY(pScreen, srcRgn);
160+
RegionDestroy(srcRgn);
161161
return Success;
162162
}
163163

@@ -168,7 +168,7 @@ RegionOperate (
168168
*/
169169
if (srcRgn == NULL) {
170170
if (*destRgnp != NULL) {
171-
REGION_DESTROY (pScreen, *destRgnp);
171+
RegionDestroy(*destRgnp);
172172
*destRgnp = 0;
173173
/* go on to remove shape and generate ShapeNotify */
174174
}
@@ -187,17 +187,17 @@ RegionOperate (
187187
else switch (op) {
188188
case ShapeSet:
189189
if (*destRgnp)
190-
REGION_DESTROY(pScreen, *destRgnp);
190+
RegionDestroy(*destRgnp);
191191
*destRgnp = srcRgn;
192192
srcRgn = 0;
193193
break;
194194
case ShapeUnion:
195195
if (*destRgnp)
196-
REGION_UNION(pScreen, *destRgnp, *destRgnp, srcRgn);
196+
RegionUnion(*destRgnp, *destRgnp, srcRgn);
197197
break;
198198
case ShapeIntersect:
199199
if (*destRgnp)
200-
REGION_INTERSECT(pScreen, *destRgnp, *destRgnp, srcRgn);
200+
RegionIntersect(*destRgnp, *destRgnp, srcRgn);
201201
else {
202202
*destRgnp = srcRgn;
203203
srcRgn = 0;
@@ -206,20 +206,20 @@ RegionOperate (
206206
case ShapeSubtract:
207207
if (!*destRgnp)
208208
*destRgnp = (*create)(pWin);
209-
REGION_SUBTRACT(pScreen, *destRgnp, *destRgnp, srcRgn);
209+
RegionSubtract(*destRgnp, *destRgnp, srcRgn);
210210
break;
211211
case ShapeInvert:
212212
if (!*destRgnp)
213-
*destRgnp = REGION_CREATE(pScreen, (BoxPtr) 0, 0);
213+
*destRgnp = RegionCreate((BoxPtr) 0, 0);
214214
else
215-
REGION_SUBTRACT(pScreen, *destRgnp, srcRgn, *destRgnp);
215+
RegionSubtract(*destRgnp, srcRgn, *destRgnp);
216216
break;
217217
default:
218218
client->errorValue = op;
219219
return BadValue;
220220
}
221221
if (srcRgn)
222-
REGION_DESTROY(pScreen, srcRgn);
222+
RegionDestroy(srcRgn);
223223
(*pScreen->SetShape) (pWin, kind);
224224
SendShapeNotify (pWin, kind);
225225
return Success;
@@ -234,7 +234,7 @@ CreateBoundingShape (WindowPtr pWin)
234234
extents.y1 = -wBorderWidth (pWin);
235235
extents.x2 = pWin->drawable.width + wBorderWidth (pWin);
236236
extents.y2 = pWin->drawable.height + wBorderWidth (pWin);
237-
return REGION_CREATE(pWin->drawable.pScreen, &extents, 1);
237+
return RegionCreate(&extents, 1);
238238
}
239239

240240
RegionPtr
@@ -246,7 +246,7 @@ CreateClipShape (WindowPtr pWin)
246246
extents.y1 = 0;
247247
extents.x2 = pWin->drawable.width;
248248
extents.y2 = pWin->drawable.height;
249-
return REGION_CREATE(pWin->drawable.pScreen, &extents, 1);
249+
return RegionCreate(&extents, 1);
250250
}
251251

252252
static int
@@ -323,7 +323,7 @@ ProcShapeRectangles (ClientPtr client)
323323
ctype = VerifyRectOrder(nrects, prects, (int)stuff->ordering);
324324
if (ctype < 0)
325325
return BadMatch;
326-
srcRgn = RECTS_TO_REGION(pScreen, nrects, prects, ctype);
326+
srcRgn = RegionFromRects(nrects, prects, ctype);
327327

328328
if (!pWin->optional)
329329
MakeWindowOptional (pWin);
@@ -419,7 +419,7 @@ ProcShapeMask (ClientPtr client)
419419
if (pPixmap->drawable.pScreen != pScreen ||
420420
pPixmap->drawable.depth != 1)
421421
return BadMatch;
422-
srcRgn = BITMAP_TO_REGION(pScreen, pPixmap);
422+
srcRgn = BitmapToRegion(pScreen, pPixmap);
423423
if (!srcRgn)
424424
return BadAlloc;
425425
}
@@ -547,8 +547,8 @@ ProcShapeCombine (ClientPtr client)
547547
}
548548

549549
if (srcRgn) {
550-
tmp = REGION_CREATE(pScreen, (BoxPtr) 0, 0);
551-
REGION_COPY(pScreen, tmp, srcRgn);
550+
tmp = RegionCreate((BoxPtr) 0, 0);
551+
RegionCopy(tmp, srcRgn);
552552
srcRgn = tmp;
553553
} else
554554
srcRgn = (*createSrc) (pSrcWin);
@@ -641,7 +641,7 @@ ProcShapeOffset (ClientPtr client)
641641
pScreen = pWin->drawable.pScreen;
642642
if (srcRgn)
643643
{
644-
REGION_TRANSLATE(pScreen, srcRgn, stuff->xOff, stuff->yOff);
644+
RegionTranslate(srcRgn, stuff->xOff, stuff->yOff);
645645
(*pScreen->SetShape) (pWin, stuff->destKind);
646646
}
647647
SendShapeNotify (pWin, (int)stuff->destKind);
@@ -697,7 +697,7 @@ ProcShapeQueryExtents (ClientPtr client)
697697
rep.clipShaped = (wClipShape(pWin) != 0);
698698
if ((region = wBoundingShape(pWin))) {
699699
/* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
700-
pExtents = REGION_EXTENTS(pWin->drawable.pScreen, region);
700+
pExtents = RegionExtents(region);
701701
extents = *pExtents;
702702
} else {
703703
extents.x1 = -wBorderWidth (pWin);
@@ -711,7 +711,7 @@ ProcShapeQueryExtents (ClientPtr client)
711711
rep.heightBoundingShape = extents.y2 - extents.y1;
712712
if ((region = wClipShape(pWin))) {
713713
/* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
714-
pExtents = REGION_EXTENTS(pWin->drawable.pScreen, region);
714+
pExtents = RegionExtents(region);
715715
extents = *pExtents;
716716
} else {
717717
extents.x1 = 0;
@@ -899,7 +899,7 @@ SendShapeNotify (WindowPtr pWin, int which)
899899
case ShapeBounding:
900900
region = wBoundingShape(pWin);
901901
if (region) {
902-
extents = *REGION_EXTENTS(pWin->drawable.pScreen, region);
902+
extents = *RegionExtents(region);
903903
shaped = xTrue;
904904
} else {
905905
extents.x1 = -wBorderWidth (pWin);
@@ -912,7 +912,7 @@ SendShapeNotify (WindowPtr pWin, int which)
912912
case ShapeClip:
913913
region = wClipShape(pWin);
914914
if (region) {
915-
extents = *REGION_EXTENTS(pWin->drawable.pScreen, region);
915+
extents = *RegionExtents(region);
916916
shaped = xTrue;
917917
} else {
918918
extents.x1 = 0;
@@ -925,7 +925,7 @@ SendShapeNotify (WindowPtr pWin, int which)
925925
case ShapeInput:
926926
region = wInputShape(pWin);
927927
if (region) {
928-
extents = *REGION_EXTENTS(pWin->drawable.pScreen, region);
928+
extents = *RegionExtents(region);
929929
shaped = xTrue;
930930
} else {
931931
extents.x1 = -wBorderWidth (pWin);
@@ -1050,8 +1050,8 @@ ProcShapeGetRectangles (ClientPtr client)
10501050
}
10511051
} else {
10521052
BoxPtr box;
1053-
nrects = REGION_NUM_RECTS(region);
1054-
box = REGION_RECTS(region);
1053+
nrects = RegionNumRects(region);
1054+
box = RegionRects(region);
10551055
rects = malloc(nrects * sizeof (xRectangle));
10561056
if (!rects && nrects)
10571057
return BadAlloc;

Xext/xace.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -255,12 +255,12 @@ XaceCensorImage(
255255
imageBox.y1 = y;
256256
imageBox.x2 = x + w;
257257
imageBox.y2 = y + h;
258-
REGION_INIT(pScreen, &imageRegion, &imageBox, 1);
259-
REGION_NULL(pScreen, &censorRegion);
258+
RegionInit(&imageRegion, &imageBox, 1);
259+
RegionNull(&censorRegion);
260260

261261
/* censorRegion = imageRegion - visibleRegion */
262-
REGION_SUBTRACT(pScreen, &censorRegion, &imageRegion, pVisibleRegion);
263-
nRects = REGION_NUM_RECTS(&censorRegion);
262+
RegionSubtract(&censorRegion, &imageRegion, pVisibleRegion);
263+
nRects = RegionNumRects(&censorRegion);
264264
if (nRects > 0)
265265
{ /* we have something to censor */
266266
GCPtr pScratchGC = NULL;
@@ -280,7 +280,7 @@ XaceCensorImage(
280280
failed = TRUE;
281281
goto failSafe;
282282
}
283-
for (pBox = REGION_RECTS(&censorRegion), i = 0;
283+
for (pBox = RegionRects(&censorRegion), i = 0;
284284
i < nRects;
285285
i++, pBox++)
286286
{
@@ -330,8 +330,8 @@ XaceCensorImage(
330330
if (pScratchGC) FreeScratchGC(pScratchGC);
331331
if (pPix) FreeScratchPixmapHeader(pPix);
332332
}
333-
REGION_UNINIT(pScreen, &imageRegion);
334-
REGION_UNINIT(pScreen, &censorRegion);
333+
RegionUninit(&imageRegion);
334+
RegionUninit(&censorRegion);
335335
} /* XaceCensorImage */
336336

337337
/*

0 commit comments

Comments
 (0)