dix: write out TranslateCoordsReply directly

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:15:21 +02:00
parent d07e8dfd9a
commit 1df9010e6b
5 changed files with 19 additions and 22 deletions

View File

@@ -621,7 +621,6 @@ PanoramiXTranslateCoords(ClientPtr client)
REQUEST(xTranslateCoordsReq);
int rc;
WindowPtr pWin, pDst;
xTranslateCoordsReply rep;
REQUEST_SIZE_MATCH(xTranslateCoordsReq);
rc = dixLookupWindow(&pWin, stuff->srcWid, client, DixReadAccess);
@@ -630,7 +629,8 @@ PanoramiXTranslateCoords(ClientPtr client)
rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixReadAccess);
if (rc != Success)
return rc;
rep = (xTranslateCoordsReply) {
xTranslateCoordsReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
@@ -681,7 +681,13 @@ PanoramiXTranslateCoords(ClientPtr client)
rep.dstY += screenInfo.screens[0]->y;
}
WriteReplyToClient(client, sizeof(xTranslateCoordsReply), &rep);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.child);
swaps(&rep.dstX);
swaps(&rep.dstY);
}
WriteToClient(client, sizeof(rep), &rep);
return Success;
}

View File

@@ -1232,7 +1232,6 @@ ProcTranslateCoords(ClientPtr client)
REQUEST(xTranslateCoordsReq);
WindowPtr pWin, pDst;
xTranslateCoordsReply rep;
int rc;
REQUEST_SIZE_MATCH(xTranslateCoordsReq);
@@ -1243,7 +1242,7 @@ ProcTranslateCoords(ClientPtr client)
if (rc != Success)
return rc;
rep = (xTranslateCoordsReply) {
xTranslateCoordsReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0
@@ -1294,7 +1293,14 @@ ProcTranslateCoords(ClientPtr client)
rep.dstX = x - pDst->drawable.x;
rep.dstY = y - pDst->drawable.y;
}
WriteReplyToClient(client, sizeof(xTranslateCoordsReply), &rep);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.child);
swaps(&rep.dstX);
swaps(&rep.dstY);
}
WriteToClient(client, sizeof(rep), &rep);
return Success;
}

View File

@@ -305,16 +305,6 @@ SGetMotionEventsReply(ClientPtr pClient, int size, xGetMotionEventsReply * pRep)
WriteToClient(pClient, size, pRep);
}
void _X_COLD
STranslateCoordsReply(ClientPtr pClient, int size, xTranslateCoordsReply * pRep)
{
swaps(&pRep->sequenceNumber);
swapl(&pRep->child);
swaps(&pRep->dstX);
swaps(&pRep->dstY);
WriteToClient(pClient, size, pRep);
}
void _X_COLD
SGetInputFocusReply(ClientPtr pClient, int size, xGetInputFocusReply * pRep)
{

View File

@@ -756,7 +756,7 @@ ReplySwapPtr ReplySwapVector[256] = {
ReplyNotSwappd,
(ReplySwapPtr) SQueryPointerReply,
(ReplySwapPtr) SGetMotionEventsReply,
(ReplySwapPtr) STranslateCoordsReply, /* 40 */
ReplyNotSwappd, /* 40 */
ReplyNotSwappd,
ReplyNotSwappd,
(ReplySwapPtr) SGetInputFocusReply,

View File

@@ -85,11 +85,6 @@ extern void SGetMotionEventsReply(ClientPtr /* pClient */ ,
xGetMotionEventsReply * /* pRep */
);
extern void STranslateCoordsReply(ClientPtr /* pClient */ ,
int /* size */ ,
xTranslateCoordsReply * /* pRep */
);
extern void SGetInputFocusReply(ClientPtr /* pClient */ ,
int /* size */ ,
xGetInputFocusReply * /* pRep */ );