From: Zebediah Figura Subject: [PATCH resend 2/2] winex11.drv, winemac.drv: Don't send WM_CANCELMODE on focus loss. Message-Id: <1517363785-16238-2-git-send-email-z.figura12@gmail.com> Date: Tue, 30 Jan 2018 19:56:25 -0600 In-Reply-To: <1517363785-16238-1-git-send-email-z.figura12@gmail.com> References: <1517363785-16238-1-git-send-email-z.figura12@gmail.com> Signed-off-by: Zebediah Figura --- This and the previous patch fix a WM-dependent failure. Most window managers activate another window when one is minimized, including that of native Windows. The test does in fact account for this, however, Wine currently activates windows incorrectly, both by sending the WM_CANCELMODE message and by failing to kill focus before minimizing a window. This test was succeeding (inside todo_wine) on the testbot, which uses fvwm in focus-follows-mouse mode, since in that case another window would never be activated. dlls/user32/tests/msg.c | 2 +- dlls/winemac.drv/window.c | 6 +----- dlls/winex11.drv/event.c | 1 - 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index f391ab9..2ff0c76 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -5087,7 +5087,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/winemac.drv/window.c b/dlls/winemac.drv/window.c index e49a445..7c07907 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -2335,11 +2335,7 @@ void macdrv_window_lost_focus(HWND hwnd, const macdrv_event *event) TRACE("win %p/%p fg %p\n", hwnd, event->window, GetForegroundWindow()); if (hwnd == GetForegroundWindow()) - { - SendMessageW(hwnd, WM_CANCELMODE, 0, 0); - if (hwnd == GetForegroundWindow()) - SetForegroundWindow(GetDesktopWindow()); - } + SetForegroundWindow(GetDesktopWindow()); } diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index a0bfe05..9bd4e11 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -804,7 +804,6 @@ static BOOL X11DRV_FocusIn( HWND hwnd, XEvent *xev ) return; } if (hwnd != GetForegroundWindow()) return; - 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.7.4