From f43b2fdc87c503e0f70b62959bf1b9d590faf362 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 1 Apr 2025 11:45:58 +0200 Subject: [PATCH] XI: directly write out X_GetDeviceButtonMapping reply Write out the X_GetDeviceButtonMapping 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 | 5 +---- Xi/getbmap.c | 22 +++++----------------- Xi/getbmap.h | 5 ----- 3 files changed, 6 insertions(+), 26 deletions(-) diff --git a/Xi/extinit.c b/Xi/extinit.c index 74d7a9c92..7e97fa4b2 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_GetDeviceButtonMapping) - SRepXGetDeviceButtonMapping(client, len, - (xGetDeviceButtonMappingReply *) rep); - else if (rep->RepType == X_SetDeviceButtonMapping) + if (rep->RepType == X_SetDeviceButtonMapping) SRepXSetDeviceButtonMapping(client, len, (xSetDeviceButtonMappingReply *) rep); else if (rep->RepType == X_QueryDeviceState) diff --git a/Xi/getbmap.c b/Xi/getbmap.c index db7583b73..77ea8ec82 100644 --- a/Xi/getbmap.c +++ b/Xi/getbmap.c @@ -91,23 +91,11 @@ ProcXGetDeviceButtonMapping(ClientPtr client) .length = bytes_to_int32(b->numButtons), }; - WriteReplyToClient(client, sizeof(xGetDeviceButtonMappingReply), &rep); + if (client->swapped) { + swaps(&rep.sequenceNumber); + swapl(&rep.length); + } + WriteToClient(client, sizeof(xGetDeviceButtonMappingReply), &rep); WriteToClient(client, rep.nElts, &b->map[1]); return Success; } - -/*********************************************************************** - * - * This procedure writes the reply for the XGetDeviceButtonMapping function, - * if the client and server have a different byte ordering. - * - */ - -void _X_COLD -SRepXGetDeviceButtonMapping(ClientPtr client, int size, - xGetDeviceButtonMappingReply * rep) -{ - swaps(&rep->sequenceNumber); - swapl(&rep->length); - WriteToClient(client, size, rep); -} diff --git a/Xi/getbmap.h b/Xi/getbmap.h index a320c7421..78cb15198 100644 --- a/Xi/getbmap.h +++ b/Xi/getbmap.h @@ -33,9 +33,4 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. int ProcXGetDeviceButtonMapping(ClientPtr /* client */ ); -void SRepXGetDeviceButtonMapping(ClientPtr /* client */ , - int /* size */ , - xGetDeviceButtonMappingReply * /* rep */ - ); - #endif /* GETBMAP_H */