miext: damage: use CloseScreen hook

Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-04-28 15:22:48 +02:00
parent 4ca68c30aa
commit 46f2a97c18
2 changed files with 9 additions and 8 deletions

View File

@ -1587,19 +1587,21 @@ damageWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWindow)
}
}
static Bool
damageCloseScreen(ScreenPtr pScreen)
static void damageCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
damageScrPriv(pScreen);
dixScreenUnhookClose(pScreen, damageCloseScreen);
dixScreenUnhookWindowDestroy(pScreen, damageWindowDestroy);
damageScrPriv(pScreen);
if (!pScrPriv)
return;
unwrap(pScrPriv, pScreen, DestroyPixmap);
unwrap(pScrPriv, pScreen, CreateGC);
unwrap(pScrPriv, pScreen, CopyWindow);
unwrap(pScrPriv, pScreen, CloseScreen);
dixSetPrivate(&pScreen->devPrivates, damageScrPrivateKey, NULL);
free(pScrPriv);
return (*pScreen->CloseScreen) (pScreen);
}
/**
@ -1686,13 +1688,13 @@ DamageSetup(ScreenPtr pScreen)
pScrPriv->internalLevel = 0;
pScrPriv->pScreenDamage = 0;
dixScreenHookClose(pScreen, damageCloseScreen);
dixScreenHookWindowDestroy(pScreen, damageWindowDestroy);
wrap(pScrPriv, pScreen, DestroyPixmap, damageDestroyPixmap);
wrap(pScrPriv, pScreen, CreateGC, damageCreateGC);
wrap(pScrPriv, pScreen, SetWindowPixmap, damageSetWindowPixmap);
wrap(pScrPriv, pScreen, CopyWindow, damageCopyWindow);
wrap(pScrPriv, pScreen, CloseScreen, damageCloseScreen);
if (ps) {
wrap(pScrPriv, ps, Glyphs, damageGlyphs);
wrap(pScrPriv, ps, Composite, damageComposite);

View File

@ -61,7 +61,6 @@ typedef struct _damageScrPriv {
DamagePtr pScreenDamage;
CopyWindowProcPtr CopyWindow;
CloseScreenProcPtr CloseScreen;
CreateGCProcPtr CreateGC;
DestroyPixmapProcPtr DestroyPixmap;
SetWindowPixmapProcPtr SetWindowPixmap;