Author: jimtabor Date: Mon Dec 15 01:38:27 2014 New Revision: 65672
URL: http://svn.reactos.org/svn/reactos?rev=65672&view=rev Log: [NtUser] - Finaly fix CORE-6129 leaving CORE-6651 to fix.
Modified: trunk/reactos/win32ss/user/ntuser/focus.c trunk/reactos/win32ss/user/ntuser/msgqueue.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] Mon Dec 15 01:38:27 2014 @@ -534,62 +534,6 @@ return Ret && fgRet; }
-/* - Revision 7888, activate modal dialog when clicking on a disabled window. -*/ -HWND FASTCALL -IntFindChildWindowToOwner(PWND Root, PWND Owner) -{ - HWND Ret; - PWND Child, OwnerWnd; - - for(Child = Root->spwndChild; Child; Child = Child->spwndNext) - { - OwnerWnd = Child->spwndOwner; - if(!OwnerWnd) - continue; - - if(OwnerWnd == Owner) - { - Ret = Child->head.h; - return Ret; - } - } - return NULL; -} - -BOOL FASTCALL -co_IntMouseActivateWindow(PWND Wnd) -{ - HWND Top; - USER_REFERENCE_ENTRY Ref; - ASSERT_REFS_CO(Wnd); - - if (Wnd->style & WS_DISABLED) - { - BOOL Ret; - PWND TopWnd; - PWND DesktopWindow = UserGetDesktopWindow(); - if (DesktopWindow) - { - ERR("Window Diabled\n"); - Top = IntFindChildWindowToOwner(DesktopWindow, Wnd); - if ((TopWnd = ValidateHwndNoErr(Top))) - { - UserRefObjectCo(TopWnd, &Ref); - Ret = co_IntMouseActivateWindow(TopWnd); - UserDerefObjectCo(TopWnd); - - return Ret; - } - } - return FALSE; - } - TRACE("Mouse Active\n"); - co_IntSetForegroundAndFocusWindow(Wnd, TRUE); - return TRUE; -} - BOOL FASTCALL co_IntSetActiveWindow(PWND Wnd OPTIONAL, BOOL bMouse, BOOL bFocus, BOOL Async) { @@ -760,6 +704,13 @@ //ERR("co_IntSetActiveWindow Exit\n"); if (Wnd) Wnd->state &= ~WNDS_BEINGACTIVATED; return (ThreadQueue->spwndActive == Wnd); +} + +BOOL FASTCALL +co_IntMouseActivateWindow(PWND Wnd) +{ + TRACE("Mouse Active\n"); + return co_IntSetForegroundAndFocusWindow(Wnd, TRUE); }
BOOL FASTCALL
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] Mon Dec 15 01:38:27 2014 @@ -1440,7 +1440,7 @@ pwndDesktop = UserGetDesktopWindow(); MessageQueue = pti->MessageQueue; CurInfo = IntGetSysCursorInfo(); - pwndMsg = ValidateHwndNoErr(msg->hwnd); + pwndPopUP = pwndMsg = ValidateHwndNoErr(msg->hwnd); clk_msg = MessageQueue->msgDblClk; pDesk = pwndDesktop->head.rpdesk;
@@ -1457,6 +1457,27 @@ Start with null window. See wine win.c:test_mouse_input:WM_COMMAND tests. */ pwndMsg = co_WinPosWindowFromPoint( NULL, &msg->pt, &hittest, FALSE); + // + // CORE-6129, Override if a diabled window with a visible popup was selected. + // + if (pwndPopUP && pwndPopUP->style & WS_DISABLED) + { + TRACE("window disabled\n"); + pwndPopUP = co_IntFindChildWindowToOwner(UserGetDesktopWindow(), pwndPopUP); + if ( pwndPopUP && + pwndPopUP->style & WS_POPUP && + pwndPopUP->style & WS_VISIBLE && + (pwndPopUP->head.pti->MessageQueue != gpqForeground || + pwndPopUP->head.pti->MessageQueue->spwndActive != pwndPopUP) && + //pwndPopUP != pwndPopUP->head.rpdesk->pDeskInfo->spwndShell needs testing. + pwndPopUP != ValidateHwndNoErr(InputWindowStation->ShellWindow) ) + { + TRACE("Found Popup!\n"); + UserDereferenceObject(pwndMsg); + pwndMsg = pwndPopUP; + UserReferenceObject(pwndMsg); + } + } }
TRACE("Got mouse message for %p, hittest: 0x%x\n", msg->hwnd, hittest);