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);