Commit 65cedf39 authored by Jamey Sharp's avatar Jamey Sharp

Kill DoChangeGC 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.
Signed-off-by: Jamey Sharp's avatarJamey Sharp <jamey@minilop.net>
Reviewed-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
parent afcbbd6d
......@@ -1239,7 +1239,7 @@ SProcDbeDispatch(ClientPtr client)
static Bool
DbeSetupBackgroundPainter(WindowPtr pWin, GCPtr pGC)
{
pointer gcvalues[4];
ChangeGCVal gcvalues[4];
int ts_x_origin, ts_y_origin;
PixUnion background;
int backgroundState;
......@@ -1265,16 +1265,16 @@ DbeSetupBackgroundPainter(WindowPtr pWin, GCPtr pGC)
switch (backgroundState)
{
case BackgroundPixel:
gcvalues[0] = (pointer)background.pixel;
gcvalues[1] = (pointer)FillSolid;
gcvalues[0].val = background.pixel;
gcvalues[1].val = FillSolid;
gcmask = GCForeground|GCFillStyle;
break;
case BackgroundPixmap:
gcvalues[0] = (pointer)FillTiled;
gcvalues[1] = (pointer)background.pixmap;
gcvalues[2] = (pointer)(long)ts_x_origin;
gcvalues[3] = (pointer)(long)ts_y_origin;
gcvalues[0].val = FillTiled;
gcvalues[1].ptr = background.pixmap;
gcvalues[2].val = ts_x_origin;
gcvalues[3].val = ts_y_origin;
gcmask = GCFillStyle|GCTile|GCTileStipXOrigin|GCTileStipYOrigin;
break;
......@@ -1283,13 +1283,7 @@ DbeSetupBackgroundPainter(WindowPtr pWin, GCPtr pGC)
return(FALSE);
}
if (DoChangeGC(pGC, gcmask, (XID *)gcvalues, TRUE) != 0)
{
return(FALSE);
}
return(TRUE);
return dixChangeGC(NullClient, pGC, gcmask, NULL, gcvalues) == 0;
} /* DbeSetupBackgroundPainter() */
......
......@@ -91,11 +91,9 @@ ValidateGC(DrawablePtr pDraw, GC *pGC)
* pass NullClient for the client since any access checking should have
* already been done at a higher level.
*
* Since we had to create a new function anyway, we decided to change the
* way the list of gc values is passed to eliminate the compiler warnings
* caused by the DoChangeGC interface. You can pass the values via pC32
* or pUnion, but not both; one of them must be NULL. If you don't need
* to pass any pointers, you can use either one:
* You can pass the list of gc values via pC32 or pUnion, but not both;
* one of them must be NULL. If you don't need to pass any pointers,
* you can use either one:
*
* example calling dixChangeGC using pC32 parameter
*
......@@ -126,13 +124,6 @@ ValidateGC(DrawablePtr pDraw, GC *pGC)
* Note: we could have gotten by with just the pUnion parameter, but on
* 64 bit machines that would have forced us to copy the value list that
* comes in the ChangeGC request.
*
* Ideally, we'd change all the DoChangeGC calls to dixChangeGC, but this
* is far too many changes to consider at this time, so we've only
* changed the ones that caused compiler warnings. New code should use
* dixChangeGC.
*
* dpw
*/
#define NEXTVAL(_type, _var) { \
......@@ -508,37 +499,6 @@ ChangeGC(GC *pGC, BITS32 mask, XID *pval)
return (dixChangeGC(NullClient, pGC, mask, pval, NULL));
}
/* DoChangeGC(pGC, mask, pval, fPointer)
mask is a set of bits indicating which values to change.
pval contains an appropriate value for each mask.
fPointer is true if the values for tiles, stipples, fonts or clipmasks
are pointers instead of IDs. Note: if you are passing pointers you
MUST declare the array of values as type pointer! Other data types
may not be large enough to hold pointers on some machines. Yes,
this means you have to cast to (XID *) when you pass the array to
DoChangeGC. Similarly, if you are not passing pointers (fPointer = 0) you
MUST declare the array as type XID (not unsigned long!), or again the wrong
size data type may be used. To avoid this cruftiness, use dixChangeGC
above.
if there is an error, the value is marked as changed
anyway, which is probably wrong, but infrequent.
NOTE:
all values sent over the protocol for ChangeGC requests are
32 bits long
*/
int
DoChangeGC(GC *pGC, BITS32 mask, XID *pval, int fPointer)
{
if (fPointer)
/* XXX might be a problem on 64 bit big-endian servers */
return dixChangeGC(NullClient, pGC, mask, NULL, (ChangeGCValPtr)pval);
else
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.
......
......@@ -250,7 +250,7 @@ fbSetFg (DrawablePtr pDrawable,
{
if (fg != pGC->fgPixel)
{
DoChangeGC (pGC, GCForeground, (XID *) &fg, FALSE);
dixChangeGC (NullClient, pGC, GCForeground, &fg, NULL);
ValidateGC (pDrawable, pGC);
}
}
......
......@@ -1881,7 +1881,7 @@ XAAWriteBitmapToCacheLinear(
pGC = GetScratchGC(pScreenPix->drawable.depth, pScreen);
gcvals[0] = fg;
gcvals[1] = bg;
DoChangeGC(pGC, GCForeground | GCBackground, gcvals, 0);
dixChangeGC(NullClient, pGC, GCForeground | GCBackground, gcvals, NULL);
ValidateGC((DrawablePtr)pDstPix, pGC);
/* We've unwrapped already so these ops miss a sync */
......
......@@ -93,12 +93,6 @@ extern _X_EXPORT int ChangeGC(
BITS32 /*mask*/,
XID* /*pval*/);
extern _X_EXPORT int DoChangeGC(
GCPtr/*pGC*/,
BITS32 /*mask*/,
XID* /*pval*/,
int /*fPointer*/);
typedef union {
CARD32 val;
pointer ptr;
......
......@@ -679,7 +679,7 @@ miGetImage( DrawablePtr pDraw, int sx, int sy, int w, int h,
/* alu is already GXCopy */
gcv[0] = (XID)planeMask;
DoChangeGC(pGC, GCPlaneMask, gcv, 0);
dixChangeGC(NullClient, pGC, GCPlaneMask, gcv, NULL);
ValidateGC((DrawablePtr)pPixmap, pGC);
}
......@@ -776,7 +776,7 @@ miPutImage( DrawablePtr pDraw, GCPtr pGC, int depth,
oldBg = pGC->bgPixel;
gcv[0] = (XID)~0;
gcv[1] = (XID)0;
DoChangeGC(pGC, GCForeground | GCBackground, gcv, 0);
dixChangeGC(NullClient, pGC, GCForeground | GCBackground, gcv, NULL);
bytesPer = (long)h * BitmapBytePad(w + leftPad);
for (i = 1 << (depth-1); i != 0; i >>= 1, pImage += bytesPer)
......@@ -784,7 +784,7 @@ miPutImage( DrawablePtr pDraw, GCPtr pGC, int depth,
if (i & oldPlanemask)
{
gcv[0] = (XID)i;
DoChangeGC(pGC, GCPlaneMask, gcv, 0);
dixChangeGC(NullClient, pGC, GCPlaneMask, gcv, NULL);
ValidateGC(pDraw, pGC);
(*pGC->ops->PutImage)(pDraw, pGC, 1, x, y, w, h, leftPad,
XYBitmap, (char *)pImage);
......@@ -793,7 +793,7 @@ miPutImage( DrawablePtr pDraw, GCPtr pGC, int depth,
gcv[0] = (XID)oldPlanemask;
gcv[1] = (XID)oldFg;
gcv[2] = (XID)oldBg;
DoChangeGC(pGC, GCPlaneMask | GCForeground | GCBackground, gcv, 0);
dixChangeGC(NullClient, pGC, GCPlaneMask | GCForeground | GCBackground, gcv, NULL);
ValidateGC(pDraw, pGC);
break;
......
......@@ -371,7 +371,7 @@ miDCPutBits (
if (sourceGC->fgPixel != source)
{
gcvals[0] = source;
DoChangeGC (sourceGC, GCForeground, gcvals, 0);
dixChangeGC (NullClient, sourceGC, GCForeground, gcvals, NULL);
}
if (sourceGC->serialNumber != pDrawable->serialNumber)
ValidateGC (pDrawable, sourceGC);
......@@ -391,7 +391,7 @@ miDCPutBits (
if (maskGC->fgPixel != mask)
{
gcvals[0] = mask;
DoChangeGC (maskGC, GCForeground, gcvals, 0);
dixChangeGC (NullClient, maskGC, GCForeground, gcvals, NULL);
}
if (maskGC->serialNumber != pDrawable->serialNumber)
ValidateGC (pDrawable, maskGC);
......
......@@ -691,9 +691,9 @@ miClearDrawable(DrawablePtr pDraw, GCPtr pGC)
rect.y = 0;
rect.width = pDraw->width;
rect.height = pDraw->height;
DoChangeGC(pGC, GCForeground, &bg, 0);
dixChangeGC(NullClient, pGC, GCForeground, &bg, NULL);
ValidateGC(pDraw, pGC);
(*pGC->ops->PolyFillRect)(pDraw, pGC, 1, &rect);
DoChangeGC(pGC, GCForeground, &fg, 0);
dixChangeGC(NullClient, pGC, GCForeground, &fg, NULL);
ValidateGC(pDraw, pGC);
}
......@@ -138,7 +138,7 @@ miPolyGlyphBlt(
gcvals[1] = 1;
gcvals[2] = 0;
DoChangeGC(pGCtmp, GCFunction|GCForeground|GCBackground, gcvals, 0);
dixChangeGC(NullClient, pGCtmp, GCFunction|GCForeground|GCBackground, gcvals, NULL);
nbyLine = BitmapBytePad(width);
pbits = malloc(height*nbyLine);
......@@ -237,13 +237,13 @@ miImageGlyphBlt(
gcvals[0] = GXcopy;
gcvals[1] = pGC->bgPixel;
gcvals[2] = FillSolid;
DoChangeGC(pGC, GCFunction|GCForeground|GCFillStyle, gcvals, 0);
dixChangeGC(NullClient, pGC, GCFunction|GCForeground|GCFillStyle, gcvals, NULL);
ValidateGC(pDrawable, pGC);
(*pGC->ops->PolyFillRect)(pDrawable, pGC, 1, &backrect);
/* put down the glyphs */
gcvals[0] = oldFG;
DoChangeGC(pGC, GCForeground, gcvals, 0);
dixChangeGC(NullClient, pGC, GCForeground, gcvals, NULL);
ValidateGC(pDrawable, pGC);
(*pGC->ops->PolyGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci,
pglyphBase);
......@@ -252,7 +252,7 @@ miImageGlyphBlt(
gcvals[0] = oldAlu;
gcvals[1] = oldFG;
gcvals[2] = oldFS;
DoChangeGC(pGC, GCFunction|GCForeground|GCFillStyle, gcvals, 0);
dixChangeGC(NullClient, pGC, GCFunction|GCForeground|GCFillStyle, gcvals, NULL);
ValidateGC(pDrawable, pGC);
}
......@@ -107,7 +107,7 @@ miPolyPoint(
fsNew = FillSolid;
if(pGC->fillStyle != FillSolid)
{
DoChangeGC(pGC, GCFillStyle, &fsNew, 0);
dixChangeGC(NullClient, pGC, GCFillStyle, &fsNew, NULL);
ValidateGC(pDrawable, pGC);
}
pwidth = pwidthInit;
......@@ -117,7 +117,7 @@ miPolyPoint(
if(fsOld != FillSolid)
{
DoChangeGC(pGC, GCFillStyle, &fsOld, 0);
dixChangeGC(NullClient, pGC, GCFillStyle, &fsOld, NULL);
ValidateGC(pDrawable, pGC);
}
free(pwidthInit);
......
......@@ -137,7 +137,7 @@ miFillPolyHelper (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
if (pixel != oldPixel)
{
XID tmpPixel = (XID)pixel;
DoChangeGC (pGC, GCForeground, &tmpPixel, FALSE);
dixChangeGC (NullClient, pGC, GCForeground, &tmpPixel, NULL);
ValidateGC (pDrawable, pGC);
}
}
......@@ -233,7 +233,7 @@ miFillPolyHelper (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
free(pptInit);
if (pixel != oldPixel)
{
DoChangeGC (pGC, GCForeground, &oldPixel, FALSE);
dixChangeGC (NullClient, pGC, GCForeground, &oldPixel, NULL);
ValidateGC (pDrawable, pGC);
}
}
......@@ -271,13 +271,13 @@ miFillRectPolyHelper (
if (pixel != oldPixel)
{
XID tmpPixel = (XID)pixel;
DoChangeGC (pGC, GCForeground, &tmpPixel, FALSE);
dixChangeGC (NullClient, pGC, GCForeground, &tmpPixel, NULL);
ValidateGC (pDrawable, pGC);
}
(*pGC->ops->PolyFillRect) (pDrawable, pGC, 1, &rect);
if (pixel != oldPixel)
{
DoChangeGC (pGC, GCForeground, &oldPixel, FALSE);
dixChangeGC (NullClient, pGC, GCForeground, &oldPixel, NULL);
ValidateGC (pDrawable, pGC);
}
}
......@@ -1120,7 +1120,7 @@ miLineArc (
if (pixel != oldPixel)
{
XID tmpPixel = (XID)pixel;
DoChangeGC(pGC, GCForeground, &tmpPixel, FALSE);
dixChangeGC(NullClient, pGC, GCForeground, &tmpPixel, NULL);
ValidateGC (pDraw, pGC);
}
}
......@@ -1152,7 +1152,7 @@ miLineArc (
free(points);
if (pixel != oldPixel)
{
DoChangeGC(pGC, GCForeground, &oldPixel, FALSE);
dixChangeGC(NullClient, pGC, GCForeground, &oldPixel, NULL);
ValidateGC (pDraw, pGC);
}
}
......@@ -1571,14 +1571,14 @@ miCleanupSpanData (DrawablePtr pDrawable, GCPtr pGC, SpanDataPtr spanData)
oldPixel = pGC->fgPixel;
if (pixel != oldPixel)
{
DoChangeGC (pGC, GCForeground, &pixel, FALSE);
dixChangeGC (NullClient, pGC, GCForeground, &pixel, NULL);
ValidateGC (pDrawable, pGC);
}
miFillUniqueSpanGroup (pDrawable, pGC, &spanData->bgGroup);
miFreeSpanGroup (&spanData->bgGroup);
if (pixel != oldPixel)
{
DoChangeGC (pGC, GCForeground, &oldPixel, FALSE);
dixChangeGC (NullClient, pGC, GCForeground, &oldPixel, NULL);
ValidateGC (pDrawable, pGC);
}
}
......
......@@ -78,13 +78,13 @@ typedef struct _LineFace {
#define MILINESETPIXEL(pDrawable, pGC, pixel, oldPixel) { \
oldPixel = pGC->fgPixel; \
if (pixel != oldPixel) { \
DoChangeGC (pGC, GCForeground, (XID *) &pixel, FALSE); \
dixChangeGC (NullClient, pGC, GCForeground, (XID *) &pixel, NULL); \
ValidateGC (pDrawable, pGC); \
} \
}
#define MILINERESETPIXEL(pDrawable, pGC, pixel, oldPixel) { \
if (pixel != oldPixel) { \
DoChangeGC (pGC, GCForeground, (XID *) &oldPixel, FALSE); \
dixChangeGC (NullClient, pGC, GCForeground, (XID *) &oldPixel, NULL); \
ValidateGC (pDrawable, pGC); \
} \
}
......
......@@ -803,7 +803,7 @@ miZeroPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs)
if ((pGC->fillStyle == FillSolid) ||
(pGC->fillStyle == FillStippled))
{
DoChangeGC(pGC, GCForeground, (XID *)&pGC->bgPixel, 0);
dixChangeGC(NullClient, pGC, GCForeground, (XID *)&pGC->bgPixel, NULL);
ValidateGC(pDraw, pGC);
}
pts = &points[numPts >> 1];
......@@ -831,7 +831,7 @@ miZeroPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs)
if ((pGC->fillStyle == FillSolid) ||
(pGC->fillStyle == FillStippled))
{
DoChangeGC(pGC, GCForeground, &fgPixel, 0);
dixChangeGC(NullClient, pGC, GCForeground, &fgPixel, NULL);
ValidateGC(pDraw, pGC);
}
}
......
......@@ -642,7 +642,7 @@ ProcXFixesSetGCClipRegion (ClientPtr client)
vals[0] = stuff->xOrigin;
vals[1] = stuff->yOrigin;
DoChangeGC (pGC, GCClipXOrigin|GCClipYOrigin, vals, 0);
dixChangeGC (NullClient, pGC, GCClipXOrigin|GCClipYOrigin, vals, NULL);
(*pGC->funcs->ChangeClip)(pGC, pRegion ? CT_REGION : CT_NONE, (pointer)pRegion, 0);
return (client->noClientException);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment