/* SPDX-License-Identifier: MIT OR X11 * * Copyright © 2024 Enrico Weigelt, metux IT consult */ #include #include "dix/dix_priv.h" #include "dix/screen_hooks_priv.h" #include "include/dix.h" #include "include/os.h" #include "include/scrnintstr.h" #include "include/windowstr.h" #define DECLARE_HOOK_PROC(NAME, FIELD, TYPE) \ void dixScreenHook##NAME(ScreenPtr pScreen, TYPE func) \ { \ AddCallback(&pScreen->FIELD, (CallbackProcPtr)func, pScreen); \ } \ \ void dixScreenUnhook##NAME(ScreenPtr pScreen, TYPE func) \ { \ DeleteCallback(&pScreen->FIELD, (CallbackProcPtr)func, pScreen); \ } DECLARE_HOOK_PROC(WindowDestroy, hookWindowDestroy, XorgScreenWindowDestroyProcPtr); int dixScreenRaiseWindowDestroy(WindowPtr pWin) { if (!pWin) return Success; ScreenPtr pScreen = pWin->drawable.pScreen; CallCallbacks(&pScreen->hookWindowDestroy, pWin); return (pScreen->DestroyWindow ? pScreen->DestroyWindow(pWin) : Success); }