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;
|
PixmapPtr pPixmap;
|
||||||
} CompPixmapVisitRec, *CompPixmapVisitPtr;
|
} 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
|
static int
|
||||||
compSetPixmapVisitWindow (WindowPtr pWindow, pointer data)
|
compSetPixmapVisitWindow (WindowPtr pWindow, pointer data)
|
||||||
{
|
{
|
||||||
|
@ -85,6 +102,9 @@ compSetPixmapVisitWindow (WindowPtr pWindow, pointer data)
|
||||||
*/
|
*/
|
||||||
SetWinSize (pWindow);
|
SetWinSize (pWindow);
|
||||||
SetBorderSize (pWindow);
|
SetBorderSize (pWindow);
|
||||||
|
if (HasBorder (pWindow))
|
||||||
|
QueueWorkProc (compRepaintBorder, serverClient,
|
||||||
|
(pointer) pWindow->drawable.id);
|
||||||
return WT_WALKCHILDREN;
|
return WT_WALKCHILDREN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
|
|
||||||
int cwGCIndex;
|
int cwGCIndex;
|
||||||
int cwScreenIndex;
|
int cwScreenIndex;
|
||||||
|
int cwWindowIndex;
|
||||||
#ifdef RENDER
|
#ifdef RENDER
|
||||||
int cwPictureIndex;
|
int cwPictureIndex;
|
||||||
#endif
|
#endif
|
||||||
|
@ -105,16 +106,16 @@ static GCFuncs cwCheapGCFuncs = {
|
||||||
DrawablePtr
|
DrawablePtr
|
||||||
cwGetBackingDrawable(DrawablePtr pDrawable, int *x_off, int *y_off)
|
cwGetBackingDrawable(DrawablePtr pDrawable, int *x_off, int *y_off)
|
||||||
{
|
{
|
||||||
if (cwDrawableIsRedirWindow(pDrawable)) {
|
PixmapPtr pPixmap;
|
||||||
WindowPtr pWin = (WindowPtr)pDrawable;
|
|
||||||
PixmapPtr pPixmap = (*pDrawable->pScreen->GetWindowPixmap)(pWin);
|
if (pDrawable->type == DRAWABLE_WINDOW &&
|
||||||
|
(pPixmap = getCwPixmap ((WindowPtr) pDrawable)))
|
||||||
|
{
|
||||||
*x_off = pDrawable->x - pPixmap->screen_x;
|
*x_off = pDrawable->x - pPixmap->screen_x;
|
||||||
*y_off = pDrawable->y - pPixmap->screen_y;
|
*y_off = pDrawable->y - pPixmap->screen_y;
|
||||||
|
|
||||||
return &pPixmap->drawable;
|
return &pPixmap->drawable;
|
||||||
} else {
|
} else {
|
||||||
*x_off = *y_off = 0;
|
*x_off = *y_off = 0;
|
||||||
|
|
||||||
return pDrawable;
|
return pDrawable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -727,6 +728,28 @@ cwCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
|
||||||
SCREEN_EPILOGUE(pScreen, CopyWindow, cwCopyWindow);
|
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 */
|
/* Screen initialization/teardown */
|
||||||
void
|
void
|
||||||
miInitializeCompositeWrapper(ScreenPtr pScreen)
|
miInitializeCompositeWrapper(ScreenPtr pScreen)
|
||||||
|
@ -739,6 +762,7 @@ miInitializeCompositeWrapper(ScreenPtr pScreen)
|
||||||
if (cwScreenIndex < 0)
|
if (cwScreenIndex < 0)
|
||||||
return;
|
return;
|
||||||
cwGCIndex = AllocateGCPrivateIndex();
|
cwGCIndex = AllocateGCPrivateIndex();
|
||||||
|
cwWindowIndex = AllocateWindowPrivateIndex();
|
||||||
#ifdef RENDER
|
#ifdef RENDER
|
||||||
cwPictureIndex = AllocatePicturePrivateIndex();
|
cwPictureIndex = AllocatePicturePrivateIndex();
|
||||||
#endif
|
#endif
|
||||||
|
@ -746,6 +770,8 @@ miInitializeCompositeWrapper(ScreenPtr pScreen)
|
||||||
}
|
}
|
||||||
if (!AllocateGCPrivate(pScreen, cwGCIndex, 0))
|
if (!AllocateGCPrivate(pScreen, cwGCIndex, 0))
|
||||||
return;
|
return;
|
||||||
|
if (!AllocateWindowPrivate(pScreen, cwWindowIndex, 0))
|
||||||
|
return;
|
||||||
#ifdef RENDER
|
#ifdef RENDER
|
||||||
if (!AllocatePicturePrivate(pScreen, cwPictureIndex, 0))
|
if (!AllocatePicturePrivate(pScreen, cwPictureIndex, 0))
|
||||||
return;
|
return;
|
||||||
|
@ -764,6 +790,9 @@ miInitializeCompositeWrapper(ScreenPtr pScreen)
|
||||||
SCREEN_EPILOGUE(pScreen, PaintWindowBorder, cwPaintWindowBorder);
|
SCREEN_EPILOGUE(pScreen, PaintWindowBorder, cwPaintWindowBorder);
|
||||||
SCREEN_EPILOGUE(pScreen, CopyWindow, cwCopyWindow);
|
SCREEN_EPILOGUE(pScreen, CopyWindow, cwCopyWindow);
|
||||||
|
|
||||||
|
SCREEN_EPILOGUE(pScreen, SetWindowPixmap, cwSetWindowPixmap);
|
||||||
|
SCREEN_EPILOGUE(pScreen, GetWindowPixmap, cwGetWindowPixmap);
|
||||||
|
|
||||||
#ifdef RENDER
|
#ifdef RENDER
|
||||||
if (GetPictureScreen (pScreen))
|
if (GetPictureScreen (pScreen))
|
||||||
cwInitializeRender(pScreen);
|
cwInitializeRender(pScreen);
|
||||||
|
|
|
@ -60,10 +60,15 @@ typedef struct {
|
||||||
|
|
||||||
extern int cwPictureIndex;
|
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) \
|
#define cwDrawableIsRedirWindow(pDraw) \
|
||||||
((pDraw)->type == DRAWABLE_WINDOW && \
|
((pDraw)->type == DRAWABLE_WINDOW && \
|
||||||
((*(pDraw)->pScreen->GetWindowPixmap)((WindowPtr)(pDraw)) != \
|
getCwPixmap((WindowPtr) (pDraw)) != NULL)
|
||||||
(*(pDraw)->pScreen->GetScreenPixmap)((pDraw)->pScreen)))
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/*
|
/*
|
||||||
|
@ -78,6 +83,9 @@ typedef struct {
|
||||||
PaintWindowBorderProcPtr PaintWindowBorder;
|
PaintWindowBorderProcPtr PaintWindowBorder;
|
||||||
CopyWindowProcPtr CopyWindow;
|
CopyWindowProcPtr CopyWindow;
|
||||||
|
|
||||||
|
GetWindowPixmapProcPtr GetWindowPixmap;
|
||||||
|
SetWindowPixmapProcPtr SetWindowPixmap;
|
||||||
|
|
||||||
#ifdef RENDER
|
#ifdef RENDER
|
||||||
DestroyPictureProcPtr DestroyPicture;
|
DestroyPictureProcPtr DestroyPicture;
|
||||||
ChangePictureClipProcPtr ChangePictureClip;
|
ChangePictureClipProcPtr ChangePictureClip;
|
||||||
|
|
|
@ -65,9 +65,8 @@
|
||||||
static cwPicturePtr
|
static cwPicturePtr
|
||||||
cwCreatePicturePrivate (PicturePtr pPicture)
|
cwCreatePicturePrivate (PicturePtr pPicture)
|
||||||
{
|
{
|
||||||
ScreenPtr pScreen = pPicture->pDrawable->pScreen;
|
|
||||||
WindowPtr pWindow = (WindowPtr) pPicture->pDrawable;
|
WindowPtr pWindow = (WindowPtr) pPicture->pDrawable;
|
||||||
PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWindow);
|
PixmapPtr pPixmap = getCwPixmap (pWindow);
|
||||||
int error;
|
int error;
|
||||||
cwPicturePtr pPicturePrivate;
|
cwPicturePtr pPicturePrivate;
|
||||||
|
|
||||||
|
@ -118,12 +117,11 @@ cwGetBackingPicture (PicturePtr pPicture, int *x_off, int *y_off)
|
||||||
if (pPicturePrivate)
|
if (pPicturePrivate)
|
||||||
{
|
{
|
||||||
DrawablePtr pDrawable = pPicture->pDrawable;
|
DrawablePtr pDrawable = pPicture->pDrawable;
|
||||||
ScreenPtr pScreen = pDrawable->pScreen;
|
WindowPtr pWindow = (WindowPtr) pDrawable;
|
||||||
WindowPtr pWin = (WindowPtr) pDrawable;
|
PixmapPtr pPixmap = getCwPixmap (pWindow);
|
||||||
PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
|
|
||||||
|
|
||||||
*x_off = pWin->drawable.x - pPixmap->screen_x;
|
*x_off = pDrawable->x - pPixmap->screen_x;
|
||||||
*y_off = pWin->drawable.y - pPixmap->screen_y;
|
*y_off = pDrawable->y - pPixmap->screen_y;
|
||||||
|
|
||||||
return pPicturePrivate->pBackingPicture;
|
return pPicturePrivate->pBackingPicture;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue