From 9dad5500ac5c9e01bcd64f1b2df3a9347a996b57 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Wed, 25 Sep 2024 15:29:07 +0200 Subject: [PATCH] (!1714) composite: use window position notify hook Wrapping ScreenRec's function pointers is problematic for many reasons, so use the new window position notify hook instead. Signed-off-by: Enrico Weigelt, metux IT consult --- composite/compinit.c | 6 ++---- composite/compint.h | 6 +++--- composite/compwindow.c | 17 +++-------------- 3 files changed, 8 insertions(+), 21 deletions(-) diff --git a/composite/compinit.c b/composite/compinit.c index 790f46b14..80cc5ce2b 100644 --- a/composite/compinit.c +++ b/composite/compinit.c @@ -79,10 +79,10 @@ compCloseScreen(ScreenPtr pScreen) pScreen->RealizeWindow = cs->RealizeWindow; pScreen->CreateWindow = cs->CreateWindow; pScreen->CopyWindow = cs->CopyWindow; - pScreen->PositionWindow = cs->PositionWindow; pScreen->SourceValidate = cs->SourceValidate; dixScreenUnhookWindowDestroy(pScreen, compWindowDestroy); + dixScreenUnhookWindowPosition(pScreen, compWindowPosition); free(cs); dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL); @@ -371,9 +371,7 @@ compScreenInit(ScreenPtr pScreen) pScreen->backingStoreSupport = WhenMapped; dixScreenHookWindowDestroy(pScreen, compWindowDestroy); - - cs->PositionWindow = pScreen->PositionWindow; - pScreen->PositionWindow = compPositionWindow; + dixScreenHookWindowPosition(pScreen, compWindowPosition); cs->CopyWindow = pScreen->CopyWindow; pScreen->CopyWindow = compCopyWindow; diff --git a/composite/compint.h b/composite/compint.h index ec1740934..2c2bfd9ea 100644 --- a/composite/compint.h +++ b/composite/compint.h @@ -124,7 +124,6 @@ typedef struct _CompImplicitRedirectException { } CompImplicitRedirectException; typedef struct _CompScreen { - PositionWindowProcPtr PositionWindow; CopyWindowProcPtr CopyWindow; CreateWindowProcPtr CreateWindow; RealizeWindowProcPtr RealizeWindow; @@ -278,8 +277,9 @@ void Bool compCheckRedirect(WindowPtr pWin); -Bool - compPositionWindow(WindowPtr pWin, int x, int y); +void compWindowPosition(CallbackListPtr *pcbl, + ScreenPtr pScreen, + XorgScreenWindowPositionParamRec *param); Bool compRealizeWindow(WindowPtr pWin); diff --git a/composite/compwindow.c b/composite/compwindow.c index 73d2903be..42959bc21 100644 --- a/composite/compwindow.c +++ b/composite/compwindow.c @@ -224,14 +224,9 @@ updateOverlayWindow(ScreenPtr pScreen) return Success; } -Bool -compPositionWindow(WindowPtr pWin, int x, int y) +void compWindowPosition(CallbackListPtr *pcbl, ScreenPtr pScreen, XorgScreenWindowPositionParamRec *param) { - ScreenPtr pScreen = pWin->drawable.pScreen; - CompScreenPtr cs = GetCompScreen(pScreen); - Bool ret = TRUE; - - pScreen->PositionWindow = cs->PositionWindow; + WindowPtr pWin = param->window; /* * "Shouldn't need this as all possible places should be wrapped * @@ -255,14 +250,8 @@ compPositionWindow(WindowPtr pWin, int x, int y) } } - if (!(*pScreen->PositionWindow) (pWin, x, y)) - ret = FALSE; - cs->PositionWindow = pScreen->PositionWindow; - pScreen->PositionWindow = compPositionWindow; compCheckTree(pWin->drawable.pScreen); - if (updateOverlayWindow(pScreen) != Success) - ret = FALSE; - return ret; + updateOverlayWindow(pScreen); } Bool