dix: write out X_GetPointerControl 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:33:47 +02:00
parent 46abb82984
commit 39dcf3e233
4 changed files with 10 additions and 20 deletions

View File

@ -2420,7 +2420,6 @@ ProcGetPointerControl(ClientPtr client)
{ {
DeviceIntPtr ptr = PickPointer(client); DeviceIntPtr ptr = PickPointer(client);
PtrCtrl *ctrl; PtrCtrl *ctrl;
xGetPointerControlReply rep;
int rc; int rc;
if (ptr->ptrfeed) if (ptr->ptrfeed)
@ -2434,7 +2433,7 @@ ProcGetPointerControl(ClientPtr client)
if (rc != Success) if (rc != Success)
return rc; return rc;
rep = (xGetPointerControlReply) { xGetPointerControlReply rep = {
.type = X_Reply, .type = X_Reply,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = 0, .length = 0,
@ -2442,7 +2441,14 @@ ProcGetPointerControl(ClientPtr client)
.accelDenominator = ctrl->den, .accelDenominator = ctrl->den,
.threshold = ctrl->threshold .threshold = ctrl->threshold
}; };
WriteReplyToClient(client, sizeof(xGenericReply), &rep);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.accelNumerator);
swaps(&rep.accelDenominator);
swaps(&rep.threshold);
}
WriteToClient(client, sizeof(rep), &rep);
return Success; return Success;
} }

View File

@ -535,17 +535,6 @@ SListExtensionsReply(ClientPtr pClient, int size, xListExtensionsReply * pRep)
WriteToClient(pClient, size, pRep); WriteToClient(pClient, size, pRep);
} }
void _X_COLD
SGetPointerControlReply(ClientPtr pClient, int size,
xGetPointerControlReply * pRep)
{
swaps(&pRep->sequenceNumber);
swaps(&pRep->accelNumerator);
swaps(&pRep->accelDenominator);
swaps(&pRep->threshold);
WriteToClient(pClient, size, pRep);
}
void _X_COLD void _X_COLD
SGetScreenSaverReply(ClientPtr pClient, int size, xGetScreenSaverReply * pRep) SGetScreenSaverReply(ClientPtr pClient, int size, xGetScreenSaverReply * pRep)
{ {

View File

@ -821,7 +821,7 @@ ReplySwapPtr ReplySwapVector[256] = {
ReplyNotSwappd, ReplyNotSwappd,
ReplyNotSwappd, ReplyNotSwappd,
ReplyNotSwappd, /* 105 */ ReplyNotSwappd, /* 105 */
(ReplySwapPtr) SGetPointerControlReply, ReplyNotSwappd,
ReplyNotSwappd, ReplyNotSwappd,
(ReplySwapPtr) SGetScreenSaverReply, (ReplySwapPtr) SGetScreenSaverReply,
ReplyNotSwappd, ReplyNotSwappd,

View File

@ -154,11 +154,6 @@ extern void SListExtensionsReply(ClientPtr /* pClient */ ,
int /* size */ , int /* size */ ,
xListExtensionsReply * /* pRep */ ); xListExtensionsReply * /* pRep */ );
extern void SGetPointerControlReply(ClientPtr /* pClient */ ,
int /* size */ ,
xGetPointerControlReply *
/* pRep */ );
extern void SGetScreenSaverReply(ClientPtr /* pClient */ , extern void SGetScreenSaverReply(ClientPtr /* pClient */ ,
int /* size */ , int /* size */ ,
xGetScreenSaverReply * /* pRep */ ); xGetScreenSaverReply * /* pRep */ );