diff --git a/dix/screen_hooks.c b/dix/screen_hooks.c index d3c0ab435..bd15dca6b 100644 --- a/dix/screen_hooks.c +++ b/dix/screen_hooks.c @@ -26,6 +26,7 @@ } DECLARE_HOOK_PROC(WindowDestroy, hookWindowDestroy, XorgScreenWindowDestroyProcPtr); +DECLARE_HOOK_PROC(PostWindowDestroy, hookWindowDestroy, XorgScreenWindowDestroyProcPtr); DECLARE_HOOK_PROC(WindowPosition, hookWindowPosition, XorgScreenWindowPositionProcPtr); DECLARE_HOOK_PROC(Close, hookClose, XorgScreenCloseProcPtr); DECLARE_HOOK_PROC(PostClose, hookPostClose, XorgScreenCloseProcPtr); @@ -42,7 +43,11 @@ int dixScreenRaiseWindowDestroy(WindowPtr pWin) CallCallbacks(&pScreen->hookWindowDestroy, pWin); - return (pScreen->DestroyWindow ? pScreen->DestroyWindow(pWin) : Success); + int rc = pScreen->DestroyWindow ? pScreen->DestroyWindow(pWin) : Success; + + CallCallbacks(&pScreen->hookPostWindowDestroy, pWin); + + return rc; } void dixScreenRaiseWindowPosition(WindowPtr pWin, uint32_t x, uint32_t y) diff --git a/dix/screen_hooks_priv.h b/dix/screen_hooks_priv.h index 3ab6bfdda..eb0bc9565 100644 --- a/dix/screen_hooks_priv.h +++ b/dix/screen_hooks_priv.h @@ -34,7 +34,7 @@ typedef void (*XorgScreenWindowDestroyProcPtr)(CallbackListPtr *pcbl, WindowPtr pWindow); /** - * @brief register a window on the given screen + * @brief register a window destructor on the given screen * * @param pScreen pointer to the screen to register the destructor into * @param func pointer to the window destructor function @@ -73,6 +73,34 @@ void dixScreenHookWindowDestroy(ScreenPtr pScreen, void dixScreenUnhookWindowDestroy(ScreenPtr pScreen, XorgScreenWindowDestroyProcPtr func); +/** + * @brief register a post window destructor on the given screen + * + * @param pScreen pointer to the screen to register the destructor into + * @param func pointer to the window destructor function + * @param arg opaque pointer passed to the destructor + * + * Similar to dixScreenHookWindowDestroy, but the hook is run *after* the screen + * drivers's DestroyWindow() proc. + * + **/ +void dixScreenHookPostWindowDestroy(ScreenPtr pScreen, + XorgScreenWindowDestroyProcPtr func); + +/** + * @brief unregister a window destructor on the given screen + * + * @param pScreen pointer to the screen to unregister the destructor from + * @param func pointer to the window destructor function + * @param arg opaque pointer passed to the destructor + * + * @see dixScreenHookWindowDestroy + * + * Unregister a window destructor hook registered via @ref dixScreenHookWindowDestroy + **/ +void dixScreenUnhookPostWindowDestroy(ScreenPtr pScreen, + XorgScreenWindowDestroyProcPtr func); + typedef struct { WindowPtr window; int32_t x; diff --git a/include/scrnintstr.h b/include/scrnintstr.h index 71ef762ea..3c4056c37 100644 --- a/include/scrnintstr.h +++ b/include/scrnintstr.h @@ -700,6 +700,10 @@ typedef struct _Screen { /* additional screen post-close notify hooks (replaces wrapping CloseScreen) should NOT be touched outside of DIX core */ CallbackListPtr hookPostClose; + + /* additional post window destructors (replaces wrapping DestroyWindow). + should NOT be touched outside of DIX core */ + CallbackListPtr hookPostWindowDestroy; } ScreenRec; static inline RegionPtr