summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2010-11-10 15:33:29 +0000
committerJon TURNEY <jon.turney@dronecode.org.uk>2011-09-01 14:45:02 +0100
commit26f93136840099831246afa1c1517e112b5fca2f (patch)
treeaa6b53867812b5b0b422391920eff75ed2da61c4
parente87e3792fb80ce4668bc2f162e3fc12e63f1f5cc (diff)
Handle GLX windows being reparented from a mapped window to an unmapped windowcygwin-aiglx-for-1.11
Also be more careful to clean up HWNDs which are implicitly deleted when the parent window is deleted
-rw-r--r--hw/xwin/winmultiwindowwindow.c44
1 files changed, 34 insertions, 10 deletions
diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c
index ebc231611..3635931b2 100644
--- a/hw/xwin/winmultiwindowwindow.c
+++ b/hw/xwin/winmultiwindowwindow.c
@@ -754,6 +754,26 @@ winCreateWindowsWindow (WindowPtr pWin)
}
}
+static int
+winDestroyChildWindowsWindow(WindowPtr pWin, pointer data)
+{
+ winWindowPriv(pWin);
+
+ winDebug("winDestroyChildWindowsWindow - pWin:%08x XID:0x%x \n", pWin, pWin->drawable.id);
+
+ SetProp (pWinPriv->hWnd, WIN_WINDOW_PROP, NULL);
+
+ /* Null our handle to the Window so referencing it will cause an error */
+ pWinPriv->hWnd = NULL;
+
+#ifdef XWIN_GLX_WINDOWS
+ /* No longer note WGL used on this window */
+ pWinPriv->fWglUsed = FALSE;
+#endif
+
+ return WT_WALKCHILDREN; /* continue enumeration */
+}
+
Bool winInDestroyWindowsWindow = FALSE;
/*
* winDestroyWindowsWindow - Destroy a Windows window associated
@@ -767,6 +787,7 @@ winDestroyWindowsWindow (WindowPtr pWin)
BOOL oldstate = winInDestroyWindowsWindow;
HICON hIcon;
HICON hIconSm;
+ HWND hWnd;
winDebug("winDestroyWindowsWindow - pWin:%08x XID:0x%x \n", pWin, pWin->drawable.id);
@@ -780,23 +801,20 @@ winDestroyWindowsWindow (WindowPtr pWin)
hIcon = (HICON)SendMessage(pWinPriv->hWnd, WM_GETICON, ICON_BIG, 0);
hIconSm = (HICON)SendMessage(pWinPriv->hWnd, WM_GETICON, ICON_SMALL, 0);
- SetProp (pWinPriv->hWnd, WIN_WINDOW_PROP, NULL);
+ hWnd = pWinPriv->hWnd;
- /* Destroy the Windows window */
- DestroyWindow (pWinPriv->hWnd);
+ /* DestroyWindow() implicitly destroys all child windows,
+ so first walk over the child tree of this window, clearing
+ any hWnds */
+ TraverseTree(pWin, winDestroyChildWindowsWindow, 0);
- /* Null our handle to the Window so referencing it will cause an error */
- pWinPriv->hWnd = NULL;
+ /* Destroy the Windows window */
+ DestroyWindow (hWnd);
/* Destroy any icons we created for this window */
winDestroyIcon(hIcon);
winDestroyIcon(hIconSm);
-#ifdef XWIN_GLX_WINDOWS
- /* No longer note WGL used on this window */
- pWinPriv->fWglUsed = FALSE;
-#endif
-
/* Process all messages on our queue */
while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
{
@@ -874,6 +892,12 @@ winUpdateWindowsWindow (WindowPtr pWin)
UpdateWindow (pWinPriv->hWnd);
}
}
+ else if (pWinPriv->hWnd != NULL)
+ {
+ /* If it's been reparented to an unmapped window when previously mapped, destroy the Windows window */
+ winDestroyWindowsWindow (pWin);
+ assert(pWinPriv->hWnd == NULL);
+ }
#if CYGMULTIWINDOW_DEBUG
ErrorF ("-winUpdateWindowsWindow\n");