Merge branch 'X11Libre:master' into master

This commit is contained in:
Xgui4 Studio 2025-07-02 11:24:38 -04:00 committed by GitHub
commit 4541697d8b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 41 additions and 2 deletions

View File

@ -23,6 +23,7 @@ void dixFreeScreen(ScreenPtr pScreen)
DeleteCallbackList(&pScreen->hookWindowDestroy);
DeleteCallbackList(&pScreen->hookWindowPosition);
DeleteCallbackList(&pScreen->hookClose);
DeleteCallbackList(&pScreen->hookPostClose);
DeleteCallbackList(&pScreen->hookPixmapDestroy);
free(pScreen);
}

View File

@ -28,6 +28,7 @@
DECLARE_HOOK_PROC(WindowDestroy, hookWindowDestroy, XorgScreenWindowDestroyProcPtr);
DECLARE_HOOK_PROC(WindowPosition, hookWindowPosition, XorgScreenWindowPositionProcPtr);
DECLARE_HOOK_PROC(Close, hookClose, XorgScreenCloseProcPtr);
DECLARE_HOOK_PROC(PostClose, hookPostClose, XorgScreenCloseProcPtr);
DECLARE_HOOK_PROC(PixmapDestroy, hookPixmapDestroy, XorgScreenPixmapDestroyProcPtr);
DECLARE_HOOK_PROC(PostCreateResources, hookPostCreateResources,
XorgScreenPostCreateResourcesProcPtr);
@ -71,6 +72,8 @@ void dixScreenRaiseClose(ScreenPtr pScreen) {
if (pScreen->CloseScreen)
pScreen->CloseScreen(pScreen);
CallCallbacks(&pScreen->hookPostClose, NULL);
}
void dixScreenRaisePixmapDestroy(PixmapPtr pPixmap)

View File

@ -147,6 +147,37 @@ _X_EXPORT
void dixScreenUnhookClose(ScreenPtr pScreen,
XorgScreenCloseProcPtr func);
/**
* @brief register a screen post close notify hook on the given screen
*
* @param pScreen pointer to the screen to register the notify hook into
* @param func pointer to the hook function
*
* In contrast to Close hook, it's called *after* the driver's CloseScreen()
* proc had been called.
*
* When registration fails, the server aborts.
**/
void dixScreenHookPostClose(ScreenPtr pScreen,
XorgScreenCloseProcPtr func);
/**
* @brief unregister a screen close notify hook on the given screen
*
* @param pScreen pointer to the screen to unregister the hook from
* @param func pointer to the hook function
* @param arg opaque pointer passed to the destructor
*
* @see dixScreenHookPostClose
*
* Unregister a screen close notify hook registered via @ref dixScreenHookPostClose
*
* In contrast to Close hook, it's called *after* the driver's CloseScreen()
* proc had been called.
**/
void dixScreenUnhookPostClose(ScreenPtr pScreen,
XorgScreenCloseProcPtr func);
/* prototype of pixmap destroy notification handler */
typedef void (*XorgScreenPixmapDestroyProcPtr)(CallbackListPtr *pcbl,
ScreenPtr pScreen,

View File

@ -696,6 +696,10 @@ typedef struct _Screen {
CallbackListPtr hookPostCreateResources;
SetWindowVRRModeProcPtr SetWindowVRRMode;
/* additional screen post-close notify hooks (replaces wrapping CloseScreen)
should NOT be touched outside of DIX core */
CallbackListPtr hookPostClose;
} ScreenRec;
static inline RegionPtr

View File

@ -1569,7 +1569,7 @@ damageWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWindow)
static void damageCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
dixScreenUnhookClose(pScreen, damageCloseScreen);
dixScreenUnhookPostClose(pScreen, damageCloseScreen);
dixScreenUnhookWindowDestroy(pScreen, damageWindowDestroy);
dixScreenUnhookPixmapDestroy(pScreen, damagePixmapDestroy);
@ -1667,7 +1667,7 @@ DamageSetup(ScreenPtr pScreen)
pScrPriv->internalLevel = 0;
pScrPriv->pScreenDamage = 0;
dixScreenHookClose(pScreen, damageCloseScreen);
dixScreenHookPostClose(pScreen, damageCloseScreen);
dixScreenHookWindowDestroy(pScreen, damageWindowDestroy);
dixScreenHookPixmapDestroy(pScreen, damagePixmapDestroy);