From 53c2028b52770cf0e63d4672199a6f983fd8b4fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Per=20=C3=85ngstr=C3=B6m?= <pang@mbox304.swipnet.se>
Date: Sun, 4 Jul 1999 12:46:37 +0000
Subject: [PATCH] Fixed a problem with apps that override the default behaviour
 on WM_MOUSEACTIVATE message (main window was not activated).

---
 windows/message.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/windows/message.c b/windows/message.c
index c9560439828..4673aa2470e 100644
--- a/windows/message.c
+++ b/windows/message.c
@@ -316,7 +316,7 @@ static DWORD MSG_ProcessMouseMsg( MSG *msg, BOOL remove, INT16 hittest,
 
             /* Activate the window if needed */
 
-            if (hWnd != GetActiveWindow() && hWnd != GetDesktopWindow())
+            if (hwndTop != GetForegroundWindow() && hwndTop != GetDesktopWindow())
             {
                 LONG ret = SendMessageA( hWnd, WM_MOUSEACTIVATE, hwndTop,
                                           MAKELONG( hittest, message ) );
@@ -324,10 +324,11 @@ static DWORD MSG_ProcessMouseMsg( MSG *msg, BOOL remove, INT16 hittest,
                 if ((ret == MA_ACTIVATEANDEAT) || (ret == MA_NOACTIVATEANDEAT))
                          eatMsg = TRUE;
 
-                if (((ret == MA_ACTIVATE) || (ret == MA_ACTIVATEANDEAT)) 
-                      && hwndTop != GetActiveWindow() )
+                if (((ret == MA_ACTIVATE) || (ret == MA_ACTIVATEANDEAT)))
+                {
                       if (!WINPOS_SetActiveWindow( hwndTop, TRUE , TRUE ))
 			 eatMsg = TRUE;
+                }
             }
 	}
     } else sendSC = (remove && sendSC);
-- 
GitLab