Author: jimtabor Date: Sat Feb 15 02:14:03 2014 New Revision: 62196
URL: http://svn.reactos.org/svn/reactos?rev=62196&view=rev Log: [Win32k] - Do not re-enter SetFocus, just call message handling to switch focus window. - Fix broken logic when searching for a non child ancestor to send messages/Set focus to. - See CORE-6452.
Modified: trunk/reactos/win32ss/user/ntuser/focus.c trunk/reactos/win32ss/user/ntuser/msgqueue.c trunk/reactos/win32ss/user/ntuser/window.c
Modified: trunk/reactos/win32ss/user/ntuser/focus.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/focus.c... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/focus.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/focus.c [iso-8859-1] Sat Feb 15 02:14:03 2014 @@ -734,14 +734,13 @@ if (bFocus && !(ThreadQueue->QF_flags & QF_FOCUSNULLSINCEACTIVE)) { /* Do not change focus if the window is no longer active */ - if (ThreadQueue->spwndActive == Wnd) - { - if (!ThreadQueue->spwndFocus || - !Wnd || - UserGetAncestor(ThreadQueue->spwndFocus, GA_ROOT) != Wnd) - { - co_UserSetFocus(Wnd); - } + if (pti->MessageQueue->spwndActive != IntGetNonChildAncestor(pti->MessageQueue->spwndFocus)) + { + PWND pWndSend = pti->MessageQueue->spwndActive; + // Clear focus if the active window is minimized. + if (pWndSend && pti->MessageQueue->spwndActive->style & WS_MINIMIZE) pWndSend = NULL; + // Send focus messages and if so, set the focus. + IntSendFocusMessages( pti, pWndSend); } }
@@ -815,12 +814,13 @@ }
/* Check if we can set the focus to this window */ - for (pwndTop = Window; pwndTop != NULL; pwndTop = pwndTop->spwndParent) + //// Fixes wine win test_SetParent both "todo" line 3710 and 3720... + for (pwndTop = Window; pwndTop; pwndTop = pwndTop->spwndParent) { if (pwndTop->style & (WS_MINIMIZED|WS_DISABLED)) return 0; if ((pwndTop->style & (WS_POPUP|WS_CHILD)) != WS_CHILD) break; } - + //// if (co_HOOK_CallHooks( WH_CBT, HCBT_SETFOCUS, (WPARAM)Window->head.h, (LPARAM)hWndPrev)) { ERR("SetFocus 1 WH_CBT Call Hook return!\n");
Modified: trunk/reactos/win32ss/user/ntuser/msgqueue.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/msgqueu... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/msgqueue.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/msgqueue.c [iso-8859-1] Sat Feb 15 02:14:03 2014 @@ -1565,10 +1565,7 @@ if (pwndMsg != MessageQueue->spwndActive) { PWND pwndTop = pwndMsg; - while (pwndTop && ((pwndTop->style & (WS_POPUP|WS_CHILD)) == WS_CHILD)) - { - pwndTop = pwndTop->spwndParent; - } + pwndTop = IntGetNonChildAncestor(pwndTop);
if (pwndTop && pwndTop != pwndDesktop) {
Modified: trunk/reactos/win32ss/user/ntuser/window.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/window.... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/window.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/window.c [iso-8859-1] Sat Feb 15 02:14:03 2014 @@ -277,11 +277,8 @@ PWND FASTCALL IntGetNonChildAncestor(PWND pWnd) { - if (pWnd) - { - while(pWnd && ((pWnd->style & (WS_CHILD | WS_POPUP)) != WS_CHILD)) - pWnd = pWnd->spwndParent; - } + while(pWnd && (pWnd->style & (WS_CHILD | WS_POPUP)) == WS_CHILD) + pWnd = pWnd->spwndParent; return pWnd; }