dix: write out X_LookupColor reply directly

No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-04-04 16:02:16 +02:00
parent 707fd2b1d7
commit fa4c80243f
4 changed files with 15 additions and 23 deletions

View File

@ -3009,7 +3009,7 @@ ProcLookupColor(ClientPtr client)
&exactRed,
&exactGreen,
&exactBlue)) {
xLookupColorReply lcr = {
xLookupColorReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
@ -3020,10 +3020,19 @@ ProcLookupColor(ClientPtr client)
.screenGreen = exactGreen,
.screenBlue = exactBlue
};
(*pcmp->pScreen->ResolveColor) (&lcr.screenRed,
&lcr.screenGreen,
&lcr.screenBlue, pcmp->pVisual);
WriteReplyToClient(client, sizeof(xLookupColorReply), &lcr);
(*pcmp->pScreen->ResolveColor) (&rep.screenRed,
&rep.screenGreen,
&rep.screenBlue, pcmp->pVisual);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.exactRed);
swaps(&rep.exactGreen);
swaps(&rep.exactBlue);
swaps(&rep.screenRed);
swaps(&rep.screenGreen);
swaps(&rep.screenBlue);
}
WriteToClient(client, sizeof(rep), &rep);
return Success;
}
return BadName;

View File

@ -310,19 +310,6 @@ SGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply * pRep)
WriteToClient(pClient, size, pRep);
}
void _X_COLD
SLookupColorReply(ClientPtr pClient, int size, xLookupColorReply * pRep)
{
swaps(&pRep->sequenceNumber);
swaps(&pRep->exactRed);
swaps(&pRep->exactGreen);
swaps(&pRep->exactBlue);
swaps(&pRep->screenRed);
swaps(&pRep->screenGreen);
swaps(&pRep->screenBlue);
WriteToClient(pClient, size, pRep);
}
void _X_COLD
SQueryBestSizeReply(ClientPtr pClient, int size, xQueryBestSizeReply * pRep)
{

View File

@ -807,7 +807,7 @@ ReplySwapPtr ReplySwapVector[256] = {
ReplyNotSwappd,
ReplyNotSwappd, /* 90 */
ReplyNotSwappd,
(ReplySwapPtr) SLookupColorReply,
ReplyNotSwappd,
ReplyNotSwappd,
ReplyNotSwappd,
ReplyNotSwappd, /* 95 */

View File

@ -68,10 +68,6 @@ extern void SGetFontPathReply(ClientPtr /* pClient */ ,
int /* size */ ,
xGetFontPathReply * /* pRep */ );
extern void SLookupColorReply(ClientPtr /* pClient */ ,
int /* size */ ,
xLookupColorReply * /* pRep */ );
extern void SQueryBestSizeReply(ClientPtr /* pClient */ ,
int /* size */ ,
xQueryBestSizeReply * /* pRep */ );