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 // Wrapped screen functions
CreateScreenResourcesProcPtr CreateScreenResources; CreateScreenResourcesProcPtr CreateScreenResources;
CloseScreenProcPtr CloseScreen;
CreateWindowProcPtr CreateWindow; CreateWindowProcPtr CreateWindow;
RealizeWindowProcPtr RealizeWindow; RealizeWindowProcPtr RealizeWindow;

View File

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