From 475d53fb58e096821c9b769e30ad2cdcbaec429b Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Fri, 18 Jul 2025 13:03:52 +0200 Subject: [PATCH] panoramix: clean up PanoramiXTranslateCoords() variable declarations * declare and assign in one shot * move down reply struct declaration to where it's needed Signed-off-by: Enrico Weigelt, metux IT consult --- Xext/panoramiXprocs.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c index 61b6b41260..cace1982e3 100644 --- a/Xext/panoramiXprocs.c +++ b/Xext/panoramiXprocs.c @@ -631,14 +631,6 @@ PanoramiXTranslateCoords(ClientPtr client) if (rc != Success) return rc; - xTranslateCoordsReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .sameScreen = xTrue, - .child = None - }; - if ((pWin == screenInfo.screens[0]->root) || (pWin->drawable.id == screenInfo.screens[0]->screensaver.wid)) { x = stuff->srcX - screenInfo.screens[0]->x; @@ -649,6 +641,8 @@ PanoramiXTranslateCoords(ClientPtr client) y = pWin->drawable.y + stuff->srcY; } pWin = pDst->firstChild; + + XID child = None; while (pWin) { BoxRec box; @@ -668,20 +662,31 @@ PanoramiXTranslateCoords(ClientPtr client) x - pWin->drawable.x, y - pWin->drawable.y, &box)) ) { - rep.child = pWin->drawable.id; + child = pWin->drawable.id; pWin = (WindowPtr) NULL; } else pWin = pWin->nextSib; } - rep.dstX = x - pDst->drawable.x; - rep.dstY = y - pDst->drawable.y; + + INT16 dstX = x - pDst->drawable.x; + INT16 dstY = y - pDst->drawable.y; if ((pDst == screenInfo.screens[0]->root) || (pDst->drawable.id == screenInfo.screens[0]->screensaver.wid)) { - rep.dstX += screenInfo.screens[0]->x; - rep.dstY += screenInfo.screens[0]->y; + dstX += screenInfo.screens[0]->x; + dstY += screenInfo.screens[0]->y; } + xTranslateCoordsReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + .sameScreen = xTrue, + .dstX = dstX, + .dstY = dstY, + .child = child + }; + if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.child);