mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 05:54:08 +00:00
dix/Xinerama: untwist X_AllocColor request handling
Instead of internally faking requests, factor out the actual logic into separate function, which is getting everything it needs as parameters, so no need to fiddle with request buffer anymore. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
committed by
Enrico Weigelt
parent
9b2d3ba167
commit
cf105bc990
@@ -2682,21 +2682,26 @@ ProcListInstalledColormaps(ClientPtr client)
|
||||
return X_SEND_REPLY_WITH_RPCBUF(client, rep, rpcbuf);
|
||||
}
|
||||
|
||||
int dixAllocColor(ClientPtr client, Colormap cmap, CARD16 *red,
|
||||
CARD16 *green, CARD16 *blue, CARD32 *pixel)
|
||||
{
|
||||
ColormapPtr pmap;
|
||||
int rc = dixLookupResourceByType((void **) &pmap,
|
||||
cmap,
|
||||
X11_RESTYPE_COLORMAP,
|
||||
client,
|
||||
DixAddAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
return AllocColor(pmap, red, green, blue, pixel, client->index);
|
||||
}
|
||||
|
||||
int
|
||||
ProcAllocColor(ClientPtr client)
|
||||
{
|
||||
ColormapPtr pmap;
|
||||
int rc;
|
||||
|
||||
REQUEST(xAllocColorReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xAllocColorReq);
|
||||
rc = dixLookupResourceByType((void **) &pmap, stuff->cmap, X11_RESTYPE_COLORMAP,
|
||||
client, DixAddAccess);
|
||||
if (rc != Success) {
|
||||
client->errorValue = stuff->cmap;
|
||||
return rc;
|
||||
}
|
||||
|
||||
xAllocColorReply rep = {
|
||||
.red = stuff->red,
|
||||
@@ -2704,9 +2709,11 @@ ProcAllocColor(ClientPtr client)
|
||||
.blue = stuff->blue,
|
||||
};
|
||||
|
||||
if ((rc = AllocColor(pmap, &rep.red, &rep.green, &rep.blue,
|
||||
&rep.pixel, client->index)))
|
||||
int rc = dixAllocColor(client, stuff->cmap, &rep.red, &rep.green, &rep.blue, &rep.pixel);
|
||||
if (rc != Success) {
|
||||
client->errorValue = stuff->cmap;
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&rep.red);
|
||||
@@ -2715,13 +2722,7 @@ ProcAllocColor(ClientPtr client)
|
||||
swapl(&rep.pixel);
|
||||
}
|
||||
|
||||
#ifdef XINERAMA
|
||||
if (noPanoramiXExtension || !pmap->pScreen->myNum)
|
||||
return X_SEND_REPLY_SIMPLE(client, rep);
|
||||
return Success;
|
||||
#else
|
||||
return X_SEND_REPLY_SIMPLE(client, rep);
|
||||
#endif /* XINERAMA */
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
Reference in New Issue
Block a user