dix: add screen hook for post-window-destroy

In contrast to the already existing WindowDestroy hook, this one is
called *after* the driver's DestroyWindow() proc.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-09-10 13:06:32 +02:00
parent 12bc7c4988
commit 4089e56891
3 changed files with 39 additions and 2 deletions

View File

@@ -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)

View File

@@ -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;

View File

@@ -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