From e226b1396a4db5f078a033dd15b3380f4de3835b Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 1 Apr 2025 11:11:38 +0200 Subject: [PATCH] XI: directly write out X_GetFeedbackControl reply Write out X_GetFeedbackControl 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/getfctl.c | 26 +++++++------------------- Xi/getfctl.h | 5 ----- 3 files changed, 8 insertions(+), 27 deletions(-) diff --git a/Xi/extinit.c b/Xi/extinit.c index 9fa210c17..4a95c7e2a 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_GetFeedbackControl) - SRepXGetFeedbackControl(client, len, (xGetFeedbackControlReply *) rep); - else if (rep->RepType == X_GetDeviceKeyMapping) + if (rep->RepType == X_GetDeviceKeyMapping) SRepXGetDeviceKeyMapping(client, len, (xGetDeviceKeyMappingReply *) rep); else if (rep->RepType == X_GetDeviceModifierMapping) diff --git a/Xi/getfctl.c b/Xi/getfctl.c index f39a481fc..4ffb76226 100644 --- a/Xi/getfctl.c +++ b/Xi/getfctl.c @@ -234,23 +234,6 @@ CopySwapBellFeedback(ClientPtr client, BellFeedbackPtr b, char **buf) *buf += sizeof(xBellFeedbackState); } -/*********************************************************************** - * - * This procedure writes the reply for the xGetFeedbackControl function, - * if the client and server have a different byte ordering. - * - */ - -void _X_COLD -SRepXGetFeedbackControl(ClientPtr client, int size, - xGetFeedbackControlReply * rep) -{ - swaps(&rep->sequenceNumber); - swapl(&rep->length); - swaps(&rep->num_feedbacks); - WriteToClient(client, size, rep); -} - /*********************************************************************** * * Get the feedback control state. @@ -281,7 +264,6 @@ ProcXGetFeedbackControl(ClientPtr client) .repType = X_Reply, .RepType = X_GetFeedbackControl, .sequenceNumber = client->sequence, - .length = 0, .num_feedbacks = 0 }; @@ -333,7 +315,13 @@ ProcXGetFeedbackControl(ClientPtr client) CopySwapBellFeedback(client, b, &buf); rep.length = bytes_to_int32(total_length); - WriteReplyToClient(client, sizeof(xGetFeedbackControlReply), &rep); + + if (client->swapped) { + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swaps(&rep.num_feedbacks); + } + WriteToClient(client, sizeof(xGetFeedbackControlReply), &rep); WriteToClient(client, total_length, savbuf); free(savbuf); return Success; diff --git a/Xi/getfctl.h b/Xi/getfctl.h index 14944d28b..63083432e 100644 --- a/Xi/getfctl.h +++ b/Xi/getfctl.h @@ -33,9 +33,4 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. int ProcXGetFeedbackControl(ClientPtr /* client */ ); -void SRepXGetFeedbackControl(ClientPtr /* client */ , - int /* size */ , - xGetFeedbackControlReply * /* rep */ - ); - #endif /* GETFCTL_H */