Index: composite/compwindow.c =================================================================== RCS file: /cvs/xserver/xserver/composite/compwindow.c,v retrieving revision 1.12 diff -u -p -r1.12 compwindow.c --- composite/compwindow.c 21 May 2004 03:32:27 -0000 1.12 +++ composite/compwindow.c 12 Nov 2004 22:54:05 -0000 @@ -446,6 +446,7 @@ compCopyWindow (WindowPtr pWin, DDXPoint ScreenPtr pScreen = pWin->drawable.pScreen; CompScreenPtr cs = GetCompScreen (pScreen); int dx = 0, dy = 0; + int screen_x = 0, screen_y = 0; if (pWin->redirectDraw) { @@ -500,8 +501,15 @@ compCopyWindow (WindowPtr pWin, DDXPoint } return; } + /* We adjust pOldOrg by the amount of translation we get "for free" + * by moving the redirected pixmap to the new location. This isn't + * necesarily all the translation we need because of, for example + * border width changes + */ dx = pPixmap->screen_x - cw->oldx; dy = pPixmap->screen_y - cw->oldy; + screen_x = pPixmap->screen_x; + screen_y = pPixmap->screen_y; ptOldOrg.x += dx; ptOldOrg.y += dy; } @@ -522,7 +530,36 @@ compCopyWindow (WindowPtr pWin, DDXPoint REGION_TRANSLATE (prgnSrc, prgnSrc, pWin->drawable.x - ptOldOrg.x, pWin->drawable.y - ptOldOrg.y); - DamageDamageRegion (&pWin->drawable, prgnSrc); + if (pWin->parent) + { + /* The window contents didn't move with respect to the + * window's own pixmap, but they moved with respect + * to the parent window's pixmap, so we need to damage + * the parent. + */ + int parent_x, parent_y; + if (pWin->parent->redirectDraw) + { + PixmapPtr parentPixmap = (*pScreen->GetWindowPixmap) (pWin->parent); + parent_x = parentPixmap->screen_x; + parent_y = parentPixmap->screen_y; + } + else + { + parent_x = 0; + parent_y = 0; + } + + REGION_TRANSLATE (prgnSrc, prgnSrc, + parent_x - screen_x, + parent_y - screen_y); + + DamageDamageRegion (&pWin->drawable, prgnSrc); + + REGION_TRANSLATE (prgnSrc, prgnSrc, + screen_x - parent_x, + screen_y - parent_y); + } } cs->CopyWindow = pScreen->CopyWindow; pScreen->CopyWindow = compCopyWindow;