XI: directly write out X_ListInputDevices reply

Write out X_ListInputDevices the 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-03-31 14:29:03 +02:00
parent be45dd2d06
commit 4c27b09c53
3 changed files with 8 additions and 24 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_ListInputDevices) if (rep->RepType == X_OpenDevice)
SRepXListInputDevices(client, len, (xListInputDevicesReply *) rep);
else if (rep->RepType == X_OpenDevice)
SRepXOpenDevice(client, len, (xOpenDeviceReply *) rep); SRepXOpenDevice(client, len, (xOpenDeviceReply *) rep);
else if (rep->RepType == X_SetDeviceMode) else if (rep->RepType == X_SetDeviceMode)
SRepXSetDeviceMode(client, len, (xSetDeviceModeReply *) rep); SRepXSetDeviceMode(client, len, (xSetDeviceModeReply *) rep);

View File

@ -384,24 +384,15 @@ ProcXListInputDevices(ClientPtr client)
} }
rep.ndevices = numdevs; rep.ndevices = numdevs;
rep.length = bytes_to_int32(total_length); rep.length = bytes_to_int32(total_length);
WriteReplyToClient(client, sizeof(xListInputDevicesReply), &rep);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
WriteToClient(client, sizeof(xListInputDevicesReply), &rep);
WriteToClient(client, total_length, savbuf); WriteToClient(client, total_length, savbuf);
free(savbuf); free(savbuf);
free(skip); free(skip);
return Success; return Success;
} }
/***********************************************************************
*
* This procedure writes the reply for the XListInputDevices function,
* if the client and server have a different byte ordering.
*
*/
void _X_COLD
SRepXListInputDevices(ClientPtr client, int size, xListInputDevicesReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
WriteToClient(client, size, rep);
}

View File

@ -35,9 +35,4 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int ProcXListInputDevices(ClientPtr /* client */ int ProcXListInputDevices(ClientPtr /* client */
); );
void SRepXListInputDevices(ClientPtr /* client */ ,
int /* size */ ,
xListInputDevicesReply * /* rep */
);
#endif /* LISTDEV_H */ #endif /* LISTDEV_H */