summaryrefslogtreecommitdiff
path: root/glx
diff options
context:
space:
mode:
Diffstat (limited to 'glx')
-rw-r--r--glx/glxscreens.c28
-rw-r--r--glx/glxscreens.h1
2 files changed, 29 insertions, 0 deletions
diff --git a/glx/glxscreens.c b/glx/glxscreens.c
index 3fff26866..81faddd04 100644
--- a/glx/glxscreens.c
+++ b/glx/glxscreens.c
@@ -212,6 +212,7 @@ glxCloseScreen (int index, ScreenPtr pScreen)
__GLXscreen *pGlxScreen = glxGetScreen(pScreen);
pScreen->CloseScreen = pGlxScreen->CloseScreen;
+ pScreen->DestroyWindow = pGlxScreen->DestroyWindow;
pGlxScreen->destroy(pGlxScreen);
@@ -395,6 +396,31 @@ pickFBConfig(__GLXscreen *pGlxScreen, VisualPtr visual)
return best;
}
+static Bool
+glxDestroyWindow(WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ __GLXscreen *pGlxScreen = glxGetScreen(pScreen);
+ Bool retval = TRUE;
+
+ FreeResource(pWin->drawable.id, FALSE);
+
+ /* call lower wrapped functions */
+ if (pGlxScreen->DestroyWindow) {
+ /* unwrap */
+ pScreen->DestroyWindow = pGlxScreen->DestroyWindow;
+
+ /* call lower layers */
+ retval = (*pScreen->DestroyWindow)(pWin);
+
+ /* rewrap */
+ pGlxScreen->DestroyWindow = pScreen->DestroyWindow;
+ pScreen->DestroyWindow = glxDestroyWindow;
+ }
+
+ return retval;
+}
+
void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
{
__GLXconfig *m;
@@ -409,6 +435,8 @@ void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
pGlxScreen->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = glxCloseScreen;
+ pGlxScreen->DestroyWindow = pScreen->DestroyWindow;
+ pScreen->DestroyWindow = glxDestroyWindow;
i = 0;
for (m = pGlxScreen->fbconfigs; m != NULL; m = m->next) {
diff --git a/glx/glxscreens.h b/glx/glxscreens.h
index 34e441e7c..3c1bdd4ba 100644
--- a/glx/glxscreens.h
+++ b/glx/glxscreens.h
@@ -162,6 +162,7 @@ struct __GLXscreen {
char *GLXextensions;
Bool (*CloseScreen)(int index, ScreenPtr pScreen);
+ Bool (*DestroyWindow)(WindowPtr pWindow);
};