diff options
author | Jamey Sharp <jamey@minilop.net> | 2010-05-06 21:39:43 -0700 |
---|---|---|
committer | Jamey Sharp <jamey@minilop.net> | 2010-05-12 18:09:55 -0700 |
commit | 65cedf39054cf3a1e695e84ac228cce9e8d48097 (patch) | |
tree | 9a0b41cf70562a6e9e06263486f2fcf1552da46a | |
parent | afcbbd6dfea51c5b0adca0d720edc02ba0c2dc16 (diff) |
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 <jamey@minilop.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | dbe/dbe.c | 22 | ||||
-rw-r--r-- | dix/gc.c | 46 | ||||
-rw-r--r-- | fb/fbseg.c | 2 | ||||
-rw-r--r-- | hw/xfree86/xaa/xaaPCache.c | 2 | ||||
-rw-r--r-- | include/gc.h | 6 | ||||
-rw-r--r-- | mi/mibitblt.c | 8 | ||||
-rw-r--r-- | mi/midispcur.c | 4 | ||||
-rw-r--r-- | mi/miexpose.c | 4 | ||||
-rw-r--r-- | mi/miglblt.c | 8 | ||||
-rw-r--r-- | mi/mipolypnt.c | 4 | ||||
-rw-r--r-- | mi/miwideline.c | 16 | ||||
-rw-r--r-- | mi/miwideline.h | 4 | ||||
-rw-r--r-- | mi/mizerarc.c | 4 | ||||
-rw-r--r-- | xfixes/region.c | 2 |
14 files changed, 40 insertions, 92 deletions
@@ -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. diff --git a/fb/fbseg.c b/fb/fbseg.c index 80ce7404e..80dd48092 100644 --- a/fb/fbseg.c +++ b/fb/fbseg.c @@ -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); } } diff --git a/hw/xfree86/xaa/xaaPCache.c b/hw/xfree86/xaa/xaaPCache.c index e78a6f82f..e62f28083 100644 --- a/hw/xfree86/xaa/xaaPCache.c +++ b/hw/xfree86/xaa/xaaPCache.c @@ -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 */ diff --git a/include/gc.h b/include/gc.h index e75cc5e83..7f481c359 100644 --- a/include/gc.h +++ b/include/gc.h @@ -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; diff --git a/mi/mibitblt.c b/mi/mibitblt.c index 2ac6ce0e2..f02c04fd4 100644 --- a/mi/mibitblt.c +++ b/mi/mibitblt.c @@ -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; diff --git a/mi/midispcur.c b/mi/midispcur.c index 06bddec8d..a107949e9 100644 --- a/mi/midispcur.c +++ b/mi/midispcur.c @@ -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); diff --git a/mi/miexpose.c b/mi/miexpose.c index 2072e6a0a..b4d489a7d 100644 --- a/mi/miexpose.c +++ b/mi/miexpose.c @@ -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); } diff --git a/mi/miglblt.c b/mi/miglblt.c index ea199dc8c..22a170aa0 100644 --- a/mi/miglblt.c +++ b/mi/miglblt.c @@ -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); } diff --git a/mi/mipolypnt.c b/mi/mipolypnt.c index 5a0e52363..b54a9fdbe 100644 --- a/mi/mipolypnt.c +++ b/mi/mipolypnt.c @@ -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); diff --git a/mi/miwideline.c b/mi/miwideline.c index 57dda2202..c54e2deb1 100644 --- a/mi/miwideline.c +++ b/mi/miwideline.c @@ -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); } } diff --git a/mi/miwideline.h b/mi/miwideline.h index 1665ebfb1..2ff36ed6b 100644 --- a/mi/miwideline.h +++ b/mi/miwideline.h @@ -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); \ } \ } diff --git a/mi/mizerarc.c b/mi/mizerarc.c index 1175bc1dd..feaa3cb77 100644 --- a/mi/mizerarc.c +++ b/mi/mizerarc.c @@ -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); } } diff --git a/xfixes/region.c b/xfixes/region.c index 2649c06ce..5e1636962 100644 --- a/xfixes/region.c +++ b/xfixes/region.c @@ -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); |