(!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 <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-09-25 15:29:07 +02:00
parent c4f89e4edc
commit a801164bf5
3 changed files with 5 additions and 21 deletions

View File

@ -78,10 +78,10 @@ compCloseScreen(ScreenPtr pScreen)
pScreen->RealizeWindow = cs->RealizeWindow; pScreen->RealizeWindow = cs->RealizeWindow;
pScreen->CreateWindow = cs->CreateWindow; pScreen->CreateWindow = cs->CreateWindow;
pScreen->CopyWindow = cs->CopyWindow; pScreen->CopyWindow = cs->CopyWindow;
pScreen->PositionWindow = cs->PositionWindow;
pScreen->SourceValidate = cs->SourceValidate; pScreen->SourceValidate = cs->SourceValidate;
dixScreenUnhookWindowDestroy(pScreen, compWindowDestroy, NULL); dixScreenUnhookWindowDestroy(pScreen, compWindowDestroy, NULL);
dixScreenUnhookWindowPosition(pScreen, compWindowPosition, NULL);
free(cs); free(cs);
dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL); dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL);
@ -370,9 +370,7 @@ compScreenInit(ScreenPtr pScreen)
pScreen->backingStoreSupport = WhenMapped; pScreen->backingStoreSupport = WhenMapped;
dixScreenHookWindowDestroy(pScreen, compWindowDestroy, NULL); dixScreenHookWindowDestroy(pScreen, compWindowDestroy, NULL);
dixScreenHookWindowPosition(pScreen, compWindowPosition, NULL);
cs->PositionWindow = pScreen->PositionWindow;
pScreen->PositionWindow = compPositionWindow;
cs->CopyWindow = pScreen->CopyWindow; cs->CopyWindow = pScreen->CopyWindow;
pScreen->CopyWindow = compCopyWindow; pScreen->CopyWindow = compCopyWindow;

View File

@ -125,7 +125,6 @@ typedef struct _CompImplicitRedirectException {
} CompImplicitRedirectException; } CompImplicitRedirectException;
typedef struct _CompScreen { typedef struct _CompScreen {
PositionWindowProcPtr PositionWindow;
CopyWindowProcPtr CopyWindow; CopyWindowProcPtr CopyWindow;
CreateWindowProcPtr CreateWindow; CreateWindowProcPtr CreateWindow;
RealizeWindowProcPtr RealizeWindow; RealizeWindowProcPtr RealizeWindow;
@ -279,8 +278,7 @@ void
Bool Bool
compCheckRedirect(WindowPtr pWin); compCheckRedirect(WindowPtr pWin);
Bool void compWindowPosition(ScreenPtr pScreen, WindowPtr pWin, void *arg, int32_t x, int32_t y);
compPositionWindow(WindowPtr pWin, int x, int y);
Bool Bool
compRealizeWindow(WindowPtr pWin); compRealizeWindow(WindowPtr pWin);

View File

@ -224,14 +224,8 @@ updateOverlayWindow(ScreenPtr pScreen)
return Success; return Success;
} }
Bool void compWindowPosition(ScreenPtr pScreen, WindowPtr pWin, void *arg, int32_t x, int32_t y)
compPositionWindow(WindowPtr pWin, int x, int y)
{ {
ScreenPtr pScreen = pWin->drawable.pScreen;
CompScreenPtr cs = GetCompScreen(pScreen);
Bool ret = TRUE;
pScreen->PositionWindow = cs->PositionWindow;
/* /*
* "Shouldn't need this as all possible places should be wrapped * "Shouldn't need this as all possible places should be wrapped
* *
@ -255,14 +249,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); compCheckTree(pWin->drawable.pScreen);
if (updateOverlayWindow(pScreen) != Success) updateOverlayWindow(pScreen);
ret = FALSE;
return ret;
} }
Bool Bool