From e635952459c9f563860dda729e3a19374a27c7ec Mon Sep 17 00:00:00 2001
From: Ken Thomases <ken@codeweavers.com>
Date: Thu, 6 Jun 2013 19:44:11 -0500
Subject: [PATCH] winemac: Actually switch Win32 focus away from a window that
 has lost Cocoa focus.

---
 dlls/winemac.drv/window.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c
index 7e0c60e4841..5328489e7df 100644
--- a/dlls/winemac.drv/window.c
+++ b/dlls/winemac.drv/window.c
@@ -1587,7 +1587,11 @@ 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());
+    }
 }
 
 
-- 
GitLab