(!1714) mi: overlay: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so use the new window destructor hook instead. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
527a0325d5
commit
1c8dc9e329
|
@ -46,7 +46,6 @@ typedef struct {
|
|||
typedef struct {
|
||||
CloseScreenProcPtr CloseScreen;
|
||||
CreateWindowProcPtr CreateWindow;
|
||||
DestroyWindowProcPtr DestroyWindow;
|
||||
UnrealizeWindowProcPtr UnrealizeWindow;
|
||||
RealizeWindowProcPtr RealizeWindow;
|
||||
miOverlayTransFunc MakeTransparent;
|
||||
|
@ -69,7 +68,7 @@ static Bool CollectUnderlayChildrenRegions(WindowPtr, RegionPtr);
|
|||
|
||||
static Bool miOverlayCloseScreen(ScreenPtr);
|
||||
static Bool miOverlayCreateWindow(WindowPtr);
|
||||
static Bool miOverlayDestroyWindow(WindowPtr);
|
||||
static void miOverlayWindowDestroy(ScreenPtr pScreen, WindowPtr, void *arg);
|
||||
static Bool miOverlayUnrealizeWindow(WindowPtr);
|
||||
static Bool miOverlayRealizeWindow(WindowPtr);
|
||||
static void miOverlayMarkWindow(WindowPtr);
|
||||
|
@ -126,6 +125,7 @@ miInitOverlay(ScreenPtr pScreen,
|
|||
return FALSE;
|
||||
|
||||
dixSetPrivate(&pScreen->devPrivates, miOverlayScreenKey, pScreenPriv);
|
||||
dixScreenHookWindowDestroy(pScreen, miOverlayWindowDestroy, NULL);
|
||||
|
||||
pScreenPriv->InOverlay = inOverlayFunc;
|
||||
pScreenPriv->MakeTransparent = transFunc;
|
||||
|
@ -133,13 +133,11 @@ miInitOverlay(ScreenPtr pScreen,
|
|||
|
||||
pScreenPriv->CloseScreen = pScreen->CloseScreen;
|
||||
pScreenPriv->CreateWindow = pScreen->CreateWindow;
|
||||
pScreenPriv->DestroyWindow = pScreen->DestroyWindow;
|
||||
pScreenPriv->UnrealizeWindow = pScreen->UnrealizeWindow;
|
||||
pScreenPriv->RealizeWindow = pScreen->RealizeWindow;
|
||||
|
||||
pScreen->CloseScreen = miOverlayCloseScreen;
|
||||
pScreen->CreateWindow = miOverlayCreateWindow;
|
||||
pScreen->DestroyWindow = miOverlayDestroyWindow;
|
||||
pScreen->UnrealizeWindow = miOverlayUnrealizeWindow;
|
||||
pScreen->RealizeWindow = miOverlayRealizeWindow;
|
||||
|
||||
|
@ -164,10 +162,10 @@ static Bool
|
|||
miOverlayCloseScreen(ScreenPtr pScreen)
|
||||
{
|
||||
miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
|
||||
dixScreenUnhookWindowDestroy(pScreen, miOverlayWindowDestroy, NULL);
|
||||
|
||||
pScreen->CloseScreen = pScreenPriv->CloseScreen;
|
||||
pScreen->CreateWindow = pScreenPriv->CreateWindow;
|
||||
pScreen->DestroyWindow = pScreenPriv->DestroyWindow;
|
||||
pScreen->UnrealizeWindow = pScreenPriv->UnrealizeWindow;
|
||||
pScreen->RealizeWindow = pScreenPriv->RealizeWindow;
|
||||
|
||||
|
@ -226,13 +224,10 @@ miOverlayCreateWindow(WindowPtr pWin)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
miOverlayDestroyWindow(WindowPtr pWin)
|
||||
static void
|
||||
miOverlayWindowDestroy(ScreenPtr pScreen, WindowPtr pWin, void *arg)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
|
||||
miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
|
||||
Bool result = TRUE;
|
||||
|
||||
if (pTree) {
|
||||
if (pTree->prevSib)
|
||||
|
@ -249,14 +244,6 @@ miOverlayDestroyWindow(WindowPtr pWin)
|
|||
RegionUninit(&(pTree->clipList));
|
||||
free(pTree);
|
||||
}
|
||||
|
||||
if (pScreenPriv->DestroyWindow) {
|
||||
pScreen->DestroyWindow = pScreenPriv->DestroyWindow;
|
||||
result = (*pScreen->DestroyWindow) (pWin);
|
||||
pScreen->DestroyWindow = miOverlayDestroyWindow;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static Bool
|
||||
|
|
|
@ -265,7 +265,7 @@ miScreenInit(ScreenPtr pScreen, void *pbits, /* pointer to screen bits */
|
|||
pScreen->SaveScreen = miSaveScreen;
|
||||
/* GetImage, GetSpans */
|
||||
pScreen->SourceValidate = miSourceValidate;
|
||||
/* CreateWindow, DestroyWindow, PositionWindow, ChangeWindowAttributes */
|
||||
/* CreateWindow, PositionWindow, ChangeWindowAttributes */
|
||||
/* RealizeWindow, UnrealizeWindow */
|
||||
pScreen->ValidateTree = miValidateTree;
|
||||
pScreen->PostValidateTree = (PostValidateTreeProcPtr) 0;
|
||||
|
|
Loading…
Reference in New Issue