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

View File

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