From: "Rémi Bernon" Subject: [PATCH v2 2/3] winex11.drv: Only send WM_CANCELMODE if a menu is active. Message-Id: <20191113122807.14631-2-rbernon@codeweavers.com> Date: Wed, 13 Nov 2019 13:28:06 +0100 In-Reply-To: <20191113122807.14631-1-rbernon@codeweavers.com> References: <20191113122807.14631-1-rbernon@codeweavers.com> Signed-off-by: Rémi Bernon --- dlls/user32/tests/msg.c | 2 +- dlls/winex11.drv/event.c | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index cc177b6b259..04c236ca9d5 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -5205,7 +5205,7 @@ static void test_messages(void) ShowWindow(hwnd, SW_MINIMIZE); flush_events(); - ok_sequence(WmShowMinOverlappedSeq, "ShowWindow(SW_SHOWMINIMIZED):overlapped", TRUE); + ok_sequence(WmShowMinOverlappedSeq, "ShowWindow(SW_SHOWMINIMIZED):overlapped", FALSE); flush_sequence(); if (GetWindowLongW( hwnd, GWL_STYLE ) & WS_MINIMIZE) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index dd8837c11da..c18b97f5360 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -819,6 +819,7 @@ static void focus_out( Display *display , HWND hwnd ) { HWND hwnd_tmp; Window focus_win; + GUITHREADINFO threadinfo; int revert; XIC xic; @@ -833,7 +834,12 @@ static void focus_out( Display *display , HWND hwnd ) return; } if (hwnd != GetForegroundWindow()) return; - 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 ); /* don't reset the foreground window, if the window which is getting the focus is a Wine window */ -- 2.24.0.rc2