XI: directly write out X_XIQueryDevice reply

Write out the X_XIQueryDevice  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:46:43 +02:00
parent 34b0377bc7
commit 5bf2f662cc
3 changed files with 8 additions and 17 deletions

View File

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

View File

@ -149,25 +149,19 @@ ProcXIQueryDevice(ClientPtr client)
}
len = rep.length * 4;
WriteReplyToClient(client, sizeof(xXIQueryDeviceReply), &rep);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.num_devices);
}
WriteToClient(client, sizeof(xXIQueryDeviceReply), &rep);
WriteToClient(client, len, ptr);
free(ptr);
free(skip);
return rc;
}
void
SRepXIQueryDevice(ClientPtr client, int size, xXIQueryDeviceReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
swaps(&rep->num_devices);
/* Device info is already swapped, see ProcXIQueryDevice */
WriteToClient(client, size, rep);
}
/**
* @return Whether the device should be included in the returned list.
*/

View File

@ -35,7 +35,6 @@
int SProcXIQueryDevice(ClientPtr client);
int ProcXIQueryDevice(ClientPtr client);
void SRepXIQueryDevice(ClientPtr client, int size, xXIQueryDeviceReply * rep);
int SizeDeviceClasses(DeviceIntPtr dev);
int ListDeviceClasses(ClientPtr client, DeviceIntPtr dev,
char *any, uint16_t * nclasses);