From 0b585587a213f0693cc10d15059f6dbc3b3b6bf8 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Fri, 4 Apr 2025 18:52:05 +0200 Subject: [PATCH] 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 --- dix/events.c | 17 +++++++++++++---- dix/swaprep.c | 14 -------------- dix/tables.c | 2 +- include/swaprep.h | 5 ----- 4 files changed, 14 insertions(+), 24 deletions(-) diff --git a/dix/events.c b/dix/events.c index 688771645..786611273 100644 --- a/dix/events.c +++ b/dix/events.c @@ -5349,7 +5349,6 @@ ProcUngrabKeyboard(ClientPtr client) int ProcQueryPointer(ClientPtr client) { - xQueryPointerReply rep; WindowPtr pWin, t; DeviceIntPtr mouse = PickPointer(client); DeviceIntPtr keyboard; @@ -5371,7 +5370,8 @@ ProcQueryPointer(ClientPtr client) pSprite = mouse->spriteInfo->sprite; if (mouse->valuator->motionHintWindow) MaybeStopHint(mouse, client); - rep = (xQueryPointerReply) { + + xQueryPointerReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, @@ -5417,8 +5417,17 @@ ProcQueryPointer(ClientPtr client) 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; } diff --git a/dix/swaprep.c b/dix/swaprep.c index 3d8cdb5b6..bdbf69acb 100644 --- a/dix/swaprep.c +++ b/dix/swaprep.c @@ -201,20 +201,6 @@ SListPropertiesReply(ClientPtr pClient, int size, xListPropertiesReply * 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 SwapTimecoord(xTimecoord * pCoord) { diff --git a/dix/tables.c b/dix/tables.c index 0b5bc2abf..e533ae82b 100644 --- a/dix/tables.c +++ b/dix/tables.c @@ -753,7 +753,7 @@ ReplySwapPtr ReplySwapVector[256] = { ReplyNotSwappd, /* 35 */ ReplyNotSwappd, ReplyNotSwappd, - (ReplySwapPtr) SQueryPointerReply, + ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, /* 40 */ ReplyNotSwappd, diff --git a/include/swaprep.h b/include/swaprep.h index 452ca21a7..55e0795b0 100644 --- a/include/swaprep.h +++ b/include/swaprep.h @@ -51,11 +51,6 @@ extern void SGetPropertyReply(ClientPtr /* pClient */ , extern void SListPropertiesReply(ClientPtr /* pClient */ , int /* size */ , xListPropertiesReply * /* pRep */ ); - -extern void SQueryPointerReply(ClientPtr /* pClient */ , - int /* size */ , - xQueryPointerReply * /* pRep */ ); - extern void SwapTimeCoordWrite(ClientPtr /* pClient */ , int /* size */ , xTimecoord * /* pRep */ );