diff --git a/composite/compinit.c b/composite/compinit.c index e0a565365..790f46b14 100644 --- a/composite/compinit.c +++ b/composite/compinit.c @@ -44,6 +44,7 @@ #include #include "dix/dix_priv.h" +#include "dix/screen_hooks_priv.h" #include "os/osdep.h" #include "compint.h" @@ -76,12 +77,13 @@ compCloseScreen(ScreenPtr pScreen) pScreen->ClipNotify = cs->ClipNotify; pScreen->UnrealizeWindow = cs->UnrealizeWindow; pScreen->RealizeWindow = cs->RealizeWindow; - pScreen->DestroyWindow = cs->DestroyWindow; pScreen->CreateWindow = cs->CreateWindow; pScreen->CopyWindow = cs->CopyWindow; pScreen->PositionWindow = cs->PositionWindow; pScreen->SourceValidate = cs->SourceValidate; + dixScreenUnhookWindowDestroy(pScreen, compWindowDestroy); + free(cs); dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL); ret = (*pScreen->CloseScreen) (pScreen); @@ -368,6 +370,8 @@ compScreenInit(ScreenPtr pScreen) if (!disableBackingStore) pScreen->backingStoreSupport = WhenMapped; + dixScreenHookWindowDestroy(pScreen, compWindowDestroy); + cs->PositionWindow = pScreen->PositionWindow; pScreen->PositionWindow = compPositionWindow; @@ -377,9 +381,6 @@ compScreenInit(ScreenPtr pScreen) cs->CreateWindow = pScreen->CreateWindow; pScreen->CreateWindow = compCreateWindow; - cs->DestroyWindow = pScreen->DestroyWindow; - pScreen->DestroyWindow = compDestroyWindow; - cs->RealizeWindow = pScreen->RealizeWindow; pScreen->RealizeWindow = compRealizeWindow; diff --git a/composite/compint.h b/composite/compint.h index 91e33187a..ec1740934 100644 --- a/composite/compint.h +++ b/composite/compint.h @@ -127,7 +127,6 @@ typedef struct _CompScreen { PositionWindowProcPtr PositionWindow; CopyWindowProcPtr CopyWindow; CreateWindowProcPtr CreateWindow; - DestroyWindowProcPtr DestroyWindow; RealizeWindowProcPtr RealizeWindow; UnrealizeWindowProcPtr UnrealizeWindow; ClipNotifyProcPtr ClipNotify; @@ -308,8 +307,7 @@ void Bool compCreateWindow(WindowPtr pWin); -Bool - compDestroyWindow(WindowPtr pWin); +void compWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin); void compSetRedirectBorderClip(WindowPtr pWin, RegionPtr pRegion); diff --git a/composite/compwindow.c b/composite/compwindow.c index 40a742438..73d2903be 100644 --- a/composite/compwindow.c +++ b/composite/compwindow.c @@ -596,16 +596,12 @@ compCreateWindow(WindowPtr pWin) return ret; } -Bool -compDestroyWindow(WindowPtr pWin) +void compWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin) { - ScreenPtr pScreen = pWin->drawable.pScreen; CompScreenPtr cs = GetCompScreen(pScreen); CompWindowPtr cw; CompSubwindowsPtr csw; - Bool ret; - pScreen->DestroyWindow = cs->DestroyWindow; while ((cw = GetCompWindow(pWin))) FreeResource(cw->clients->id, X11_RESTYPE_NONE); while ((csw = GetCompSubwindows(pWin))) @@ -617,16 +613,12 @@ compDestroyWindow(WindowPtr pWin) compSetParentPixmap(pWin); dixDestroyPixmap(pPixmap, 0); } - ret = (*pScreen->DestroyWindow) (pWin); - cs->DestroyWindow = pScreen->DestroyWindow; - pScreen->DestroyWindow = compDestroyWindow; /* Did we just destroy the overlay window? */ if (pWin == cs->pOverlayWin) cs->pOverlayWin = NULL; /* compCheckTree (pWin->drawable.pScreen); can't check -- tree isn't good*/ - return ret; } void