From 7f36272a3d9e264edb81e18745c7faf4c1761370 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 1 Apr 2025 11:17:49 +0200 Subject: [PATCH] XI: directly write out X_GetDeviceKeyMapping reply Write out X_GetDeviceKeyMapping 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 | 5 +---- Xi/getkmap.c | 23 ++++++----------------- Xi/getkmap.h | 5 ----- 3 files changed, 7 insertions(+), 26 deletions(-) diff --git a/Xi/extinit.c b/Xi/extinit.c index 4a95c7e2a..fe1a5778f 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_GetDeviceKeyMapping) - SRepXGetDeviceKeyMapping(client, len, - (xGetDeviceKeyMappingReply *) rep); - else if (rep->RepType == X_GetDeviceModifierMapping) + if (rep->RepType == X_GetDeviceModifierMapping) SRepXGetDeviceModifierMapping(client, len, (xGetDeviceModifierMappingReply *) rep); else if (rep->RepType == X_SetDeviceModifierMapping) diff --git a/Xi/getkmap.c b/Xi/getkmap.c index b740450aa..5b47a1f5f 100644 --- a/Xi/getkmap.c +++ b/Xi/getkmap.c @@ -108,7 +108,12 @@ ProcXGetDeviceKeyMapping(ClientPtr client) .keySymsPerKeyCode = syms->mapWidth, .length = (syms->mapWidth * stuff->count) /* KeySyms are 4 bytes */ }; - WriteReplyToClient(client, sizeof(xGetDeviceKeyMappingReply), &rep); + + if (client->swapped) { + swaps(&rep.sequenceNumber); + swapl(&rep.length); + } + WriteToClient(client, sizeof(xGetDeviceKeyMappingReply), &rep); client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write; WriteSwappedDataToClient(client, @@ -120,19 +125,3 @@ ProcXGetDeviceKeyMapping(ClientPtr client) return Success; } - -/*********************************************************************** - * - * This procedure writes the reply for the XGetDeviceKeyMapping function, - * if the client and server have a different byte ordering. - * - */ - -void _X_COLD -SRepXGetDeviceKeyMapping(ClientPtr client, int size, - xGetDeviceKeyMappingReply * rep) -{ - swaps(&rep->sequenceNumber); - swapl(&rep->length); - WriteToClient(client, size, rep); -} diff --git a/Xi/getkmap.h b/Xi/getkmap.h index f51e0e96d..74e2e5b78 100644 --- a/Xi/getkmap.h +++ b/Xi/getkmap.h @@ -33,9 +33,4 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. int ProcXGetDeviceKeyMapping(ClientPtr /* client */ ); -void SRepXGetDeviceKeyMapping(ClientPtr /* client */ , - int /* size */ , - xGetDeviceKeyMappingReply * /* rep */ - ); - #endif /* GETKMAP_H */