diff options
author | Eric Anholt <anholt@freebsd.org> | 2004-08-14 19:51:11 +0000 |
---|---|---|
committer | Eric Anholt <anholt@freebsd.org> | 2004-08-14 19:51:11 +0000 |
commit | 183c6d06455114c61f6db57ec0a084caf11ece3a (patch) | |
tree | 8c4bab7de3948a60b9c2c8a71f3a11749dfe1d7f /miext/cw | |
parent | e61b5d38ab30c4f73ba0d070f485a32708a03eb6 (diff) |
Wrap CopyWindow in cw, which fixes scrolling in many apps.
Diffstat (limited to 'miext/cw')
-rw-r--r-- | miext/cw/cw.c | 43 | ||||
-rw-r--r-- | miext/cw/cw.h | 1 |
2 files changed, 44 insertions, 0 deletions
diff --git a/miext/cw/cw.c b/miext/cw/cw.c index 7ab0aee24..f3a9934ca 100644 --- a/miext/cw/cw.c +++ b/miext/cw/cw.c @@ -653,6 +653,47 @@ cwPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what) SCREEN_EPILOGUE(pScreen, PaintWindowBorder, cwPaintWindowBorder); } +static void +cwCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + + SCREEN_PROLOGUE(pScreen, CopyWindow); + + if (!cwDrawableIsRedirWindow((DrawablePtr)pWin)) { + (*pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc); + } else { + GCPtr pGC; + BoxPtr pBox; + int nbox, i, x_off, y_off; + int dx, dy; + DrawablePtr pBackingDrawable; + + pBackingDrawable = cwGetBackingDrawable((DrawablePtr)pWin, &x_off, + &y_off); + + pGC = GetScratchGC(pBackingDrawable->depth, pScreen); + ValidateGC(pBackingDrawable, pGC); + + pBox = REGION_RECTS(prgnSrc); + nbox = REGION_NUM_RECTS(prgnSrc); + + dx = ptOldOrg.x - pWin->drawable.x; + dy = ptOldOrg.y - pWin->drawable.y; + + for (i = 0; i < nbox; i++, pBox++) { + (*pGC->ops->CopyArea)(pBackingDrawable, pBackingDrawable, pGC, + pBox->x1 + x_off, pBox->y1 + y_off, + pBox->x2 - pBox->x1, pBox->y2 - pBox->y1, + pBox->x1 + x_off + dx, pBox->y1 + y_off + dy); + } + + FreeScratchGC(pGC); + } + + SCREEN_EPILOGUE(pScreen, CopyWindow, cwCopyWindow); +} + /* Screen initialization/teardown */ void miInitializeCompositeWrapper(ScreenPtr pScreen) @@ -688,6 +729,7 @@ miInitializeCompositeWrapper(ScreenPtr pScreen) SCREEN_EPILOGUE(pScreen, CreateGC, cwCreateGC); SCREEN_EPILOGUE(pScreen, PaintWindowBackground, cwPaintWindowBackground); SCREEN_EPILOGUE(pScreen, PaintWindowBorder, cwPaintWindowBorder); + SCREEN_EPILOGUE(pScreen, CopyWindow, cwCopyWindow); #ifdef RENDER if (GetPictureScreen (pScreen)) @@ -711,6 +753,7 @@ cwCloseScreen (int i, ScreenPtr pScreen) pScreen->CreateGC = pScreenPriv->CreateGC; pScreen->PaintWindowBackground = pScreenPriv->PaintWindowBackground; pScreen->PaintWindowBorder = pScreenPriv->PaintWindowBorder; + pScreen->CopyWindow = pScreenPriv->CopyWindow; #ifdef RENDER if (ps) diff --git a/miext/cw/cw.h b/miext/cw/cw.h index 037237005..2ff2e6576 100644 --- a/miext/cw/cw.h +++ b/miext/cw/cw.h @@ -62,6 +62,7 @@ typedef struct { PaintWindowBackgroundProcPtr PaintWindowBackground; PaintWindowBorderProcPtr PaintWindowBorder; + CopyWindowProcPtr CopyWindow; #ifdef RENDER DestroyPictureProcPtr DestroyPicture; |