From b06fc7e68cae97f8178840df19497384548e96c9 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 X_GetGeometry 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 --- 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 b72005969..d93eedaba 100644 --- a/Xext/panoramiXprocs.c +++ b/Xext/panoramiXprocs.c @@ -557,7 +557,6 @@ PanoramiXCirculateWindow(ClientPtr client) int PanoramiXGetGeometry(ClientPtr client) { - xGetGeometryReply rep; DrawablePtr pDraw; int rc; @@ -568,7 +567,7 @@ PanoramiXGetGeometry(ClientPtr client) if (rc != Success) return rc; - rep = (xGetGeometryReply) { + xGetGeometryReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, @@ -602,7 +601,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 ff8bf989e..9988c069d 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -1030,7 +1030,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 2f9c636d3..8cf6555e1 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 634018ceb..468d691ce 100644 --- a/dix/tables.c +++ b/dix/tables.c @@ -729,7 +729,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 63c54c7fb..db3e37ae1 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 */ );