Kill ChangeGC in favor of dixChangeGC.

This doesn't change any behavior, but it isn't clear whether NullClient
is correct in all cases. As ajax says,

> For most of these changes, I think it's correct to use NullClient,
> since they are server-initiated changes and should not fail for (eg)
> xace reasons. ... At any rate, you're certainly not changing any
> semantics by leaving them all as NullClient, so this patch can't be
> more wrong than before.

The call in CreateGC is particularly questionable.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Jamey Sharp 2010-05-06 21:56:10 -07:00
parent 65cedf3905
commit 04bad1b8a1
9 changed files with 18 additions and 33 deletions

View File

@ -1261,7 +1261,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
{
if (pFont != c->pGC->font && c->pDraw)
{
ChangeGC( c->pGC, GCFont, &fid);
dixChangeGC(NullClient, c->pGC, GCFont, &fid, NULL);
ValidateGC(c->pDraw, c->pGC);
if (c->reqType == X_PolyText8)
c->polyText = (PolyTextPtr) c->pGC->ops->PolyText8;
@ -1404,7 +1404,7 @@ bail:
/* Step 4 */
if (pFont != origGC->font)
{
ChangeGC(origGC, GCFont, &fid);
dixChangeGC(NullClient, origGC, GCFont, &fid, NULL);
ValidateGC(c->pDraw, origGC);
}
@ -1423,7 +1423,7 @@ bail:
if (c->slept)
{
ClientWakeup(c->client);
ChangeGC(c->pGC, clearGCmask, clearGC);
dixChangeGC(NullClient, c->pGC, clearGCmask, clearGC, NULL);
/* Unreference the font from the scratch GC */
CloseFont(c->pGC->font, (Font)0);
@ -1580,7 +1580,7 @@ bail:
if (c->slept)
{
ClientWakeup(c->client);
ChangeGC(c->pGC, clearGCmask, clearGC);
dixChangeGC(NullClient, c->pGC, clearGCmask, clearGC, NULL);
/* Unreference the font from the scratch GC */
CloseFont(c->pGC->font, (Font)0);

View File

@ -491,14 +491,6 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr
#undef NEXTVAL
#undef NEXT_PTR
/* Publically defined entry to ChangeGC. Just calls dixChangeGC and tells
* it that all of the entries are constants or IDs */
int
ChangeGC(GC *pGC, BITS32 mask, XID *pval)
{
return (dixChangeGC(NullClient, pGC, mask, pval, NULL));
}
/* CreateGC(pDrawable, mask, pval, pStatus)
creates a default GC for the given drawable, using mask to fill
in any non-default values.
@ -582,7 +574,7 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus,
if (!(*pGC->pScreen->CreateGC)(pGC))
*pStatus = BadAlloc;
else if (mask)
*pStatus = ChangeGC(pGC, mask, pval);
*pStatus = dixChangeGC(NullClient, pGC, mask, pval, NULL);
else
*pStatus = Success;
@ -625,8 +617,7 @@ CreateDefaultTile (GCPtr pGC)
tmpval[0] = GXcopy;
tmpval[1] = pGC->tile.pixel;
tmpval[2] = FillSolid;
(void)ChangeGC(pgcScratch, GCFunction | GCForeground | GCFillStyle,
tmpval);
(void)dixChangeGC(NullClient, pgcScratch, GCFunction | GCForeground | GCFillStyle, tmpval, NULL);
ValidateGC((DrawablePtr)pTile, pgcScratch);
rect.x = 0;
rect.y = 0;
@ -965,7 +956,7 @@ CreateDefaultStipple(int screenNum)
(*pScreen->DestroyPixmap)(pScreen->PixmapPerDepth[0]);
return FALSE;
}
(void)ChangeGC(pgcScratch, GCFunction|GCForeground|GCFillStyle, tmpval);
(void)dixChangeGC(NullClient, pgcScratch, GCFunction|GCForeground|GCFillStyle, tmpval, NULL);
ValidateGC((DrawablePtr)pScreen->PixmapPerDepth[0], pgcScratch);
rect.x = 0;
rect.y = 0;

View File

@ -328,7 +328,7 @@ MakeRootTile(WindowPtr pWin)
attributes[0] = pScreen->whitePixel;
attributes[1] = pScreen->blackPixel;
(void)ChangeGC(pGC, GCForeground | GCBackground, attributes);
(void)dixChangeGC(NullClient, pGC, GCForeground | GCBackground, attributes, NULL);
}
ValidateGC((DrawablePtr)pWin->background.pixmap, pGC);

View File

@ -107,8 +107,7 @@ ephyrPrepareSolid(PixmapPtr pPix, int alu, Pixel pm, Pixel fg)
tmpval[0] = alu;
tmpval[1] = pm;
tmpval[2] = fg;
ChangeGC(fakexa->pGC, GCFunction | GCPlaneMask | GCForeground,
tmpval);
dixChangeGC(NullClient, fakexa->pGC, GCFunction | GCPlaneMask | GCForeground, tmpval, NULL);
ValidateGC(&pPix->drawable, fakexa->pGC);
@ -173,7 +172,7 @@ ephyrPrepareCopy(PixmapPtr pSrc, PixmapPtr pDst, int dx, int dy, int alu,
tmpval[0] = alu;
tmpval[1] = pm;
ChangeGC (fakexa->pGC, GCFunction | GCPlaneMask, tmpval);
dixChangeGC (NullClient, fakexa->pGC, GCFunction | GCPlaneMask, tmpval, NULL);
ValidateGC(&pDst->drawable, fakexa->pGC);

View File

@ -1892,7 +1892,7 @@ KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg)
val[0] = fg;
val[1] = IncludeInferiors;
ChangeGC (pGC, GCForeground|GCSubwindowMode, val);
dixChangeGC (NullClient, pGC, GCForeground|GCSubwindowMode, val, NULL);
ValidateGC (pDraw, pGC);

View File

@ -1855,7 +1855,7 @@ xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes)
if (pPriv) pPriv->pGC = pGC;
} else if (key != pGC->fgPixel){
pval[0] = key;
ChangeGC(pGC, GCForeground, pval);
dixChangeGC(NullClient, pGC, GCForeground, pval, NULL);
ValidateGC(pDraw, pGC);
}
@ -1892,7 +1892,7 @@ xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes)
gc = GetScratchGC(root->depth, pScreen);
pval[0] = key;
pval[1] = IncludeInferiors;
(void) ChangeGC(gc, GCForeground|GCSubwindowMode, pval);
(void) dixChangeGC(NullClient, gc, GCForeground|GCSubwindowMode, pval, NULL);
ValidateGC(root, gc);
rects = malloc(nbox * sizeof(xRectangle));

View File

@ -88,11 +88,6 @@ extern _X_EXPORT void ValidateGC(
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/);
extern _X_EXPORT int ChangeGC(
GCPtr/*pGC*/,
BITS32 /*mask*/,
XID* /*pval*/);
typedef union {
CARD32 val;
pointer ptr;

View File

@ -306,7 +306,7 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor)
0, 0, pCursor->bits->width, pCursor->bits->height,
0, XYPixmap, (char *)pCursor->bits->source);
gcvals[0] = GXand;
ChangeGC (pGC, GCFunction, gcvals);
dixChangeGC (NullClient, pGC, GCFunction, gcvals, NULL);
ValidateGC ((DrawablePtr)pPriv->sourceBits, pGC);
(*pGC->ops->PutImage) ((DrawablePtr)pPriv->sourceBits, pGC, 1,
0, 0, pCursor->bits->width, pCursor->bits->height,
@ -314,13 +314,13 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor)
/* mask bits -- pCursor->mask & ~pCursor->source */
gcvals[0] = GXcopy;
ChangeGC (pGC, GCFunction, gcvals);
dixChangeGC (NullClient, pGC, GCFunction, gcvals, NULL);
ValidateGC ((DrawablePtr)pPriv->maskBits, pGC);
(*pGC->ops->PutImage) ((DrawablePtr)pPriv->maskBits, pGC, 1,
0, 0, pCursor->bits->width, pCursor->bits->height,
0, XYPixmap, (char *)pCursor->bits->mask);
gcvals[0] = GXandInverted;
ChangeGC (pGC, GCFunction, gcvals);
dixChangeGC (NullClient, pGC, GCFunction, gcvals, NULL);
ValidateGC ((DrawablePtr)pPriv->maskBits, pGC);
(*pGC->ops->PutImage) ((DrawablePtr)pPriv->maskBits, pGC, 1,
0, 0, pCursor->bits->width, pCursor->bits->height,

View File

@ -70,7 +70,7 @@ miColorRects (PicturePtr pDst,
(*pGC->funcs->ChangeClip) (pGC, CT_REGION, pClip, 0);
}
ChangeGC (pGC, mask, tmpval);
dixChangeGC (NullClient, pGC, mask, tmpval, NULL);
ValidateGC (pDst->pDrawable, pGC);
if (xoff || yoff)
{
@ -148,7 +148,7 @@ miCompositeRects (CARD8 op,
tmpval[0] = GXcopy;
tmpval[1] = pixel;
ChangeGC (pGC, GCFunction | GCForeground, tmpval);
dixChangeGC (NullClient, pGC, GCFunction | GCForeground, tmpval, NULL);
ValidateGC (&pPixmap->drawable, pGC);
one.x = 0;
one.y = 0;