dix: write out X_QueryKeymap 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 17:12:58 +02:00
parent 13bec61739
commit 71139c015e
4 changed files with 8 additions and 17 deletions

View File

@ -2544,13 +2544,13 @@ ProcGetMotionEvents(ClientPtr client)
int
ProcQueryKeymap(ClientPtr client)
{
xQueryKeymapReply rep;
int rc, i;
DeviceIntPtr keybd = PickKeyboard(client);
CARD8 *down = keybd->key->down;
REQUEST_SIZE_MATCH(xReq);
rep = (xQueryKeymapReply) {
xQueryKeymapReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 2
@ -2567,7 +2567,11 @@ ProcQueryKeymap(ClientPtr client)
else if (rc != BadAccess)
return rc;
WriteReplyToClient(client, sizeof(xQueryKeymapReply), &rep);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
WriteToClient(client, sizeof(rep), &rep);
return Success;
}

View File

@ -295,15 +295,6 @@ SGetInputFocusReply(ClientPtr pClient, int size, xGetInputFocusReply * pRep)
WriteToClient(pClient, size, pRep);
}
/* extra long reply */
void _X_COLD
SQueryKeymapReply(ClientPtr pClient, int size, xQueryKeymapReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->length);
WriteToClient(pClient, size, pRep);
}
static void _X_COLD
SwapCharInfo(xCharInfo * pInfo)
{

View File

@ -759,7 +759,7 @@ ReplySwapPtr ReplySwapVector[256] = {
ReplyNotSwappd,
ReplyNotSwappd,
(ReplySwapPtr) SGetInputFocusReply,
(ReplySwapPtr) SQueryKeymapReply,
ReplyNotSwappd,
ReplyNotSwappd, /* 45 */
ReplyNotSwappd,
(ReplySwapPtr) SQueryFontReply,

View File

@ -79,10 +79,6 @@ extern void SGetInputFocusReply(ClientPtr /* pClient */ ,
int /* size */ ,
xGetInputFocusReply * /* pRep */ );
extern void SQueryKeymapReply(ClientPtr /* pClient */ ,
int /* size */ ,
xQueryKeymapReply * /* pRep */ );
extern void SQueryFontReply(ClientPtr /* pClient */ ,
int /* size */ ,
xQueryFontReply * /* pRep */ );