From 3ff2fd4d3288eb7931b07d944330be36ba94cd1d Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 1 Apr 2025 11:58:08 +0200 Subject: [PATCH] XI: directly write out X_SetDeviceValuators reply Write out the X_SetDeviceValuators 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/setdval.c | 22 ++++------------------ Xi/setdval.h | 5 ----- 3 files changed, 5 insertions(+), 26 deletions(-) diff --git a/Xi/extinit.c b/Xi/extinit.c index ad59a53cf..966911a6d 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_SetDeviceValuators) - SRepXSetDeviceValuators(client, len, (xSetDeviceValuatorsReply *) rep); - else if (rep->RepType == X_GetDeviceControl) + if (rep->RepType == X_GetDeviceControl) SRepXGetDeviceControl(client, len, (xGetDeviceControlReply *) rep); else if (rep->RepType == X_ChangeDeviceControl) SRepXChangeDeviceControl(client, len, diff --git a/Xi/setdval.c b/Xi/setdval.c index 3419fd99d..7ef99e46b 100644 --- a/Xi/setdval.c +++ b/Xi/setdval.c @@ -82,7 +82,6 @@ ProcXSetDeviceValuators(ClientPtr client) .repType = X_Reply, .RepType = X_SetDeviceValuators, .sequenceNumber = client->sequence, - .length = 0, .status = Success }; @@ -112,22 +111,9 @@ ProcXSetDeviceValuators(ClientPtr client) if (rep.status != Success && rep.status != AlreadyGrabbed) return rep.status; - WriteReplyToClient(client, sizeof(xSetDeviceValuatorsReply), &rep); + if (client->swapped) { + swaps(&rep.sequenceNumber); + } + WriteToClient(client, sizeof(xSetDeviceValuatorsReply), &rep); return Success; } - -/*********************************************************************** - * - * This procedure writes the reply for the XSetDeviceValuators function, - * if the client and server have a different byte ordering. - * - */ - -void _X_COLD -SRepXSetDeviceValuators(ClientPtr client, int size, - xSetDeviceValuatorsReply * rep) -{ - swaps(&rep->sequenceNumber); - swapl(&rep->length); - WriteToClient(client, size, rep); -} diff --git a/Xi/setdval.h b/Xi/setdval.h index 452be2897..644bbcfbe 100644 --- a/Xi/setdval.h +++ b/Xi/setdval.h @@ -33,9 +33,4 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. int ProcXSetDeviceValuators(ClientPtr /* client */ ); -void SRepXSetDeviceValuators(ClientPtr /* client */ , - int /* size */ , - xSetDeviceValuatorsReply * /* rep */ - ); - #endif /* SETDVAL_H */