dix: write out X_QueryPointer 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-04 18:52:05 +02:00
parent ec118ccbb8
commit 0b585587a2
4 changed files with 14 additions and 24 deletions

View File

@ -5349,7 +5349,6 @@ ProcUngrabKeyboard(ClientPtr client)
int int
ProcQueryPointer(ClientPtr client) ProcQueryPointer(ClientPtr client)
{ {
xQueryPointerReply rep;
WindowPtr pWin, t; WindowPtr pWin, t;
DeviceIntPtr mouse = PickPointer(client); DeviceIntPtr mouse = PickPointer(client);
DeviceIntPtr keyboard; DeviceIntPtr keyboard;
@ -5371,7 +5370,8 @@ ProcQueryPointer(ClientPtr client)
pSprite = mouse->spriteInfo->sprite; pSprite = mouse->spriteInfo->sprite;
if (mouse->valuator->motionHintWindow) if (mouse->valuator->motionHintWindow)
MaybeStopHint(mouse, client); MaybeStopHint(mouse, client);
rep = (xQueryPointerReply) {
xQueryPointerReply rep = {
.type = X_Reply, .type = X_Reply,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = 0, .length = 0,
@ -5417,8 +5417,17 @@ ProcQueryPointer(ClientPtr client)
rep.winY = 0; rep.winY = 0;
} }
WriteReplyToClient(client, sizeof(xQueryPointerReply), &rep); if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.root);
swapl(&rep.child);
swaps(&rep.rootX);
swaps(&rep.rootY);
swaps(&rep.winX);
swaps(&rep.winY);
swaps(&rep.mask);
}
WriteToClient(client, sizeof(rep), &rep);
return Success; return Success;
} }

View File

@ -201,20 +201,6 @@ SListPropertiesReply(ClientPtr pClient, int size, xListPropertiesReply * pRep)
WriteToClient(pClient, size, pRep); WriteToClient(pClient, size, pRep);
} }
void _X_COLD
SQueryPointerReply(ClientPtr pClient, int size, xQueryPointerReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->root);
swapl(&pRep->child);
swaps(&pRep->rootX);
swaps(&pRep->rootY);
swaps(&pRep->winX);
swaps(&pRep->winY);
swaps(&pRep->mask);
WriteToClient(pClient, size, pRep);
}
static void _X_COLD static void _X_COLD
SwapTimecoord(xTimecoord * pCoord) SwapTimecoord(xTimecoord * pCoord)
{ {

View File

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

View File

@ -51,11 +51,6 @@ extern void SGetPropertyReply(ClientPtr /* pClient */ ,
extern void SListPropertiesReply(ClientPtr /* pClient */ , extern void SListPropertiesReply(ClientPtr /* pClient */ ,
int /* size */ , int /* size */ ,
xListPropertiesReply * /* pRep */ ); xListPropertiesReply * /* pRep */ );
extern void SQueryPointerReply(ClientPtr /* pClient */ ,
int /* size */ ,
xQueryPointerReply * /* pRep */ );
extern void SwapTimeCoordWrite(ClientPtr /* pClient */ , extern void SwapTimeCoordWrite(ClientPtr /* pClient */ ,
int /* size */ , int /* size */ ,
xTimecoord * /* pRep */ ); xTimecoord * /* pRep */ );