dix: write out X_GetKeyboardMapping reply directly

No need for using a complex callback machinery, if we just move the
little pieces of byte-swapping directly into the request handler.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-04-03 16:13:17 +02:00
parent c8ea12d436
commit 5829703de2
4 changed files with 9 additions and 18 deletions

View File

@ -1945,7 +1945,6 @@ ProcSetPointerMapping(ClientPtr client)
int
ProcGetKeyboardMapping(ClientPtr client)
{
xGetKeyboardMappingReply rep;
DeviceIntPtr kbd = PickKeyboard(client);
XkbDescPtr xkb;
KeySymsPtr syms;
@ -1974,14 +1973,20 @@ ProcGetKeyboardMapping(ClientPtr client)
if (!syms)
return BadAlloc;
rep = (xGetKeyboardMappingReply) {
xGetKeyboardMappingReply rep = {
.type = X_Reply,
.keySymsPerKeyCode = syms->mapWidth,
.sequenceNumber = client->sequence,
/* length is a count of 4 byte quantities and KeySyms are 4 bytes */
.length = syms->mapWidth * stuff->count
};
WriteReplyToClient(client, sizeof(xGetKeyboardMappingReply), &rep);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
WriteToClient(client, sizeof(rep), &rep);
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
WriteSwappedDataToClient(client,
syms->mapWidth * stuff->count * sizeof(KeySym),

View File

@ -535,15 +535,6 @@ SListExtensionsReply(ClientPtr pClient, int size, xListExtensionsReply * pRep)
WriteToClient(pClient, size, pRep);
}
void _X_COLD
SGetKeyboardMappingReply(ClientPtr pClient, int size,
xGetKeyboardMappingReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->length);
WriteToClient(pClient, size, pRep);
}
void _X_COLD
SGetKeyboardControlReply(ClientPtr pClient, int size,
xGetKeyboardControlReply * pRep)

View File

@ -816,7 +816,7 @@ ReplySwapPtr ReplySwapVector[256] = {
(ReplySwapPtr) SGenericReply, /* SQueryExtensionReply, */
(ReplySwapPtr) SListExtensionsReply,
ReplyNotSwappd, /* 100 */
(ReplySwapPtr) SGetKeyboardMappingReply,
ReplyNotSwappd,
ReplyNotSwappd,
(ReplySwapPtr) SGetKeyboardControlReply,
ReplyNotSwappd,

View File

@ -154,11 +154,6 @@ extern void SListExtensionsReply(ClientPtr /* pClient */ ,
int /* size */ ,
xListExtensionsReply * /* pRep */ );
extern void SGetKeyboardMappingReply(ClientPtr /* pClient */ ,
int /* size */ ,
xGetKeyboardMappingReply *
/* pRep */ );
extern void SGetKeyboardControlReply(ClientPtr /* pClient */ ,
int /* size */ ,
xGetKeyboardControlReply *