Redraw window borders when switching window pixmaps around
Make cw "own" the window pixmaps by wrapping GetWindowPixmap/SetWindowPixmap.
This commit is contained in:
parent
597fdae93e
commit
9433085179
|
@ -69,6 +69,23 @@ typedef struct _compPixmapVisit {
|
|||
PixmapPtr pPixmap;
|
||||
} CompPixmapVisitRec, *CompPixmapVisitPtr;
|
||||
|
||||
static Bool
|
||||
compRepaintBorder (ClientPtr pClient, pointer closure)
|
||||
{
|
||||
WindowPtr pWindow = LookupWindow ((XID) closure, pClient);
|
||||
|
||||
if (pWindow)
|
||||
{
|
||||
RegionRec exposed;
|
||||
|
||||
REGION_NULL(pScreen, &exposed);
|
||||
REGION_SUBTRACT(pScreen, &exposed, &pWindow->borderClip, &pWindow->winSize);
|
||||
(*pWindow->drawable.pScreen->PaintWindowBorder)(pWindow, &exposed, PW_BORDER);
|
||||
REGION_UNINIT(pScreen, &exposed);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
compSetPixmapVisitWindow (WindowPtr pWindow, pointer data)
|
||||
{
|
||||
|
@ -85,6 +102,9 @@ compSetPixmapVisitWindow (WindowPtr pWindow, pointer data)
|
|||
*/
|
||||
SetWinSize (pWindow);
|
||||
SetBorderSize (pWindow);
|
||||
if (HasBorder (pWindow))
|
||||
QueueWorkProc (compRepaintBorder, serverClient,
|
||||
(pointer) pWindow->drawable.id);
|
||||
return WT_WALKCHILDREN;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
int cwGCIndex;
|
||||
int cwScreenIndex;
|
||||
int cwWindowIndex;
|
||||
#ifdef RENDER
|
||||
int cwPictureIndex;
|
||||
#endif
|
||||
|
@ -105,16 +106,16 @@ static GCFuncs cwCheapGCFuncs = {
|
|||
DrawablePtr
|
||||
cwGetBackingDrawable(DrawablePtr pDrawable, int *x_off, int *y_off)
|
||||
{
|
||||
if (cwDrawableIsRedirWindow(pDrawable)) {
|
||||
WindowPtr pWin = (WindowPtr)pDrawable;
|
||||
PixmapPtr pPixmap = (*pDrawable->pScreen->GetWindowPixmap)(pWin);
|
||||
PixmapPtr pPixmap;
|
||||
|
||||
if (pDrawable->type == DRAWABLE_WINDOW &&
|
||||
(pPixmap = getCwPixmap ((WindowPtr) pDrawable)))
|
||||
{
|
||||
*x_off = pDrawable->x - pPixmap->screen_x;
|
||||
*y_off = pDrawable->y - pPixmap->screen_y;
|
||||
|
||||
return &pPixmap->drawable;
|
||||
} else {
|
||||
*x_off = *y_off = 0;
|
||||
|
||||
return pDrawable;
|
||||
}
|
||||
}
|
||||
|
@ -727,6 +728,28 @@ cwCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
|
|||
SCREEN_EPILOGUE(pScreen, CopyWindow, cwCopyWindow);
|
||||
}
|
||||
|
||||
static PixmapPtr
|
||||
cwGetWindowPixmap (WindowPtr pWin)
|
||||
{
|
||||
PixmapPtr pPixmap = getCwPixmap (pWin);
|
||||
|
||||
if (!pPixmap)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
SCREEN_PROLOGUE(pScreen, GetWindowPixmap);
|
||||
if (pScreen->GetWindowPixmap)
|
||||
pPixmap = (*pScreen->GetWindowPixmap) (pWin);
|
||||
SCREEN_EPILOGUE(pScreen, GetWindowPixmap, cwGetWindowPixmap);
|
||||
}
|
||||
return pPixmap;
|
||||
}
|
||||
|
||||
static void
|
||||
cwSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap)
|
||||
{
|
||||
setCwPixmap (pWindow, pPixmap);
|
||||
}
|
||||
|
||||
/* Screen initialization/teardown */
|
||||
void
|
||||
miInitializeCompositeWrapper(ScreenPtr pScreen)
|
||||
|
@ -739,6 +762,7 @@ miInitializeCompositeWrapper(ScreenPtr pScreen)
|
|||
if (cwScreenIndex < 0)
|
||||
return;
|
||||
cwGCIndex = AllocateGCPrivateIndex();
|
||||
cwWindowIndex = AllocateWindowPrivateIndex();
|
||||
#ifdef RENDER
|
||||
cwPictureIndex = AllocatePicturePrivateIndex();
|
||||
#endif
|
||||
|
@ -746,6 +770,8 @@ miInitializeCompositeWrapper(ScreenPtr pScreen)
|
|||
}
|
||||
if (!AllocateGCPrivate(pScreen, cwGCIndex, 0))
|
||||
return;
|
||||
if (!AllocateWindowPrivate(pScreen, cwWindowIndex, 0))
|
||||
return;
|
||||
#ifdef RENDER
|
||||
if (!AllocatePicturePrivate(pScreen, cwPictureIndex, 0))
|
||||
return;
|
||||
|
@ -764,6 +790,9 @@ miInitializeCompositeWrapper(ScreenPtr pScreen)
|
|||
SCREEN_EPILOGUE(pScreen, PaintWindowBorder, cwPaintWindowBorder);
|
||||
SCREEN_EPILOGUE(pScreen, CopyWindow, cwCopyWindow);
|
||||
|
||||
SCREEN_EPILOGUE(pScreen, SetWindowPixmap, cwSetWindowPixmap);
|
||||
SCREEN_EPILOGUE(pScreen, GetWindowPixmap, cwGetWindowPixmap);
|
||||
|
||||
#ifdef RENDER
|
||||
if (GetPictureScreen (pScreen))
|
||||
cwInitializeRender(pScreen);
|
||||
|
|
|
@ -60,10 +60,15 @@ typedef struct {
|
|||
|
||||
extern int cwPictureIndex;
|
||||
|
||||
extern int cwWindowIndex;
|
||||
|
||||
#define cwWindowPrivate(pWindow) ((pWindow)->devPrivates[cwWindowIndex].ptr)
|
||||
#define getCwPixmap(pWindow) ((PixmapPtr) cwWindowPrivate(pWindow))
|
||||
#define setCwPixmap(pWindow,pPixmap) (cwWindowPrivate(pWindow) = (pointer) (pPixmap))
|
||||
|
||||
#define cwDrawableIsRedirWindow(pDraw) \
|
||||
((pDraw)->type == DRAWABLE_WINDOW && \
|
||||
((*(pDraw)->pScreen->GetWindowPixmap)((WindowPtr)(pDraw)) != \
|
||||
(*(pDraw)->pScreen->GetScreenPixmap)((pDraw)->pScreen)))
|
||||
getCwPixmap((WindowPtr) (pDraw)) != NULL)
|
||||
|
||||
typedef struct {
|
||||
/*
|
||||
|
@ -78,6 +83,9 @@ typedef struct {
|
|||
PaintWindowBorderProcPtr PaintWindowBorder;
|
||||
CopyWindowProcPtr CopyWindow;
|
||||
|
||||
GetWindowPixmapProcPtr GetWindowPixmap;
|
||||
SetWindowPixmapProcPtr SetWindowPixmap;
|
||||
|
||||
#ifdef RENDER
|
||||
DestroyPictureProcPtr DestroyPicture;
|
||||
ChangePictureClipProcPtr ChangePictureClip;
|
||||
|
|
|
@ -65,9 +65,8 @@
|
|||
static cwPicturePtr
|
||||
cwCreatePicturePrivate (PicturePtr pPicture)
|
||||
{
|
||||
ScreenPtr pScreen = pPicture->pDrawable->pScreen;
|
||||
WindowPtr pWindow = (WindowPtr) pPicture->pDrawable;
|
||||
PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWindow);
|
||||
PixmapPtr pPixmap = getCwPixmap (pWindow);
|
||||
int error;
|
||||
cwPicturePtr pPicturePrivate;
|
||||
|
||||
|
@ -118,12 +117,11 @@ cwGetBackingPicture (PicturePtr pPicture, int *x_off, int *y_off)
|
|||
if (pPicturePrivate)
|
||||
{
|
||||
DrawablePtr pDrawable = pPicture->pDrawable;
|
||||
ScreenPtr pScreen = pDrawable->pScreen;
|
||||
WindowPtr pWin = (WindowPtr) pDrawable;
|
||||
PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
|
||||
WindowPtr pWindow = (WindowPtr) pDrawable;
|
||||
PixmapPtr pPixmap = getCwPixmap (pWindow);
|
||||
|
||||
*x_off = pWin->drawable.x - pPixmap->screen_x;
|
||||
*y_off = pWin->drawable.y - pPixmap->screen_y;
|
||||
*x_off = pDrawable->x - pPixmap->screen_x;
|
||||
*y_off = pDrawable->y - pPixmap->screen_y;
|
||||
|
||||
return pPicturePrivate->pBackingPicture;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue