From 0f7ef4bd8dbf78c29f5ca249c43bd28f06b5bdf8 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Tue, 15 Nov 2005 16:53:26 +0000 Subject: [PATCH] Do not change focus if the being activated window is no longer active. --- dlls/user/focus.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/dlls/user/focus.c b/dlls/user/focus.c index 0f2c65b878d..aa14a4d9621 100644 --- a/dlls/user/focus.c +++ b/dlls/user/focus.c @@ -161,9 +161,15 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus ) /* now change focus if necessary */ if (focus) { - HWND curfocus = GetFocus(); - if (!curfocus || !hwnd || GetAncestor( curfocus, GA_ROOT ) != hwnd) - set_focus_window( hwnd ); + GUITHREADINFO info; + + GetGUIThreadInfo( GetCurrentThreadId(), &info ); + /* Do not change focus if the window is no more active */ + if (hwnd == info.hwndActive) + { + if (!info.hwndFocus || !hwnd || GetAncestor( info.hwndFocus, GA_ROOT ) != hwnd) + set_focus_window( hwnd ); + } } return TRUE;