miext: rootless: use PostCreateResources screen hook

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

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-05-02 19:50:45 +02:00
parent 766f51e0c1
commit 88455524fe
2 changed files with 4 additions and 20 deletions

View File

@ -80,8 +80,6 @@ typedef struct _RootlessScreenRec {
RootlessFrameProcsPtr imp;
// Wrapped screen functions
CreateScreenResourcesProcPtr CreateScreenResources;
CreateWindowProcPtr CreateWindow;
RealizeWindowProcPtr RealizeWindow;
UnrealizeWindowProcPtr UnrealizeWindow;

View File

@ -111,31 +111,17 @@ RootlessUpdateScreenPixmap(ScreenPtr pScreen)
* Rootless implementations typically set a null framebuffer pointer, which
* causes problems with miCreateScreenResources. We fix things up here.
*/
static Bool
RootlessCreateScreenResources(ScreenPtr pScreen)
static void RootlessCreateScreenResources(CallbackListPtr *pcbl,
ScreenPtr pScreen, Bool *ret)
{
Bool ret = TRUE;
SCREEN_UNWRAP(pScreen, CreateScreenResources);
if (pScreen->CreateScreenResources != NULL)
ret = (*pScreen->CreateScreenResources) (pScreen);
SCREEN_WRAP(pScreen, CreateScreenResources);
if (!ret)
return ret;
/* Make sure we have a valid screen pixmap. */
RootlessUpdateScreenPixmap(pScreen);
return ret;
}
static void RootlessCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
dixScreenUnhookClose(pScreen, RootlessCloseScreen);
dixScreenUnhookPostCreateResources(pScreen, RootlessCreateScreenResources);
RootlessScreenRec *s = SCREENREC(pScreen);
@ -649,6 +635,7 @@ RootlessWrap(ScreenPtr pScreen)
dixScreenHookClose(pScreen, RootlessCloseScreen);
dixScreenHookWindowDestroy(pScreen, RootlessWindowDestroy);
dixScreenHookWindowPosition(pScreen, RootlessWindowPosition);
dixScreenHookPostCreateResources(pScreen, RootlessCreateScreenResources);
#define WRAP(a) \
if (pScreen->a) { \
@ -659,7 +646,6 @@ RootlessWrap(ScreenPtr pScreen)
} \
pScreen->a = Rootless##a
WRAP(CreateScreenResources);
WRAP(CreateGC);
WRAP(CopyWindow);
WRAP(PaintWindow);