summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorJamey Sharp <jamey@minilop.net>2010-05-07 19:38:05 -0700
committerJamey Sharp <jamey@minilop.net>2010-05-13 17:14:07 -0700
commit6a84cd943430cfc9df55c83aef6a7f8dea6dbb94 (patch)
treeb6b75bd36bc05c394e3b1e52edaccde1d52a136d /dix
parent2d7eb4a19b773d0406c0c2e018a7da97f3565fd5 (diff)
Replace dixChangeGC with calls directly to the right variant.
Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'dix')
-rw-r--r--dix/dispatch.c2
-rw-r--r--dix/dixfonts.c8
-rw-r--r--dix/gc.c71
-rw-r--r--dix/glyphcurs.c5
-rw-r--r--dix/window.c13
5 files changed, 39 insertions, 60 deletions
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 4dc9ecd9d..d6a8a5aaf 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -1537,7 +1537,7 @@ ProcChangeGC(ClientPtr client)
if (len != Ones(stuff->mask))
return BadLength;
- result = dixChangeGC(client, pGC, stuff->mask, (CARD32 *) &stuff[1], 0);
+ result = ChangeGCXIDs(client, pGC, stuff->mask, (CARD32 *) &stuff[1]);
if (client->noClientException != Success)
return(client->noClientException);
else
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 01123c3a9..585754b57 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1263,7 +1263,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
{
ChangeGCVal val;
val.ptr = pFont;
- dixChangeGC(NullClient, c->pGC, GCFont, NULL, &val);
+ ChangeGC(NullClient, c->pGC, GCFont, &val);
ValidateGC(c->pDraw, c->pGC);
if (c->reqType == X_PolyText8)
c->polyText = (PolyTextPtr) c->pGC->ops->PolyText8;
@@ -1408,7 +1408,7 @@ bail:
{
ChangeGCVal val;
val.ptr = pFont;
- dixChangeGC(NullClient, origGC, GCFont, NULL, &val);
+ ChangeGC(NullClient, origGC, GCFont, &val);
ValidateGC(c->pDraw, origGC);
}
@@ -1427,7 +1427,7 @@ bail:
if (c->slept)
{
ClientWakeup(c->client);
- dixChangeGC(NullClient, c->pGC, clearGCmask, NULL, clearGC);
+ ChangeGC(NullClient, c->pGC, clearGCmask, clearGC);
/* Unreference the font from the scratch GC */
CloseFont(c->pGC->font, (Font)0);
@@ -1584,7 +1584,7 @@ bail:
if (c->slept)
{
ClientWakeup(c->client);
- dixChangeGC(NullClient, c->pGC, clearGCmask, NULL, clearGC);
+ ChangeGC(NullClient, c->pGC, clearGCmask, clearGC);
/* Unreference the font from the scratch GC */
CloseFont(c->pGC->font, (Font)0);
diff --git a/dix/gc.c b/dix/gc.c
index 6d7a92d77..1f2d4d05b 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -82,48 +82,37 @@ ValidateGC(DrawablePtr pDraw, GC *pGC)
}
-/* dixChangeGC(client, pGC, mask, pC32, pUnion)
- *
- * This function was created as part of the Security extension
- * implementation. The client performing the gc change must be passed so
- * that access checks can be performed on any tiles, stipples, or fonts
- * that are specified. ddxen can call this too; they should normally
- * pass NullClient for the client since any access checking should have
+/*
+ * ChangeGC/ChangeGCXIDs:
+ *
+ * The client performing the gc change must be passed so that access
+ * checks can be performed on any tiles, stipples, or fonts that are
+ * specified. ddxen can call this too; they should normally pass
+ * NullClient for the client since any access checking should have
* already been done at a higher level.
*
- * 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:
+ * If you have any XIDs, you must use ChangeGCXIDs:
*
- * example calling dixChangeGC using pC32 parameter
- *
* CARD32 v[2];
- * v[0] = foreground;
- * v[1] = background;
- * dixChangeGC(client, pGC, GCForeground|GCBackground, v, NULL);
- *
- * example calling dixChangeGC using pUnion parameter;
- * same effect as above
- *
- * ChangeGCVal v[2];
- * v[0].val = foreground;
- * v[1].val = background;
- * dixChangeGC(client, pGC, GCForeground|GCBackground, NULL, v);
+ * v[0] = FillTiled;
+ * v[1] = pid;
+ * ChangeGCXIDs(client, pGC, GCFillStyle|GCTile, v);
*
- * However, if you need to pass a pointer to a pixmap or font, you MUST
- * use the pUnion parameter.
+ * However, if you need to pass a pointer to a pixmap or font, you must
+ * use ChangeGC:
*
- * example calling dixChangeGC passing pointers in the value list
- * v[1].ptr is a pointer to a pixmap
- *
* ChangeGCVal v[2];
* v[0].val = FillTiled;
* v[1].ptr = pPixmap;
- * dixChangeGC(client, pGC, GCFillStyle|GCTile, NULL, v);
+ * ChangeGC(client, pGC, GCFillStyle|GCTile, v);
*
- * 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.
+ * If you have neither XIDs nor pointers, you can use either function,
+ * but ChangeGC will do less work.
+ *
+ * ChangeGCVal v[2];
+ * v[0].val = foreground;
+ * v[1].val = background;
+ * ChangeGC(client, pGC, GCForeground|GCBackground, v);
*/
#define NEXTVAL(_type, _var) { \
@@ -133,7 +122,7 @@ ValidateGC(DrawablePtr pDraw, GC *pGC)
#define NEXT_PTR(_type, _var) { \
_var = (_type)pUnion->ptr; pUnion++; }
-static int
+int
ChangeGC(ClientPtr client, GC *pGC, BITS32 mask, ChangeGCValPtr pUnion)
{
BITS32 index2;
@@ -430,7 +419,7 @@ static const struct {
{ GCClipMask, RT_PIXMAP, DixReadAccess },
};
-static int
+int
ChangeGCXIDs(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32)
{
ChangeGCVal vals[GCLastBit + 1];
@@ -466,14 +455,6 @@ ChangeGCXIDs(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32)
return ChangeGC(client, pGC, mask, vals);
}
-int
-dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr pUnion)
-{
- if (pC32)
- return ChangeGCXIDs(client, pGC, mask, pC32);
- return ChangeGC(client, pGC, mask, pUnion);
-}
-
/* CreateGC(pDrawable, mask, pval, pStatus)
creates a default GC for the given drawable, using mask to fill
in any non-default values.
@@ -557,7 +538,7 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus,
if (!(*pGC->pScreen->CreateGC)(pGC))
*pStatus = BadAlloc;
else if (mask)
- *pStatus = dixChangeGC(client, pGC, mask, pval, NULL);
+ *pStatus = ChangeGCXIDs(client, pGC, mask, pval);
else
*pStatus = Success;
@@ -600,7 +581,7 @@ CreateDefaultTile (GCPtr pGC)
tmpval[0].val = GXcopy;
tmpval[1].val = pGC->tile.pixel;
tmpval[2].val = FillSolid;
- (void)dixChangeGC(NullClient, pgcScratch, GCFunction | GCForeground | GCFillStyle, NULL, tmpval);
+ (void)ChangeGC(NullClient, pgcScratch, GCFunction | GCForeground | GCFillStyle, tmpval);
ValidateGC((DrawablePtr)pTile, pgcScratch);
rect.x = 0;
rect.y = 0;
@@ -941,7 +922,7 @@ CreateDefaultStipple(int screenNum)
(*pScreen->DestroyPixmap)(pScreen->PixmapPerDepth[0]);
return FALSE;
}
- (void)dixChangeGC(NullClient, pgcScratch, GCFunction|GCForeground|GCFillStyle, NULL, tmpval);
+ (void)ChangeGC(NullClient, pgcScratch, GCFunction|GCForeground|GCFillStyle, tmpval);
ValidateGC((DrawablePtr)pScreen->PixmapPerDepth[0], pgcScratch);
rect.x = 0;
rect.y = 0;
diff --git a/dix/glyphcurs.c b/dix/glyphcurs.c
index f10400f7b..fa2aeca26 100644
--- a/dix/glyphcurs.c
+++ b/dix/glyphcurs.c
@@ -118,14 +118,13 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm, unsigned cha
gcval[0].val = GXcopy;
gcval[1].val = 0;
gcval[2].ptr = (pointer)pfont;
- dixChangeGC(NullClient, pGC, GCFunction | GCForeground | GCFont,
- NULL, gcval);
+ ChangeGC(NullClient, pGC, GCFunction | GCForeground | GCFont, gcval);
ValidateGC((DrawablePtr)ppix, pGC);
(*pGC->ops->PolyFillRect)((DrawablePtr)ppix, pGC, 1, &rect);
/* draw the glyph */
gcval[0].val = 1;
- dixChangeGC(NullClient, pGC, GCForeground, NULL, gcval);
+ ChangeGC(NullClient, pGC, GCForeground, gcval);
ValidateGC((DrawablePtr)ppix, pGC);
(*pGC->ops->PolyText16)((DrawablePtr)ppix, pGC, cm->xhot, cm->yhot,
1, (unsigned short *)char2b);
diff --git a/dix/window.c b/dix/window.c
index 595c60856..57cebf46a 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -328,7 +328,7 @@ MakeRootTile(WindowPtr pWin)
attributes[0].val = pScreen->whitePixel;
attributes[1].val = pScreen->blackPixel;
- (void)dixChangeGC(NullClient, pGC, GCForeground | GCBackground, NULL, attributes);
+ (void)ChangeGC(NullClient, pGC, GCForeground | GCBackground, attributes);
}
ValidateGC((DrawablePtr)pWin->background.pixmap, pGC);
@@ -3763,8 +3763,7 @@ DrawLogo(WindowPtr pWin)
} else {
back[0].val = 0;
back[1].val = 0;
- dixChangeGC(NullClient, pGC, GCTileStipXOrigin|GCTileStipYOrigin,
- NULL, back);
+ ChangeGC(NullClient, pGC, GCTileStipXOrigin|GCTileStipYOrigin, back);
back[0].val = FillTiled;
back[1].ptr = pWin->background.pixmap;
bmask = GCFillStyle|GCTile;
@@ -3802,7 +3801,7 @@ DrawLogo(WindowPtr pWin)
poly[1].x = x + size-d31; poly[1].y = y;
poly[2].x = x + 0; poly[2].y = y + size;
poly[3].x = x + d31; poly[3].y = y + size;
- dixChangeGC(NullClient, pGC, fmask, NULL, fore);
+ ChangeGC(NullClient, pGC, fmask, fore);
ValidateGC(pDraw, pGC);
(*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly);
@@ -3821,7 +3820,7 @@ DrawLogo(WindowPtr pWin)
poly[1].x = x + size / 2; poly[1].y = y + size/2;
poly[2].x = x + (size/2)+(d31-(d31/2)); poly[2].y = y + size/2;
poly[3].x = x + d31; poly[3].y = y + size;
- dixChangeGC(NullClient, pGC, bmask, NULL, back);
+ ChangeGC(NullClient, pGC, bmask, back);
ValidateGC(pDraw, pGC);
(*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly);
@@ -3860,7 +3859,7 @@ DrawLogo(WindowPtr pWin)
poly[1].x = x + size/4; poly[1].y = y;
poly[2].x = x + size; poly[2].y = y + size;
poly[3].x = x + size - size/4; poly[3].y = y + size;
- dixChangeGC(NullClient, pGC, fmask, NULL, fore);
+ ChangeGC(NullClient, pGC, fmask, fore);
ValidateGC(pDraw, pGC);
(*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly);
@@ -3878,7 +3877,7 @@ DrawLogo(WindowPtr pWin)
poly[1].x = x + size-( thin+gap); poly[1].y = y;
poly[2].x = x + thin; poly[2].y = y + size;
poly[3].x = x + thin + gap; poly[3].y = y + size;
- dixChangeGC(NullClient, pGC, bmask, NULL, back);
+ ChangeGC(NullClient, pGC, bmask, back);
ValidateGC(pDraw, pGC);
(*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly);