From 00a19a11d5cd2fd118d436620b481d026e73a7f2 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 31 Mar 2025 20:04:34 +0200 Subject: [PATCH] XI: directly write out X_SetDeviceMode reply Write out X_SetDeviceMode 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/setmode.c | 22 ++++++---------------- Xi/setmode.h | 5 ----- 3 files changed, 7 insertions(+), 24 deletions(-) diff --git a/Xi/extinit.c b/Xi/extinit.c index 7b8f6ad49..65ac23848 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_SetDeviceMode) - SRepXSetDeviceMode(client, len, (xSetDeviceModeReply *) rep); - else if (rep->RepType == X_GetSelectedExtensionEvents) + if (rep->RepType == X_GetSelectedExtensionEvents) SRepXGetSelectedExtensionEvents(client, len, (xGetSelectedExtensionEventsReply *) rep); diff --git a/Xi/setmode.c b/Xi/setmode.c index c8e70a556..d145e57dc 100644 --- a/Xi/setmode.c +++ b/Xi/setmode.c @@ -113,21 +113,11 @@ ProcXSetDeviceMode(ClientPtr client) return rep.status; } - WriteReplyToClient(client, sizeof(xSetDeviceModeReply), &rep); + if (client->swapped) { + swaps(&rep.sequenceNumber); + swapl(&rep.length); + } + + WriteToClient(client, sizeof(xSetDeviceModeReply), &rep); return Success; } - -/*********************************************************************** - * - * This procedure writes the reply for the XSetDeviceMode function, - * if the client and server have a different byte ordering. - * - */ - -void _X_COLD -SRepXSetDeviceMode(ClientPtr client, int size, xSetDeviceModeReply * rep) -{ - swaps(&rep->sequenceNumber); - swapl(&rep->length); - WriteToClient(client, size, rep); -} diff --git a/Xi/setmode.h b/Xi/setmode.h index cc906c735..68bdddbc5 100644 --- a/Xi/setmode.h +++ b/Xi/setmode.h @@ -33,9 +33,4 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. int ProcXSetDeviceMode(ClientPtr /* client */ ); -void SRepXSetDeviceMode(ClientPtr /* client */ , - int /* size */ , - xSetDeviceModeReply * /* rep */ - ); - #endif /* SETMODE_H */