XI: directly write out X_QueryDeviceState reply

Write out the X_QueryDeviceState 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 11:56:15 +02:00
parent 13cc0cdf09
commit 3695324145
3 changed files with 8 additions and 26 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_QueryDeviceState)
SRepXQueryDeviceState(client, len, (xQueryDeviceStateReply *) rep);
else if (rep->RepType == X_SetDeviceValuators)
if (rep->RepType == X_SetDeviceValuators)
SRepXSetDeviceValuators(client, len, (xSetDeviceValuatorsReply *) rep);
else if (rep->RepType == X_GetDeviceControl)
SRepXGetDeviceControl(client, len, (xGetDeviceControlReply *) rep);

View File

@ -150,24 +150,13 @@ ProcXQueryDeviceState(ClientPtr client)
.length = bytes_to_int32(total_length),
.num_classes = num_classes
};
WriteReplyToClient(client, sizeof(xQueryDeviceStateReply), &rep);
if (total_length > 0)
WriteToClient(client, total_length, savbuf);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
WriteToClient(client, sizeof(xQueryDeviceStateReply), &rep);
WriteToClient(client, total_length, savbuf);
free(savbuf);
return Success;
}
/***********************************************************************
*
* This procedure writes the reply for the XQueryDeviceState function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXQueryDeviceState(ClientPtr client, int size, xQueryDeviceStateReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}

View File

@ -33,9 +33,4 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int ProcXQueryDeviceState(ClientPtr /* client */
);
void SRepXQueryDeviceState(ClientPtr /* client */ ,
int /* size */ ,
xQueryDeviceStateReply * /* rep */
);
#endif /* QUERYST_H */