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 <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-04-02 20:05:59 +02:00
parent 923de1a7a4
commit b06fc7e68c
5 changed files with 22 additions and 22 deletions

View File

@ -557,7 +557,6 @@ PanoramiXCirculateWindow(ClientPtr client)
int int
PanoramiXGetGeometry(ClientPtr client) PanoramiXGetGeometry(ClientPtr client)
{ {
xGetGeometryReply rep;
DrawablePtr pDraw; DrawablePtr pDraw;
int rc; int rc;
@ -568,7 +567,7 @@ PanoramiXGetGeometry(ClientPtr client)
if (rc != Success) if (rc != Success)
return rc; return rc;
rep = (xGetGeometryReply) { xGetGeometryReply rep = {
.type = X_Reply, .type = X_Reply,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = 0, .length = 0,
@ -602,7 +601,16 @@ PanoramiXGetGeometry(ClientPtr client)
rep.borderWidth = pWin->borderWidth; 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; return Success;
} }

View File

@ -1030,7 +1030,16 @@ ProcGetGeometry(ClientPtr client)
rep.borderWidth = pWin->borderWidth; 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; return Success;
} }

View File

@ -201,19 +201,6 @@ SGetWindowAttributesReply(ClientPtr pClient, int size,
WriteToClient(pClient, size, pRep); 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 void _X_COLD
SQueryTreeReply(ClientPtr pClient, int size, xQueryTreeReply * pRep) SQueryTreeReply(ClientPtr pClient, int size, xQueryTreeReply * pRep)
{ {

View File

@ -729,7 +729,7 @@ ReplySwapPtr ReplySwapVector[256] = {
ReplyNotSwappd, ReplyNotSwappd,
ReplyNotSwappd, ReplyNotSwappd,
ReplyNotSwappd, ReplyNotSwappd,
(ReplySwapPtr) SGetGeometryReply, ReplyNotSwappd,
(ReplySwapPtr) SQueryTreeReply, /* 15 */ (ReplySwapPtr) SQueryTreeReply, /* 15 */
(ReplySwapPtr) SInternAtomReply, (ReplySwapPtr) SInternAtomReply,
(ReplySwapPtr) SGetAtomNameReply, (ReplySwapPtr) SGetAtomNameReply,

View File

@ -47,10 +47,6 @@ extern void SGetWindowAttributesReply(ClientPtr /* pClient */ ,
xGetWindowAttributesReply * xGetWindowAttributesReply *
/* pRep */ ); /* pRep */ );
extern void SGetGeometryReply(ClientPtr /* pClient */ ,
int /* size */ ,
xGetGeometryReply * /* pRep */ );
extern void SQueryTreeReply(ClientPtr /* pClient */ , extern void SQueryTreeReply(ClientPtr /* pClient */ ,
int /* size */ , int /* size */ ,
xQueryTreeReply * /* pRep */ ); xQueryTreeReply * /* pRep */ );