diff --git a/composite/compinit.c b/composite/compinit.c index 88e69d37e..697c2f6f8 100644 --- a/composite/compinit.c +++ b/composite/compinit.c @@ -74,12 +74,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, NULL); + free(cs); dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL); ret = (*pScreen->CloseScreen) (pScreen); @@ -366,6 +367,8 @@ compScreenInit(ScreenPtr pScreen) if (!disableBackingStore) pScreen->backingStoreSupport = WhenMapped; + dixScreenHookWindowDestroy(pScreen, compWindowDestroy, NULL); + cs->PositionWindow = pScreen->PositionWindow; pScreen->PositionWindow = compPositionWindow; @@ -375,9 +378,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 cb73c386d..aeb43a4bf 100644 --- a/composite/compint.h +++ b/composite/compint.h @@ -128,7 +128,6 @@ typedef struct _CompScreen { PositionWindowProcPtr PositionWindow; CopyWindowProcPtr CopyWindow; CreateWindowProcPtr CreateWindow; - DestroyWindowProcPtr DestroyWindow; RealizeWindowProcPtr RealizeWindow; UnrealizeWindowProcPtr UnrealizeWindow; ClipNotifyProcPtr ClipNotify; @@ -309,8 +308,7 @@ void Bool compCreateWindow(WindowPtr pWin); -Bool - compDestroyWindow(WindowPtr pWin); +void compWindowDestroy(ScreenPtr pScreen, WindowPtr pWin, void *arg); void compSetRedirectBorderClip(WindowPtr pWin, RegionPtr pRegion); diff --git a/composite/compwindow.c b/composite/compwindow.c index ee2a0942f..4f26f8890 100644 --- a/composite/compwindow.c +++ b/composite/compwindow.c @@ -596,16 +596,12 @@ compCreateWindow(WindowPtr pWin) return ret; } -Bool -compDestroyWindow(WindowPtr pWin) +void compWindowDestroy(ScreenPtr pScreen, WindowPtr pWin, void *arg) { - 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