From b573dfb6e488ef909585a64abe9eca5b090fa06a Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 1 Apr 2025 12:31:17 +0200 Subject: [PATCH] XI: directly write out X_ChangeDeviceControl reply Write out the X_ChangeDeviceControl 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/chgdctl.c | 22 ++++------------------ Xi/chgdctl.h | 5 ----- Xi/extinit.c | 5 +---- 3 files changed, 5 insertions(+), 27 deletions(-) diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c index e53e6c224..74dce0da5 100644 --- a/Xi/chgdctl.c +++ b/Xi/chgdctl.c @@ -130,7 +130,6 @@ ProcXChangeDeviceControl(ClientPtr client) .repType = X_Reply, .RepType = X_ChangeDeviceControl, .sequenceNumber = client->sequence, - .length = 0, .status = Success, }; @@ -232,24 +231,11 @@ ProcXChangeDeviceControl(ClientPtr client) SendEventToAllWindows(dev, DevicePresenceNotifyMask, (xEvent *) &dpn, 1); - WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), &rep); + if (client->swapped) { + swaps(&rep.sequenceNumber); + } + WriteToClient(client, sizeof(xChangeDeviceControlReply), &rep); } return ret; } - -/*********************************************************************** - * - * This procedure writes the reply for the xChangeDeviceControl function, - * if the client and server have a different byte ordering. - * - */ - -void _X_COLD -SRepXChangeDeviceControl(ClientPtr client, int size, - xChangeDeviceControlReply * rep) -{ - swaps(&rep->sequenceNumber); - swapl(&rep->length); - WriteToClient(client, size, rep); -} diff --git a/Xi/chgdctl.h b/Xi/chgdctl.h index f5ca5e766..3924f7251 100644 --- a/Xi/chgdctl.h +++ b/Xi/chgdctl.h @@ -36,9 +36,4 @@ int SProcXChangeDeviceControl(ClientPtr /* client */ int ProcXChangeDeviceControl(ClientPtr /* client */ ); -void SRepXChangeDeviceControl(ClientPtr /* client */ , - int /* size */ , - xChangeDeviceControlReply * /* rep */ - ); - #endif /* CHGDCTL_H */ diff --git a/Xi/extinit.c b/Xi/extinit.c index 7a37a8ce7..a1f6392ed 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -421,10 +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_ChangeDeviceControl) - SRepXChangeDeviceControl(client, len, - (xChangeDeviceControlReply *) rep); - else if (rep->RepType == X_ListDeviceProperties) + if (rep->RepType == X_ListDeviceProperties) SRepXListDeviceProperties(client, len, (xListDevicePropertiesReply *) rep); else if (rep->RepType == X_GetDeviceProperty)