Quit using clientErrorValue in dix/colormap.c.

And that's it! No more clientErrorValue kludge.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Jamey Sharp 2010-05-08 22:16:32 -07:00
parent a3d948ddbb
commit 11c69880c7
8 changed files with 24 additions and 40 deletions

View File

@ -65,8 +65,6 @@ SOFTWARE.
#include "privates.h"
#include "xace.h"
extern XID clientErrorValue;
static Pixel FindBestPixel(
EntryPtr /*pentFirst*/,
int /*size*/,
@ -1415,7 +1413,7 @@ BlueComp (EntryPtr pent, xrgb *prgb)
/* Read the color value of a cell */
int
QueryColors (ColormapPtr pmap, int count, Pixel *ppixIn, xrgb *prgbList)
QueryColors (ColormapPtr pmap, int count, Pixel *ppixIn, xrgb *prgbList, ClientPtr client)
{
Pixel *ppix, pixel;
xrgb *prgb;
@ -1438,14 +1436,14 @@ QueryColors (ColormapPtr pmap, int count, Pixel *ppixIn, xrgb *prgbList)
{
pixel = *ppix;
if (pixel & rgbbad) {
clientErrorValue = pixel;
client->errorValue = pixel;
errVal = BadValue;
continue;
}
i = (pixel & pVisual->redMask) >> pVisual->offsetRed;
if (i >= numred)
{
clientErrorValue = pixel;
client->errorValue = pixel;
errVal = BadValue;
continue;
}
@ -1453,7 +1451,7 @@ QueryColors (ColormapPtr pmap, int count, Pixel *ppixIn, xrgb *prgbList)
i = (pixel & pVisual->greenMask) >> pVisual->offsetGreen;
if (i >= numgreen)
{
clientErrorValue = pixel;
client->errorValue = pixel;
errVal = BadValue;
continue;
}
@ -1461,7 +1459,7 @@ QueryColors (ColormapPtr pmap, int count, Pixel *ppixIn, xrgb *prgbList)
i = (pixel & pVisual->blueMask) >> pVisual->offsetBlue;
if (i >= numblue)
{
clientErrorValue = pixel;
client->errorValue = pixel;
errVal = BadValue;
continue;
}
@ -1475,7 +1473,7 @@ QueryColors (ColormapPtr pmap, int count, Pixel *ppixIn, xrgb *prgbList)
pixel = *ppix;
if (pixel >= pVisual->ColormapEntries)
{
clientErrorValue = pixel;
client->errorValue = pixel;
errVal = BadValue;
}
else
@ -2238,7 +2236,7 @@ FreeColors (ColormapPtr pmap, int client, int count, Pixel *pixels, Pixel mask)
}
if ((mask != rmask) && count)
{
clientErrorValue = *pixels | mask;
clients[client]->errorValue = *pixels | mask;
result = BadValue;
}
/* XXX should worry about removing any RT_CMAPENTRY resource */
@ -2320,7 +2318,7 @@ FreeCo (ColormapPtr pmap, int client, int color, int npixIn, Pixel *ppixIn, Pixe
pixTest = ((*pptr | bits) & cmask) >> offset;
if ((pixTest >= numents) || (*pptr & rgbbad))
{
clientErrorValue = *pptr | bits;
clients[client]->errorValue = *pptr | bits;
errVal = BadValue;
continue;
}
@ -2401,7 +2399,7 @@ FreeCo (ColormapPtr pmap, int client, int color, int npixIn, Pixel *ppixIn, Pixe
/* Redefine color values */
int
StoreColors (ColormapPtr pmap, int count, xColorItem *defs)
StoreColors (ColormapPtr pmap, int count, xColorItem *defs, ClientPtr client)
{
Pixel pix;
xColorItem *pdef;
@ -2439,7 +2437,7 @@ StoreColors (ColormapPtr pmap, int count, xColorItem *defs)
if (pdef->pixel & rgbbad)
{
errVal = BadValue;
clientErrorValue = pdef->pixel;
client->errorValue = pdef->pixel;
continue;
}
pix = (pdef->pixel & pVisual->redMask) >> pVisual->offsetRed;
@ -2511,7 +2509,7 @@ StoreColors (ColormapPtr pmap, int count, xColorItem *defs)
defs[idef] = defs[n];
idef++;
} else
clientErrorValue = pdef->pixel;
client->errorValue = pdef->pixel;
}
}
else
@ -2522,7 +2520,7 @@ StoreColors (ColormapPtr pmap, int count, xColorItem *defs)
ok = TRUE;
if (pdef->pixel >= pVisual->ColormapEntries)
{
clientErrorValue = pdef->pixel;
client->errorValue = pdef->pixel;
errVal = BadValue;
ok = FALSE;
}

View File

@ -176,13 +176,6 @@ CallbackListPtr ClientStateCallback;
volatile char dispatchException = 0;
volatile char isItTimeToYield;
/* Various of the DIX function interfaces were not designed to allow
* the client->errorValue to be set on BadValue and other errors.
* Rather than changing interfaces and breaking untold code we introduce
* a new global that dispatch can use.
*/
XID clientErrorValue; /* XXX this is a kludge */
#define SAME_SCREENS(a, b) (\
(a.pScreen == b.pScreen))
@ -2833,10 +2826,7 @@ ProcFreeColors(ClientPtr client)
if (client->noClientException != Success)
return(client->noClientException);
else
{
client->errorValue = clientErrorValue;
return rc;
}
}
else
@ -2864,14 +2854,11 @@ ProcStoreColors (ClientPtr client)
if (count % sizeof(xColorItem))
return(BadLength);
count /= sizeof(xColorItem);
rc = StoreColors(pcmp, count, (xColorItem *)&stuff[1]);
rc = StoreColors(pcmp, count, (xColorItem *)&stuff[1], client);
if (client->noClientException != Success)
return(client->noClientException);
else
{
client->errorValue = clientErrorValue;
return rc;
}
}
else
{
@ -2899,7 +2886,7 @@ ProcStoreNamedColor (ClientPtr client)
{
def.flags = stuff->flags;
def.pixel = stuff->pixel;
rc = StoreColors(pcmp, 1, &def);
rc = StoreColors(pcmp, 1, &def, client);
if (client->noClientException != Success)
return(client->noClientException);
else
@ -2934,16 +2921,13 @@ ProcQueryColors(ClientPtr client)
prgbs = calloc(1, count * sizeof(xrgb));
if(!prgbs && count)
return(BadAlloc);
if( (rc = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs)) )
if( (rc = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs, client)) )
{
if (prgbs) free(prgbs);
if (client->noClientException != Success)
return(client->noClientException);
else
{
client->errorValue = clientErrorValue;
return rc;
}
}
memset(&qcr, 0, sizeof(xQueryColorsReply));
qcr.type = X_Reply;

