From 4c27b09c53a2c20bed1e3b5aa541c1d43fa1b370 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 31 Mar 2025 14:29:03 +0200 Subject: [PATCH] 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 --- Xi/extinit.c | 4 +--- Xi/listdev.c | 23 +++++++---------------- Xi/listdev.h | 5 ----- 3 files changed, 8 insertions(+), 24 deletions(-) diff --git a/Xi/extinit.c b/Xi/extinit.c index 9fe82a0a6..cd445eb6d 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -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_ListInputDevices) - SRepXListInputDevices(client, len, (xListInputDevicesReply *) rep); - else if (rep->RepType == X_OpenDevice) + if (rep->RepType == X_OpenDevice) SRepXOpenDevice(client, len, (xOpenDeviceReply *) rep); else if (rep->RepType == X_SetDeviceMode) SRepXSetDeviceMode(client, len, (xSetDeviceModeReply *) rep); diff --git a/Xi/listdev.c b/Xi/listdev.c index f989b8506..dc343cb35 100644 --- a/Xi/listdev.c +++ b/Xi/listdev.c @@ -384,24 +384,15 @@ ProcXListInputDevices(ClientPtr client) } rep.ndevices = numdevs; 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); free(savbuf); free(skip); 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); -} diff --git a/Xi/listdev.h b/Xi/listdev.h index c8f91796d..65a62220d 100644 --- a/Xi/listdev.h +++ b/Xi/listdev.h @@ -35,9 +35,4 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. int ProcXListInputDevices(ClientPtr /* client */ ); -void SRepXListInputDevices(ClientPtr /* client */ , - int /* size */ , - xListInputDevicesReply * /* rep */ - ); - #endif /* LISTDEV_H */