mirror of
https://github.com/X11Libre/xserver.git
synced 2026-10-14 00:01:20 +00:00
Replace dixChangeGC with calls directly to the right variant.
Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
2d7eb4a19b
commit
6a84cd9434
26 changed files with 103 additions and 120 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
73
dix/gc.c
73
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);
|
||||
* v[0] = FillTiled;
|
||||
* v[1] = pid;
|
||||
* ChangeGCXIDs(client, pGC, GCFillStyle|GCTile, v);
|
||||
*
|
||||
* example calling dixChangeGC using pUnion parameter;
|
||||
* same effect as above
|
||||
* However, if you need to pass a pointer to a pixmap or font, you must
|
||||
* use ChangeGC:
|
||||
*
|
||||
* ChangeGCVal v[2];
|
||||
* v[0].val = FillTiled;
|
||||
* v[1].ptr = pPixmap;
|
||||
* ChangeGC(client, pGC, GCFillStyle|GCTile, v);
|
||||
*
|
||||
* 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;
|
||||
* dixChangeGC(client, pGC, GCForeground|GCBackground, NULL, v);
|
||||
*
|
||||
* However, if you need to pass a pointer to a pixmap or font, you MUST
|
||||
* use the pUnion parameter.
|
||||
*
|
||||
* 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);
|
||||
*
|
||||
* 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.
|
||||
* 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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
13
dix/window.c
13
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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue