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:41:29 +02:00
parent 39dcf3e233
commit 13bec61739
4 changed files with 16 additions and 23 deletions

View File

@ -2473,7 +2473,6 @@ ProcGetMotionEvents(ClientPtr client)
{
WindowPtr pWin;
xTimecoord *coords = (xTimecoord *) NULL;
xGetMotionEventsReply rep;
int i, count, xmin, xmax, ymin, ymax, rc;
unsigned long nEvents;
DeviceIntPtr mouse = PickPointer(client);
@ -2492,10 +2491,7 @@ ProcGetMotionEvents(ClientPtr client)
UpdateCurrentTimeIf();
if (mouse->valuator->motionHintWindow)
MaybeStopHint(mouse, client);
rep = (xGetMotionEventsReply) {
.type = X_Reply,
.sequenceNumber = client->sequence
};
nEvents = 0;
start = ClientTimeToServerTime(stuff->start);
stop = ClientTimeToServerTime(stuff->stop);
@ -2522,9 +2518,20 @@ ProcGetMotionEvents(ClientPtr client)
nEvents++;
}
}
rep.length = nEvents * bytes_to_int32(sizeof(xTimecoord));
rep.nEvents = nEvents;
WriteReplyToClient(client, sizeof(xGetMotionEventsReply), &rep);
xGetMotionEventsReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = nEvents * bytes_to_int32(sizeof(xTimecoord)),
.nEvents = nEvents,
};
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.nEvents);
}
WriteToClient(client, sizeof(xGetMotionEventsReply), &rep);
if (nEvents) {
client->pSwapReplyFunc = (ReplySwapPtr) SwapTimeCoordWrite;
WriteSwappedDataToClient(client, nEvents * sizeof(xTimecoord),

View File

@ -287,15 +287,6 @@ SwapTimeCoordWrite(ClientPtr pClient, int size, xTimecoord * pRep)
}
void _X_COLD
SGetMotionEventsReply(ClientPtr pClient, int size, xGetMotionEventsReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->length);
swapl(&pRep->nEvents);
WriteToClient(pClient, size, pRep);
}
void _X_COLD
SGetInputFocusReply(ClientPtr pClient, int size, xGetInputFocusReply * pRep)
{

View File

@ -754,7 +754,7 @@ ReplySwapPtr ReplySwapVector[256] = {
ReplyNotSwappd,
ReplyNotSwappd,
(ReplySwapPtr) SQueryPointerReply,
(ReplySwapPtr) SGetMotionEventsReply,
ReplyNotSwappd,
ReplyNotSwappd, /* 40 */
ReplyNotSwappd,
ReplyNotSwappd,

View File

@ -75,11 +75,6 @@ extern void SwapTimeCoordWrite(ClientPtr /* pClient */ ,
int /* size */ ,
xTimecoord * /* pRep */ );
extern void SGetMotionEventsReply(ClientPtr /* pClient */ ,
int /* size */ ,
xGetMotionEventsReply * /* pRep */
);
extern void SGetInputFocusReply(ClientPtr /* pClient */ ,
int /* size */ ,
xGetInputFocusReply * /* pRep */ );