130 lines
5.1 KiB
Diff
130 lines
5.1 KiB
Diff
|
From 33cd04abaa651e90537cc15a1c743f35f8eebce6 Mon Sep 17 00:00:00 2001
|
|||
|
From: Robert Bragg <robert@linux.intel.com>
|
|||
|
Date: Thu, 12 Jan 2012 18:16:08 +0000
|
|||
|
Subject: [PATCH 01/30] dbe: Cleanup in CloseScreen hook not ext CloseDown
|
|||
|
|
|||
|
Instead of registering an extension CloseDownProc when adding the dbe
|
|||
|
extension this patch hooks into pScreen->CloseScreen so that the chain
|
|||
|
of pScreen->DestroyWindow hooks remains valid until all windows have
|
|||
|
been destroyed. Previously it was possible for DbeResetProc to be called
|
|||
|
before the root window had been destroyed and the unwrapping of
|
|||
|
pScreen->DestroyWindow would clobber the chain of callbacks.
|
|||
|
|
|||
|
This is needed for xwayland to be able to know when the root window is
|
|||
|
destroyed so it can unredirect root sub-windows.
|
|||
|
---
|
|||
|
dbe/dbe.c | 43 ++++++++++++++++++++++---------------------
|
|||
|
dbe/dbestruct.h | 1 +
|
|||
|
2 files changed, 23 insertions(+), 21 deletions(-)
|
|||
|
|
|||
|
diff --git a/dbe/dbe.c b/dbe/dbe.c
|
|||
|
index 9039d80..379feb1 100644
|
|||
|
--- a/dbe/dbe.c
|
|||
|
+++ b/dbe/dbe.c
|
|||
|
@@ -292,8 +292,8 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
|
|||
|
|
|||
|
/* malloc/realloc a new array and initialize all elements to 0. */
|
|||
|
pDbeWindowPriv->IDs = (XID *) realloc(pIDs,
|
|||
|
- (pDbeWindowPriv->
|
|||
|
- maxAvailableIDs +
|
|||
|
+ (pDbeWindowPriv->maxAvailableIDs
|
|||
|
+ +
|
|||
|
DBE_INCR_MAX_IDS) *
|
|||
|
sizeof(XID));
|
|||
|
if (!pDbeWindowPriv->IDs) {
|
|||
|
@@ -468,7 +468,7 @@ ProcDbeSwapBuffers(ClientPtr client)
|
|||
|
return BadAlloc;
|
|||
|
|
|||
|
/* Get to the swap info appended to the end of the request. */
|
|||
|
- dbeSwapInfo = (xDbeSwapInfo *) &stuff[1];
|
|||
|
+ dbeSwapInfo = (xDbeSwapInfo *) & stuff[1];
|
|||
|
|
|||
|
/* Allocate array to record swap information. */
|
|||
|
swapInfo = (DbeSwapInfoPtr) malloc(nStuff * sizeof(DbeSwapInfoRec));
|
|||
|
@@ -1298,7 +1298,7 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
|
|||
|
|
|||
|
/******************************************************************************
|
|||
|
*
|
|||
|
- * DBE DIX Procedure: DbeResetProc
|
|||
|
+ * DBE DIX Procedure: DbeCloseScreen
|
|||
|
*
|
|||
|
* Description:
|
|||
|
*
|
|||
|
@@ -1307,28 +1307,26 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
|
|||
|
* other tasks related to shutting down the extension.
|
|||
|
*
|
|||
|
*****************************************************************************/
|
|||
|
-static void
|
|||
|
-DbeResetProc(ExtensionEntry * extEntry)
|
|||
|
+static Bool
|
|||
|
+DbeCloseScreen(ScreenPtr pScreen)
|
|||
|
{
|
|||
|
- int i;
|
|||
|
- ScreenPtr pScreen;
|
|||
|
- DbeScreenPrivPtr pDbeScreenPriv;
|
|||
|
+ DbeScreenPrivPtr pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
|
|||
|
|
|||
|
- for (i = 0; i < screenInfo.numScreens; i++) {
|
|||
|
- pScreen = screenInfo.screens[i];
|
|||
|
- pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
|
|||
|
+ if (pDbeScreenPriv) {
|
|||
|
+ /* Unwrap DestroyWindow, which was wrapped in DbeExtensionInit(). */
|
|||
|
+ pScreen->DestroyWindow = pDbeScreenPriv->DestroyWindow;
|
|||
|
|
|||
|
- if (pDbeScreenPriv) {
|
|||
|
- /* Unwrap DestroyWindow, which was wrapped in DbeExtensionInit(). */
|
|||
|
- pScreen->DestroyWindow = pDbeScreenPriv->DestroyWindow;
|
|||
|
+ /* Unwrap CloseScreen, which was wrapped in DbeExtensionInit(). */
|
|||
|
+ pScreen->CloseScreen = pDbeScreenPriv->CloseScreen;
|
|||
|
|
|||
|
- if (pDbeScreenPriv->ResetProc)
|
|||
|
- (*pDbeScreenPriv->ResetProc) (pScreen);
|
|||
|
+ if (pDbeScreenPriv->ResetProc)
|
|||
|
+ (*pDbeScreenPriv->ResetProc) (pScreen);
|
|||
|
|
|||
|
- free(pDbeScreenPriv);
|
|||
|
- }
|
|||
|
+ free(pDbeScreenPriv);
|
|||
|
}
|
|||
|
-} /* DbeResetProc() */
|
|||
|
+
|
|||
|
+ return (*pScreen->CloseScreen) (pScreen);
|
|||
|
+} /* DbeCloseScreen */
|
|||
|
|
|||
|
/******************************************************************************
|
|||
|
*
|
|||
|
@@ -1498,6 +1496,9 @@ DbeExtensionInit(void)
|
|||
|
|
|||
|
pDbeScreenPriv->DestroyWindow = pScreen->DestroyWindow;
|
|||
|
pScreen->DestroyWindow = DbeDestroyWindow;
|
|||
|
+
|
|||
|
+ pDbeScreenPriv->CloseScreen = pScreen->CloseScreen;
|
|||
|
+ pScreen->CloseScreen = DbeCloseScreen;
|
|||
|
}
|
|||
|
else {
|
|||
|
/* DDX initialization failed. Stub the screen. */
|
|||
|
@@ -1525,7 +1526,7 @@ DbeExtensionInit(void)
|
|||
|
/* Now add the extension. */
|
|||
|
extEntry = AddExtension(DBE_PROTOCOL_NAME, DbeNumberEvents,
|
|||
|
DbeNumberErrors, ProcDbeDispatch, SProcDbeDispatch,
|
|||
|
- DbeResetProc, StandardMinorOpcode);
|
|||
|
+ NULL, StandardMinorOpcode);
|
|||
|
|
|||
|
dbeErrorBase = extEntry->errorBase;
|
|||
|
SetResourceTypeErrorValue(dbeWindowPrivResType,
|
|||
|
diff --git a/dbe/dbestruct.h b/dbe/dbestruct.h
|
|||
|
index f9d938a..4b88d25 100644
|
|||
|
--- a/dbe/dbestruct.h
|
|||
|
+++ b/dbe/dbestruct.h
|
|||
|
@@ -162,6 +162,7 @@ typedef struct _DbeScreenPrivRec {
|
|||
|
*/
|
|||
|
PositionWindowProcPtr PositionWindow;
|
|||
|
DestroyWindowProcPtr DestroyWindow;
|
|||
|
+ CloseScreenProcPtr CloseScreen;
|
|||
|
|
|||
|
/* Per-screen DIX routines */
|
|||
|
Bool (*SetupBackgroundPainter) (WindowPtr /*pWin */ ,
|
|||
|
--
|
|||
|
1.8.3.1
|
|||
|
|