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

View File

@ -544,15 +544,6 @@ SGetKeyboardMappingReply(ClientPtr pClient, int size,
WriteToClient(pClient, size, pRep); 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 void _X_COLD
SGetKeyboardControlReply(ClientPtr pClient, int size, SGetKeyboardControlReply(ClientPtr pClient, int size,
xGetKeyboardControlReply * pRep) xGetKeyboardControlReply * pRep)

View File

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

View File

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