From: "Rémi Bernon" Subject: [PATCH v2 3/3] winemac.drv: Only send WM_CANCELMODE if a menu is active. Message-Id: <20191113122807.14631-3-rbernon@codeweavers.com> Date: Wed, 13 Nov 2019 13:28:07 +0100 In-Reply-To: <20191113122807.14631-1-rbernon@codeweavers.com> References: <20191113122807.14631-1-rbernon@codeweavers.com> Signed-off-by: Rémi Bernon --- dlls/winemac.drv/window.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index 605c0c87f16..8091f5249fe 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -2368,13 +2368,18 @@ void macdrv_window_got_focus(HWND hwnd, const macdrv_event *event) */ void macdrv_window_lost_focus(HWND hwnd, const macdrv_event *event) { + GUITHREADINFO threadinfo; if (!hwnd) return; TRACE("win %p/%p fg %p\n", hwnd, event->window, GetForegroundWindow()); if (hwnd == GetForegroundWindow()) { - SendMessageW(hwnd, WM_CANCELMODE, 0, 0); + threadinfo.cbSize = sizeof(threadinfo); + GetGUIThreadInfo(0, &threadinfo); + if (threadinfo.flags & (GUI_INMENUMODE|GUI_INMOVESIZE|GUI_POPUPMENUMODE|GUI_SYSTEMMENUMODE)) + SendMessageW(hwnd, WM_CANCELMODE, 0, 0); + if (hwnd == GetForegroundWindow()) SetForegroundWindow(GetDesktopWindow()); } -- 2.24.0.rc2