From d07e8dfd9a07e5983b761b1eb6efeac24122429f Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Wed, 2 Apr 2025 20:05:59 +0200 Subject: [PATCH] dix: write out xGetGeometryReply directly Signed-off-by: Enrico Weigelt, metux IT consult --- Xext/panoramiXprocs.c | 14 +++++++++++--- dix/dispatch.c | 11 ++++++++++- dix/swaprep.c | 13 ------------- dix/tables.c | 2 +- include/swaprep.h | 4 ---- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c index a3fc4bc6e5..c1df20ae35 100644 --- a/Xext/panoramiXprocs.c +++ b/Xext/panoramiXprocs.c @@ -556,7 +556,6 @@ PanoramiXCirculateWindow(ClientPtr client) int PanoramiXGetGeometry(ClientPtr client) { - xGetGeometryReply rep; DrawablePtr pDraw; int rc; @@ -567,7 +566,7 @@ PanoramiXGetGeometry(ClientPtr client) if (rc != Success) return rc; - rep = (xGetGeometryReply) { + xGetGeometryReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, @@ -601,7 +600,16 @@ PanoramiXGetGeometry(ClientPtr client) rep.borderWidth = pWin->borderWidth; } - WriteReplyToClient(client, sizeof(xGetGeometryReply), &rep); + if (client->swapped) { + swaps(&rep.sequenceNumber); + swapl(&rep.root); + swaps(&rep.x); + swaps(&rep.y); + swaps(&rep.width); + swaps(&rep.height); + swaps(&rep.borderWidth); + } + WriteToClient(client, sizeof(xGetGeometryReply), &rep); return Success; } diff --git a/dix/dispatch.c b/dix/dispatch.c index 6d8123cdf9..c9b58a353a 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -1043,7 +1043,16 @@ ProcGetGeometry(ClientPtr client) rep.borderWidth = pWin->borderWidth; } - WriteReplyToClient(client, sizeof(xGetGeometryReply), &rep); + if (client->swapped) { + swaps(&rep.sequenceNumber); + swapl(&rep.root); + swaps(&rep.x); + swaps(&rep.y); + swaps(&rep.width); + swaps(&rep.height); + swaps(&rep.borderWidth); + } + WriteToClient(client, sizeof(xGetGeometryReply), &rep); return Success; } diff --git a/dix/swaprep.c b/dix/swaprep.c index b9afa14a23..03e0aaaf95 100644 --- a/dix/swaprep.c +++ b/dix/swaprep.c @@ -201,19 +201,6 @@ SGetWindowAttributesReply(ClientPtr pClient, int size, WriteToClient(pClient, size, pRep); } -void _X_COLD -SGetGeometryReply(ClientPtr pClient, int size, xGetGeometryReply * pRep) -{ - swaps(&pRep->sequenceNumber); - swapl(&pRep->root); - swaps(&pRep->x); - swaps(&pRep->y); - swaps(&pRep->width); - swaps(&pRep->height); - swaps(&pRep->borderWidth); - WriteToClient(pClient, size, pRep); -} - void _X_COLD SQueryTreeReply(ClientPtr pClient, int size, xQueryTreeReply * pRep) { diff --git a/dix/tables.c b/dix/tables.c index c9b6b2ec6e..e82a41ed1e 100644 --- a/dix/tables.c +++ b/dix/tables.c @@ -730,7 +730,7 @@ ReplySwapPtr ReplySwapVector[256] = { ReplyNotSwappd, ReplyNotSwappd, ReplyNotSwappd, - (ReplySwapPtr) SGetGeometryReply, + ReplyNotSwappd, (ReplySwapPtr) SQueryTreeReply, /* 15 */ (ReplySwapPtr) SInternAtomReply, (ReplySwapPtr) SGetAtomNameReply, diff --git a/include/swaprep.h b/include/swaprep.h index 63c54c7fb3..db3e37ae10 100644 --- a/include/swaprep.h +++ b/include/swaprep.h @@ -47,10 +47,6 @@ extern void SGetWindowAttributesReply(ClientPtr /* pClient */ , xGetWindowAttributesReply * /* pRep */ ); -extern void SGetGeometryReply(ClientPtr /* pClient */ , - int /* size */ , - xGetGeometryReply * /* pRep */ ); - extern void SQueryTreeReply(ClientPtr /* pClient */ , int /* size */ , xQueryTreeReply * /* pRep */ );