diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2019-06-22 12:37:27 +0100 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2019-06-22 18:47:52 +0100 |
commit | 3f73ae1e3a081bf316ab729afc5ddbb62247982e (patch) | |
tree | 6105efbc82e644d9efdf2f1f548d1e85fc11c7f5 | |
parent | d356dfc55d00b2a230d2798da0822325b995dfa9 (diff) |
Only convert WM_DESTROY into a WM_DELETE_WINDOW for unowned windows
winDestroyWindowsWindow() traverses the tree of child Windows windows,
marking them as destroyed, but in the Windows world there is another
class of windows which will get destroyed when another windows is: owned
windows.
We make top-level TRANSIENT_FOR windows owned (so they are minimized at
the same time at their owner). There's no easy way to enumerate the
owned windows of a Windows window.
Instead, we avoid translating a WM_DESTROY into a WM_DELETE_WINDOW
unless the window is unowned. I'm uncertain under what circumstances
the kill here actually gets used.
See https://cygwin.com/ml/cygwin/2019-06/msg00168.html
In that case, we have a submenu which is TRANSIENT_FOR a menu, which is
TRANSIENT_FOR the applications main window. When focus moves away, the
menu is unmapped, destroying it's window, which causes the submenu to be
also destroyed.
-rw-r--r-- | hw/xwin/winmultiwindowwndproc.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c index ee3d1637e..c79792984 100644 --- a/hw/xwin/winmultiwindowwndproc.c +++ b/hw/xwin/winmultiwindowwndproc.c @@ -981,12 +981,16 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) /* Branch on if the window was killed in X already */ if (pWinPriv && !pWinPriv->fXKilled) { - ErrorF("winTopLevelWindowProc - WM_DESTROY - WM_WM_KILL\n"); - - /* Tell our Window Manager thread to kill the window */ - wmMsg.msg = WM_WM_KILL; - if (fWMMsgInitialized) - winSendMessageToWM(s_pScreenPriv->pWMInfo, &wmMsg); + /* Unowned i.e. at the top of a TRANSIENT_FOR hierarchy */ + HWND owner = GetWindow(hwnd, GW_OWNER); + if (!owner) { + ErrorF("winTopLevelWindowProc - WM_DESTROY - WM_WM_KILL\n"); + + /* Tell our Window Manager thread to kill the window */ + wmMsg.msg = WM_WM_KILL; + if (fWMMsgInitialized) + winSendMessageToWM(s_pScreenPriv->pWMInfo, &wmMsg); + } } RemoveProp(hwnd, WIN_WINDOW_PROP); |