XI: directly write out X_XIQueryVersion reply

Write out the X_XIQueryVersion reply directly (and do the swapping
within the request handler) instead of going through separate callback
that's having demux the replies again.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-04-01 13:43:13 +02:00
parent e916ae88bc
commit 34b0377bc7
3 changed files with 7 additions and 16 deletions

View File

@ -421,9 +421,7 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
{ {
/* All we look at is the type field */ /* All we look at is the type field */
/* This is common to all replies */ /* This is common to all replies */
if (rep->RepType == X_XIQueryVersion) if (rep->RepType == X_XIQueryDevice)
SRepXIQueryVersion(client, len, (xXIQueryVersionReply *) rep);
else if (rep->RepType == X_XIQueryDevice)
SRepXIQueryDevice(client, len, (xXIQueryDeviceReply *) rep); SRepXIQueryDevice(client, len, (xXIQueryDeviceReply *) rep);
else if (rep->RepType == X_XIGrabDevice) else if (rep->RepType == X_XIGrabDevice)
SRepXIGrabDevice(client, len, (xXIGrabDeviceReply *) rep); SRepXIGrabDevice(client, len, (xXIGrabDeviceReply *) rep);

View File

@ -116,12 +116,16 @@ ProcXIQueryVersion(ClientPtr client)
.repType = X_Reply, .repType = X_Reply,
.RepType = X_XIQueryVersion, .RepType = X_XIQueryVersion,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = 0,
.major_version = major, .major_version = major,
.minor_version = minor .minor_version = minor
}; };
WriteReplyToClient(client, sizeof(xXIQueryVersionReply), &rep); if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.major_version);
swaps(&rep.minor_version);
}
WriteToClient(client, sizeof(xXIQueryVersionReply), &rep);
return Success; return Success;
} }
@ -137,13 +141,3 @@ SProcXIQueryVersion(ClientPtr client)
swaps(&stuff->minor_version); swaps(&stuff->minor_version);
return (ProcXIQueryVersion(client)); return (ProcXIQueryVersion(client));
} }
void _X_COLD
SRepXIQueryVersion(ClientPtr client, int size, xXIQueryVersionReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->major_version);
swaps(&rep->minor_version);
WriteToClient(client, size, rep);
}

View File

@ -35,6 +35,5 @@
int SProcXIQueryVersion(ClientPtr client); int SProcXIQueryVersion(ClientPtr client);
int ProcXIQueryVersion(ClientPtr client); int ProcXIQueryVersion(ClientPtr client);
void SRepXIQueryVersion(ClientPtr client, int size, xXIQueryVersionReply * rep);
#endif /* QUERYVERSION_H */ #endif /* QUERYVERSION_H */