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 <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-04-01 11:17:49 +02:00
parent e226b1396a
commit 7f36272a3d
3 changed files with 7 additions and 26 deletions

View File

@ -421,10 +421,7 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
{ {
/* All we look at is the type field */ /* All we look at is the type field */
/* This is common to all replies */ /* This is common to all replies */
if (rep->RepType == X_GetDeviceKeyMapping) if (rep->RepType == X_GetDeviceModifierMapping)
SRepXGetDeviceKeyMapping(client, len,
(xGetDeviceKeyMappingReply *) rep);
else if (rep->RepType == X_GetDeviceModifierMapping)
SRepXGetDeviceModifierMapping(client, len, SRepXGetDeviceModifierMapping(client, len,
(xGetDeviceModifierMappingReply *) rep); (xGetDeviceModifierMappingReply *) rep);
else if (rep->RepType == X_SetDeviceModifierMapping) else if (rep->RepType == X_SetDeviceModifierMapping)

View File

@ -108,7 +108,12 @@ ProcXGetDeviceKeyMapping(ClientPtr client)
.keySymsPerKeyCode = syms->mapWidth, .keySymsPerKeyCode = syms->mapWidth,
.length = (syms->mapWidth * stuff->count) /* KeySyms are 4 bytes */ .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; client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
WriteSwappedDataToClient(client, WriteSwappedDataToClient(client,
@ -120,19 +125,3 @@ ProcXGetDeviceKeyMapping(ClientPtr client)
return Success; 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);
}

View File

@ -33,9 +33,4 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
int ProcXGetDeviceKeyMapping(ClientPtr /* client */ int ProcXGetDeviceKeyMapping(ClientPtr /* client */
); );
void SRepXGetDeviceKeyMapping(ClientPtr /* client */ ,
int /* size */ ,
xGetDeviceKeyMappingReply * /* rep */
);
#endif /* GETKMAP_H */ #endif /* GETKMAP_H */