diff --git a/dbe/dbe.c b/dbe/dbe.c index 53e81bca8..24a1f8222 100644 --- a/dbe/dbe.c +++ b/dbe/dbe.c @@ -80,9 +80,6 @@ DbeStubScreen(DbeScreenPrivPtr pDbeScreenPriv, int *nStubbedScreens) /* Stub DIX. */ pDbeScreenPriv->SetupBackgroundPainter = NULL; - /* Do not unwrap PositionWindow. If the DDX initialization function failed, - we assume that it did not wrap PositionWindow. */ - /* Stub DDX. */ pDbeScreenPriv->GetVisualInfo = NULL; pDbeScreenPriv->AllocBackBufferName = NULL; @@ -1259,7 +1256,7 @@ DbeResetProc(ExtensionEntry * extEntry) if (pDbeScreenPriv) { dixScreenUnhookWindowDestroy(pScreen, miDbeWindowDestroy, NULL); - pScreen->PositionWindow = pDbeScreenPriv->PositionWindow; + dixScreenUnhookWindowPosition(pScreen, miDbeWindowPosition, NULL); free(pDbeScreenPriv); } } @@ -1374,7 +1371,7 @@ DbeExtensionInit(void) if (ddxInitSuccess) { /* Hook in our window destructor. The DDX initialization function - * already wrapped PositionWindow for us. + * already added WindowPosition hook for us. */ dixScreenHookWindowDestroy(pScreen, miDbeWindowDestroy, NULL); } diff --git a/dbe/dbestruct.h b/dbe/dbestruct.h index bfecf0266..8f52a551d 100644 --- a/dbe/dbestruct.h +++ b/dbe/dbestruct.h @@ -169,11 +169,6 @@ typedef struct _DbeWindowPrivRec { */ typedef struct _DbeScreenPrivRec { - /* Wrapped functions - * It is the responsibility of the DDX layer to wrap PositionWindow(). - */ - PositionWindowProcPtr PositionWindow; - /* Per-screen DIX routines */ Bool (*SetupBackgroundPainter) (WindowPtr /*pWin */ , GCPtr /*pGC */ diff --git a/dbe/midbe.c b/dbe/midbe.c index f39a58b22..ab6f0ecc8 100644 --- a/dbe/midbe.c +++ b/dbe/midbe.c @@ -381,7 +381,7 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo) * - miDbeAllocBackBufferName() calls FreeResource() to clean up resources * after a buffer allocation failure. * - * - The PositionWindow wrapper, miDbePositionWindow(), calls + * - The WindowPosition hook, miDbeWindowPosition(), calls * FreeResource() when it fails to create buffers of the new size. * FreeResource() is called for all DBE buffer IDs. * @@ -431,22 +431,20 @@ miDbeWinPrivDelete(DbeWindowPrivPtr pDbeWindowPriv, XID bufId) if (pDbeWindowPriv->pBackBuffer) dixDestroyPixmap(pDbeWindowPriv->pBackBuffer, 0); } /* miDbeWinPrivDelete() */ - + /****************************************************************************** * - * DBE MI Procedure: miDbePositionWindow + * DBE MI Procedure: miDbeWindowPosition * * Description: * - * This function was cloned from miMbxPositionWindow() in mimultibuf.c. + * This function was cloned from miMbxWindowPosition() in mimultibuf.c. * This function resizes the buffer when the window is resized. * *****************************************************************************/ -static Bool -miDbePositionWindow(WindowPtr pWin, int x, int y) +void miDbeWindowPosition(ScreenPtr pScreen, WindowPtr pWin, void *arg, int32_t x, int32_t y) { - ScreenPtr pScreen; DbeScreenPrivPtr pDbeScreenPriv; DbeWindowPrivPtr pDbeWindowPriv; int width, height; @@ -459,43 +457,9 @@ miDbePositionWindow(WindowPtr pWin, int x, int y) Bool clear; GCPtr pGC; xRectangle clearRect; - Bool ret; - - /* - ************************************************************************** - ** 1. Unwrap the member routine. - ************************************************************************** - */ pScreen = pWin->drawable.pScreen; pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen); - pScreen->PositionWindow = pDbeScreenPriv->PositionWindow; - - /* - ************************************************************************** - ** 2. Do any work necessary before the member routine is called. - ** - ** In this case we do not need to do anything. - ************************************************************************** - */ - - /* - ************************************************************************** - ** 3. Call the member routine, saving its result if necessary. - ************************************************************************** - */ - - ret = (*pScreen->PositionWindow) (pWin, x, y); - - /* - ************************************************************************** - ** 4. Rewrap the member routine, restoring the wrapper value first in case - ** the wrapper (or something that it wrapped) change this value. - ************************************************************************** - */ - - pDbeScreenPriv->PositionWindow = pScreen->PositionWindow; - pScreen->PositionWindow = miDbePositionWindow; /* ************************************************************************** @@ -503,14 +467,12 @@ miDbePositionWindow(WindowPtr pWin, int x, int y) ************************************************************************** */ - if (!(pDbeWindowPriv = DBE_WINDOW_PRIV(pWin))) { - return ret; - } + if (!(pDbeWindowPriv = DBE_WINDOW_PRIV(pWin))) + return; if (pDbeWindowPriv->width == pWin->drawable.width && - pDbeWindowPriv->height == pWin->drawable.height) { - return ret; - } + pDbeWindowPriv->height == pWin->drawable.height) + return; width = pWin->drawable.width; height = pWin->drawable.height; @@ -594,7 +556,7 @@ miDbePositionWindow(WindowPtr pWin, int x, int y) } FreeScratchGC(pGC); - return FALSE; + return; } else { @@ -644,11 +606,8 @@ miDbePositionWindow(WindowPtr pWin, int x, int y) FreeScratchGC(pGC); } +} - return ret; - -} /* miDbePositionWindow() */ - /****************************************************************************** * * DBE MI Procedure: miDbeInit @@ -663,8 +622,7 @@ Bool miDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv) { /* Wrap functions. */ - pDbeScreenPriv->PositionWindow = pScreen->PositionWindow; - pScreen->PositionWindow = miDbePositionWindow; + dixScreenUnhookWindowPosition(pScreen, miDbeWindowPosition, NULL); /* Initialize the per-screen DBE function pointers. */ pDbeScreenPriv->GetVisualInfo = miDbeGetVisualInfo; diff --git a/dbe/midbe.h b/dbe/midbe.h index 67320eabf..4dda08d2c 100644 --- a/dbe/midbe.h +++ b/dbe/midbe.h @@ -53,4 +53,6 @@ extern DevPrivateKeyRec dbeWindowPrivKeyRec; extern RESTYPE dbeDrawableResType; extern RESTYPE dbeWindowPrivResType; +void miDbeWindowPosition(ScreenPtr pScreen, WindowPtr pWin, void *arg, int32_t x, int32_t y); + #endif /* MIDBE_H */ diff --git a/dix/screen_hooks.c b/dix/screen_hooks.c index bdebbd725..2ac4ce3f6 100644 --- a/dix/screen_hooks.c +++ b/dix/screen_hooks.c @@ -59,6 +59,9 @@ int dixScreenRaiseWindowDestroy(WindowPtr pWin) void dixScreenRaiseWindowPosition(WindowPtr pWin, uint32_t x, uint32_t y) { + if (!pWin) + return; + ScreenPtr pScreen = pWin->drawable.pScreen; ARRAY_FOR_EACH(pScreen->_notify_window_position, walk) {