miext: rootless: 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 16:15:53 +02:00
parent 1bc857d30f
commit 0a516b5690
2 changed files with 5 additions and 10 deletions

View File

@ -81,7 +81,6 @@ typedef struct _RootlessScreenRec {
// Wrapped screen functions
CreateScreenResourcesProcPtr CreateScreenResources;
CloseScreenProcPtr CloseScreen;
CreateWindowProcPtr CreateWindow;
RealizeWindowProcPtr RealizeWindow;

View File

@ -133,15 +133,11 @@ RootlessCreateScreenResources(ScreenPtr pScreen)
return ret;
}
static Bool
RootlessCloseScreen(ScreenPtr pScreen)
static void RootlessCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
RootlessScreenRec *s;
dixScreenUnhookClose(pScreen, RootlessCloseScreen);
s = SCREENREC(pScreen);
// fixme unwrap everything that was wrapped?
pScreen->CloseScreen = s->CloseScreen;
RootlessScreenRec *s = SCREENREC(pScreen);
if (s->pixmap_data != NULL) {
free(s->pixmap_data);
@ -150,7 +146,7 @@ RootlessCloseScreen(ScreenPtr pScreen)
}
free(s);
return pScreen->CloseScreen(pScreen);
dixSetPrivate(&(pScreen)->devPrivates, rootlessScreenPrivateKey, NULL);
}
static void
@ -650,6 +646,7 @@ RootlessWrap(ScreenPtr pScreen)
{
RootlessScreenRec *s = SCREENREC(pScreen);
dixScreenHookClose(pScreen, RootlessCloseScreen);
dixScreenHookWindowDestroy(pScreen, RootlessWindowDestroy);
dixScreenHookWindowPosition(pScreen, RootlessWindowPosition);
@ -663,7 +660,6 @@ RootlessWrap(ScreenPtr pScreen)
pScreen->a = Rootless##a
WRAP(CreateScreenResources);
WRAP(CloseScreen);
WRAP(CreateGC);
WRAP(CopyWindow);
WRAP(PaintWindow);