dix: write out X_GetPointerMapping 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:07:37 +02:00
parent 1ef0e46cbc
commit c8ea12d436
4 changed files with 11 additions and 20 deletions

View File

@ -1996,7 +1996,6 @@ ProcGetKeyboardMapping(ClientPtr client)
int
ProcGetPointerMapping(ClientPtr client)
{
xGetPointerMappingReply rep;
/* Apps may get different values each time they call GetPointerMapping as
* the ClientPointer could change. */
@ -2012,14 +2011,20 @@ ProcGetPointerMapping(ClientPtr client)
return rc;
nElts = (butc) ? butc->numButtons : 0;
rep = (xGetPointerMappingReply) {
xGetPointerMappingReply rep = {
.type = X_Reply,
.nElts = nElts,
.sequenceNumber = client->sequence,
.length = ((unsigned) nElts + (4 - 1)) / 4
};
WriteReplyToClient(client, sizeof(xGetPointerMappingReply), &rep);
if (butc)
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
WriteToClient(client, sizeof(rep), &rep);
WriteToClient(client, nElts, &butc->map[1]);
return Success;
}

View File

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

View File

@ -832,7 +832,7 @@ ReplySwapPtr ReplySwapVector[256] = {
ReplyNotSwappd,
ReplyNotSwappd, /* 115 */
ReplyNotSwappd,
(ReplySwapPtr) SGetPointerMappingReply,
ReplyNotSwappd,
ReplyNotSwappd,
ReplyNotSwappd, /* 119 */
ReplyNotSwappd, /* 120 */

View File

@ -159,11 +159,6 @@ extern void SGetKeyboardMappingReply(ClientPtr /* pClient */ ,
xGetKeyboardMappingReply *
/* pRep */ );
extern void SGetPointerMappingReply(ClientPtr /* pClient */ ,
int /* size */ ,
xGetPointerMappingReply *
/* pRep */ );
extern void SGetKeyboardControlReply(ClientPtr /* pClient */ ,
int /* size */ ,
xGetKeyboardControlReply *