View File

@ -3743,7 +3743,7 @@ DrawLogo(WindowPtr pWin)
querypixels[0] = fore[0].val;
querypixels[1] = pWin->background.pixel;
QueryColors(cmap, 2, querypixels, rgb);
QueryColors(cmap, 2, querypixels, rgb, serverClient);
if ((rgb[0].red == rgb[1].red) &&
(rgb[0].green == rgb[1].green) &&
(rgb[0].blue == rgb[1].blue)) {

View File

@ -58,7 +58,7 @@ KdSetColormap (ScreenPtr pScreen)
for (i = 0; i < (1 << pScreenPriv->screen->fb.depth); i++)
pixels[i] = i;
QueryColors (pCmap, (1 << pScreenPriv->screen->fb.depth), pixels, colors);
QueryColors (pCmap, (1 << pScreenPriv->screen->fb.depth), pixels, colors, serverClient);
for (i = 0; i < (1 << pScreenPriv->screen->fb.depth); i++)
{

View File

@ -445,7 +445,7 @@ vfbInstallColormap(ColormapPtr pmap)
for (i = 0; i < entries; i++) ppix[i] = i;
/* XXX truecolor */
QueryColors(pmap, entries, ppix, prgb);
QueryColors(pmap, entries, ppix, prgb, serverClient);
for (i = 0; i < entries; i++) { /* convert xrgbs to xColorItems */
defs[i].pixel = ppix[i] & 0xff; /* change pixel to index */

View File

@ -246,7 +246,7 @@ vgaInstallColormap(pmap)
for ( i=0; i<entries; i++) ppix[i] = i;
QueryColors( pmap, entries, ppix, prgb);
QueryColors(pmap, entries, ppix, prgb, serverClient);
for ( i=0; i<entries; i++) /* convert xrgbs to xColorItems */
{

View File

@ -135,7 +135,8 @@ extern _X_EXPORT int QueryColors(
ColormapPtr /*pmap*/,
int /*count*/,
Pixel* /*ppixIn*/,
xrgb* /*prgbList*/);
xrgb* /*prgbList*/,
ClientPtr client);
extern _X_EXPORT int FreeClientPixels(
pointer /*pcr*/,
@ -173,7 +174,8 @@ extern _X_EXPORT int FreeColors(
extern _X_EXPORT int StoreColors(
ColormapPtr /*pmap*/,
int /*count*/,
xColorItem* /*defs*/);
xColorItem* /*defs*/,
ClientPtr client);
extern _X_EXPORT int IsMapInstalled(
Colormap /*map*/,

View File

@ -276,7 +276,7 @@ miInitIndexed (ScreenPtr pScreen,
/*
* Build mapping from pixel value to ARGB
*/
QueryColors (pColormap, num, pixels, rgb);
QueryColors (pColormap, num, pixels, rgb, serverClient);
for (i = 0; i < num; i++)
{
p = pixels[i];