From a9c2edfffd931b3fc8df4f08efb6c731bd8248e7 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Wed, 7 Jan 2026 16:30:41 +0100 Subject: [PATCH] dix: encapsulate ScreenRec::UnrealizeWindow() call in helper function Signed-off-by: Enrico Weigelt, metux IT consult --- dix/dix_priv.h | 10 ++++++++++ dix/screen_hooks.c | 10 ++++++++++ dix/window.c | 10 ++-------- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/dix/dix_priv.h b/dix/dix_priv.h index c3fbf4580d..c8abe051fc 100644 --- a/dix/dix_priv.h +++ b/dix/dix_priv.h @@ -308,6 +308,16 @@ void MakePredeclaredAtoms(void); void dixFreeScreen(ScreenPtr pScreen); +/* + * @brief call the screen's UnrealizeWindow proc + * + * Calls the Screen's UnrealizeWindow proc and sets pWin->realized + * to FALSE. + * + * @param pWin the window that's being unrealized + */ +void dixScreenRaiseUnrealizeWindow(WindowPtr pWin); + /* * @brief call screen's window destructors * @see dixScreenHookWindowDestroy diff --git a/dix/screen_hooks.c b/dix/screen_hooks.c index a85285c8df..ef2bbf11af 100644 --- a/dix/screen_hooks.c +++ b/dix/screen_hooks.c @@ -100,3 +100,13 @@ Bool dixScreenRaiseCreateResources(ScreenPtr pScreen) CallCallbacks(&pScreen->hookPostCreateResources, &ret); return ret; } + +void dixScreenRaiseUnrealizeWindow(WindowPtr pWin) +{ + if (!pWin) + return; + + pWin->realized = FALSE; + if (pWin->drawable.pScreen->UnrealizeWindow) + pWin->drawable.pScreen->UnrealizeWindow(pWin); +} diff --git a/dix/window.c b/dix/window.c index 8a2893f914..e661350f49 100644 --- a/dix/window.c +++ b/dix/window.c @@ -999,11 +999,9 @@ static void CrushTree(WindowPtr pWin) { WindowPtr pChild, pSib; - UnrealizeWindowProcPtr UnrealizeWindow; if (!(pChild = pWin->firstChild)) return; - UnrealizeWindow = pWin->drawable.pScreen->UnrealizeWindow; while (1) { /* go to a leaf node in the window tree */ @@ -1021,8 +1019,7 @@ CrushTree(WindowPtr pWin) pSib = pChild->nextSib; pChild->viewable = FALSE; if (pChild->realized) { - pChild->realized = FALSE; - (*UnrealizeWindow) (pChild); + dixScreenRaiseUnrealizeWindow(pChild); } FreeWindowResources(pChild); dixFreeObjectWithPrivates(pChild, PRIVATE_WINDOW); @@ -2761,15 +2758,12 @@ static void UnrealizeTree(WindowPtr pWin, Bool fromConfigure) { WindowPtr pChild; - UnrealizeWindowProcPtr Unrealize; MarkUnrealizedWindowProcPtr MarkUnrealizedWindow; - Unrealize = pWin->drawable.pScreen->UnrealizeWindow; MarkUnrealizedWindow = pWin->drawable.pScreen->MarkUnrealizedWindow; pChild = pWin; while (1) { if (pChild->realized) { - pChild->realized = FALSE; pChild->visibility = VisibilityNotViewable; #ifdef XINERAMA if (!noPanoramiXExtension && !pChild->drawable.pScreen->myNum) { @@ -2783,7 +2777,7 @@ UnrealizeTree(WindowPtr pWin, Bool fromConfigure) win->u.win.visibility = VisibilityNotViewable; } #endif /* XINERAMA */ - (*Unrealize) (pChild); + dixScreenRaiseUnrealizeWindow(pChild); DeleteWindowFromAnyEvents(pChild, FALSE); if (pChild->viewable) { pChild->viewable = FALSE;