From 4d24ece1c392feb0fbb01be72818cc1c6fe2e6f1 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Fri, 27 Sep 2024 17:28:17 +0200 Subject: [PATCH] (!1714) rootless: 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 --- miext/rootless/rootlessCommon.h | 1 - miext/rootless/rootlessScreen.c | 2 +- miext/rootless/rootlessWindow.c | 21 +++++++-------------- miext/rootless/rootlessWindow.h | 2 +- 4 files changed, 9 insertions(+), 17 deletions(-) diff --git a/miext/rootless/rootlessCommon.h b/miext/rootless/rootlessCommon.h index 1e236bb9d..fddbc2c36 100644 --- a/miext/rootless/rootlessCommon.h +++ b/miext/rootless/rootlessCommon.h @@ -91,7 +91,6 @@ typedef struct _RootlessScreenRec { RestackWindowProcPtr RestackWindow; ReparentWindowProcPtr ReparentWindow; ChangeBorderWidthProcPtr ChangeBorderWidth; - PositionWindowProcPtr PositionWindow; ChangeWindowAttributesProcPtr ChangeWindowAttributes; PaintWindowProcPtr PaintWindow; diff --git a/miext/rootless/rootlessScreen.c b/miext/rootless/rootlessScreen.c index 3fe76d47a..53b904ef2 100644 --- a/miext/rootless/rootlessScreen.c +++ b/miext/rootless/rootlessScreen.c @@ -650,6 +650,7 @@ RootlessWrap(ScreenPtr pScreen) RootlessScreenRec *s = SCREENREC(pScreen); dixScreenHookWindowDestroy(pScreen, RootlessWindowDestroy, NULL); + dixScreenHookWindowPosition(pScreen, RootlessWindowPosition, NULL); #define WRAP(a) \ if (pScreen->a) { \ @@ -671,7 +672,6 @@ RootlessWrap(ScreenPtr pScreen) WRAP(RealizeWindow); WRAP(UnrealizeWindow); WRAP(MoveWindow); - WRAP(PositionWindow); WRAP(ResizeWindow); WRAP(RestackWindow); WRAP(ReparentWindow); diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c index 53a99f7e6..c8086c64f 100644 --- a/miext/rootless/rootlessWindow.c +++ b/miext/rootless/rootlessWindow.c @@ -300,18 +300,16 @@ RootlessChangeWindowAttributes(WindowPtr pWin, unsigned long vmask) } /* - * RootlessPositionWindow - * This is a hook for when DIX moves or resizes a window. - * Update the frame position now although the physical window is moved - * in RootlessMoveWindow. (x, y) are *inside* position. After this, - * mi and fb are expecting the pixmap to be at the new location. + * @brief DIX move/resize hook + * + * This is a hook for when DIX moves or resizes a window. + * Update the frame position now although the physical window is moved + * in RootlessMoveWindow. (x, y) are *inside* position. After this, + * mi and fb are expecting the pixmap to be at the new location. */ -Bool -RootlessPositionWindow(WindowPtr pWin, int x, int y) +void RootlessWindowPosition(ScreenPtr pScreen, WindowPtr pWin, void *arg, int32_t x, int32_t y) { - ScreenPtr pScreen = pWin->drawable.pScreen; RootlessWindowRec *winRec = WINREC(pWin); - Bool result; RL_DEBUG_MSG("positionwindow start (win %p (%lu) @ %i, %i)\n", pWin, RootlessWID(pWin), x, y); @@ -325,12 +323,7 @@ RootlessPositionWindow(WindowPtr pWin, int x, int y) } } - SCREEN_UNWRAP(pScreen, PositionWindow); - result = pScreen->PositionWindow(pWin, x, y); - SCREEN_WRAP(pScreen, PositionWindow); - RL_DEBUG_MSG("positionwindow end\n"); - return result; } /* diff --git a/miext/rootless/rootlessWindow.h b/miext/rootless/rootlessWindow.h index 64ee28a70..90bdaa4c5 100644 --- a/miext/rootless/rootlessWindow.h +++ b/miext/rootless/rootlessWindow.h @@ -42,7 +42,7 @@ void RootlessWindowDestroy(ScreenPtr pScreen, WindowPtr pWin, void *arg); void RootlessSetShape(WindowPtr pWin, int kind); Bool RootlessChangeWindowAttributes(WindowPtr pWin, unsigned long vmask); -Bool RootlessPositionWindow(WindowPtr pWin, int x, int y); +void RootlessWindowPosition(ScreenPtr pScreen, WindowPtr pWin, void *arg, int32_t x, int32_t y); Bool RootlessRealizeWindow(WindowPtr pWin); Bool RootlessUnrealizeWindow(WindowPtr pWin); void RootlessRestackWindow(WindowPtr pWin, WindowPtr pOldNextSib);