dix: encapsulate ScreenRec::UnrealizeWindow() call in helper function

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2026-01-07 16:30:41 +01:00 committed by Enrico Weigelt
parent b9036466dd
commit a9c2edfffd
3 changed files with 22 additions and 8 deletions

View File

@ -308,6 +308,16 @@ void MakePredeclaredAtoms(void);
void dixFreeScreen(ScreenPtr pScreen); 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 * @brief call screen's window destructors
* @see dixScreenHookWindowDestroy * @see dixScreenHookWindowDestroy

View File

@ -100,3 +100,13 @@ Bool dixScreenRaiseCreateResources(ScreenPtr pScreen)
CallCallbacks(&pScreen->hookPostCreateResources, &ret); CallCallbacks(&pScreen->hookPostCreateResources, &ret);
return ret; return ret;
} }
void dixScreenRaiseUnrealizeWindow(WindowPtr pWin)
{
if (!pWin)
return;
pWin->realized = FALSE;
if (pWin->drawable.pScreen->UnrealizeWindow)
pWin->drawable.pScreen->UnrealizeWindow(pWin);
}

View File

@ -999,11 +999,9 @@ static void
CrushTree(WindowPtr pWin) CrushTree(WindowPtr pWin)
{ {
WindowPtr pChild, pSib; WindowPtr pChild, pSib;
UnrealizeWindowProcPtr UnrealizeWindow;
if (!(pChild = pWin->firstChild)) if (!(pChild = pWin->firstChild))
return; return;
UnrealizeWindow = pWin->drawable.pScreen->UnrealizeWindow;
while (1) { while (1) {
/* go to a leaf node in the window tree */ /* go to a leaf node in the window tree */
@ -1021,8 +1019,7 @@ CrushTree(WindowPtr pWin)
pSib = pChild->nextSib; pSib = pChild->nextSib;
pChild->viewable = FALSE; pChild->viewable = FALSE;
if (pChild->realized) { if (pChild->realized) {
pChild->realized = FALSE; dixScreenRaiseUnrealizeWindow(pChild);
(*UnrealizeWindow) (pChild);
} }
FreeWindowResources(pChild); FreeWindowResources(pChild);
dixFreeObjectWithPrivates(pChild, PRIVATE_WINDOW); dixFreeObjectWithPrivates(pChild, PRIVATE_WINDOW);
@ -2761,15 +2758,12 @@ static void
UnrealizeTree(WindowPtr pWin, Bool fromConfigure) UnrealizeTree(WindowPtr pWin, Bool fromConfigure)
{ {
WindowPtr pChild; WindowPtr pChild;
UnrealizeWindowProcPtr Unrealize;
MarkUnrealizedWindowProcPtr MarkUnrealizedWindow; MarkUnrealizedWindowProcPtr MarkUnrealizedWindow;
Unrealize = pWin->drawable.pScreen->UnrealizeWindow;
MarkUnrealizedWindow = pWin->drawable.pScreen->MarkUnrealizedWindow; MarkUnrealizedWindow = pWin->drawable.pScreen->MarkUnrealizedWindow;
pChild = pWin; pChild = pWin;
while (1) { while (1) {
if (pChild->realized) { if (pChild->realized) {
pChild->realized = FALSE;
pChild->visibility = VisibilityNotViewable; pChild->visibility = VisibilityNotViewable;
#ifdef XINERAMA #ifdef XINERAMA
if (!noPanoramiXExtension && !pChild->drawable.pScreen->myNum) { if (!noPanoramiXExtension && !pChild->drawable.pScreen->myNum) {
@ -2783,7 +2777,7 @@ UnrealizeTree(WindowPtr pWin, Bool fromConfigure)
win->u.win.visibility = VisibilityNotViewable; win->u.win.visibility = VisibilityNotViewable;
} }
#endif /* XINERAMA */ #endif /* XINERAMA */
(*Unrealize) (pChild); dixScreenRaiseUnrealizeWindow(pChild);
DeleteWindowFromAnyEvents(pChild, FALSE); DeleteWindowFromAnyEvents(pChild, FALSE);
if (pChild->viewable) { if (pChild->viewable) {
pChild->viewable = FALSE; pChild->viewable = FALSE;