- Fix lockup while testing wine test_activateapp (all the tests including the ones commented out). Reordered focus functions to eliminate recursions. Fix ROSTESTS-208.

svn path=/trunk/; revision=72880
This commit is contained in:
James Tabor 2016-10-01 18:48:02 +00:00
parent 69ce708392
commit d8c3f23447
6 changed files with 676 additions and 238 deletions

File diff suppressed because it is too large Load diff

View file

@ -21,6 +21,11 @@ BOOL FASTCALL co_IntMouseActivateWindow(PWND Window);
BOOL FASTCALL co_IntSetForegroundWindow(PWND Window);
BOOL FASTCALL co_IntSetForegroundWindowMouse(PWND Window);
BOOL FASTCALL co_IntSetActiveWindow(PWND,BOOL,BOOL,BOOL);
BOOL FASTCALL IntUserSetActiveWindow(PWND,BOOL,BOOL,BOOL);
BOOL FASTCALL UserSetActiveWindow(PWND Wnd);
BOOL FASTCALL IntLockSetForegroundWindow(UINT uLockCode);
BOOL FASTCALL IntAllowSetForegroundWindow(DWORD dwProcessId);
VOID FASTCALL IntActivateWindow(PWND,PTHREADINFO,HANDLE,DWORD);
BOOL FASTCALL IntDeactivateWindow(PTHREADINFO,HANDLE);
BOOL FASTCALL co_IntSetForegroundMessageQueue(PWND,PTHREADINFO,BOOL,DWORD );
VOID FASTCALL UpdateShellHook(PWND);

View file

@ -613,7 +613,7 @@ IntCallWndProcRet ( PWND Window, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPar
static LRESULT handle_internal_message( PWND pWnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
LRESULT lRes;
USER_REFERENCE_ENTRY Ref;
// USER_REFERENCE_ENTRY Ref;
// PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
if (!pWnd ||
@ -641,14 +641,6 @@ static LRESULT handle_internal_message( PWND pWnd, UINT msg, WPARAM wparam, LPAR
ExFreePoolWithTag(winpos, USERTAG_SWP);
return lRes;
}
case WM_ASYNC_SETACTIVEWINDOW:
{
PWND Window = (PWND)wparam;
if (wparam) UserRefObjectCo(Window, &Ref);
lRes = (LRESULT)co_IntSetActiveWindow(Window,(BOOL)lparam,TRUE,TRUE);
if (wparam) UserDerefObjectCo(Window);
return lRes;
}
case WM_ASYNC_DESTROYWINDOW:
{
ERR("WM_ASYNC_DESTROYWINDOW\n");
@ -661,16 +653,29 @@ static LRESULT handle_internal_message( PWND pWnd, UINT msg, WPARAM wparam, LPAR
return 0;
}
static LRESULT handle_internal_events( PTHREADINFO pti, PWND pWnd, LONG_PTR ExtraInfo, PMSG pMsg)
static LRESULT handle_internal_events( PTHREADINFO pti, PWND pWnd, DWORD dwQEvent, LONG_PTR ExtraInfo, PMSG pMsg)
{
LRESULT Result = 0;
switch(pMsg->lParam)
switch(dwQEvent)
{
case POSTEVENT_NWE:
{
co_EVENT_CallEvents( pMsg->message, pMsg->hwnd, pMsg->wParam, ExtraInfo);
}
break;
case POSTEVENT_SAW:
{
//ERR("HIE : SAW : pti 0x%p hWnd 0x%p\n",pti,pMsg->hwnd);
IntActivateWindow((PWND)pMsg->wParam, pti, (HANDLE)pMsg->lParam, (DWORD)ExtraInfo);
}
break;
case POSTEVENT_DAW:
{
//ERR("HIE : DAW : pti 0x%p tid 0x%p hWndPrev 0x%p\n",pti,ExtraInfo,pMsg->hwnd);
IntDeactivateWindow(pti, (HANDLE)ExtraInfo);
}
break;
}
return Result;
}
@ -873,6 +878,7 @@ co_IntPeekMessage( PMSG Msg,
MsgFilterMax,
ProcessMask,
ExtraInfo,
0,
Msg ))
{
return TRUE;
@ -914,6 +920,7 @@ co_IntPeekMessage( PMSG Msg,
{
LONG_PTR eExtraInfo;
MSG eMsg;
DWORD dwQEvent;
if (MsqPeekMessage( pti,
TRUE,
Window,
@ -921,9 +928,10 @@ co_IntPeekMessage( PMSG Msg,
0,
QS_EVENT,
&eExtraInfo,
&dwQEvent,
&eMsg ))
{
handle_internal_events( pti, Window, eExtraInfo, &eMsg);
handle_internal_events( pti, Window, dwQEvent, eExtraInfo, &eMsg);
continue;
}
}

View file

@ -2115,6 +2115,7 @@ MsqPeekMessage(IN PTHREADINFO pti,
IN UINT MsgFilterHigh,
IN UINT QSflags,
OUT LONG_PTR *ExtraInfo,
OUT DWORD *dwQEvent,
OUT PMSG Message)
{
PUSER_MESSAGE CurrentMessage;
@ -2145,6 +2146,7 @@ MsqPeekMessage(IN PTHREADINFO pti,
*Message = CurrentMessage->Msg;
*ExtraInfo = CurrentMessage->ExtraInfo;
QS_Flags = CurrentMessage->QS_Flags;
if (dwQEvent) *dwQEvent = CurrentMessage->dwQEvent;
if (Remove)
{

View file

@ -120,7 +120,10 @@ enum internal_event_message
WM_ASYNC_DESTROYWINDOW
};
#define POSTEVENT_DAW 4
#define POSTEVENT_SAW 5
#define POSTEVENT_NWE 14
#define POSTEVENT_NONE 0xFFFF
extern LIST_ENTRY usmList;
@ -141,6 +144,7 @@ MsqPeekMessage(IN PTHREADINFO pti,
IN UINT MsgFilterHigh,
IN UINT QSflags,
OUT LONG_PTR *ExtraInfo,
OUT DWORD *dwQEvent,
OUT PMSG Message);
BOOL APIENTRY
co_MsqPeekHardwareMessage(IN PTHREADINFO pti,
@ -261,7 +265,7 @@ WPARAM FASTCALL MsqGetDownKeyState(PUSER_MESSAGE_QUEUE);
BOOL FASTCALL IsThreadSuspended(PTHREADINFO);
PUSER_SENT_MESSAGE FASTCALL AllocateUserMessage(BOOL);
VOID FASTCALL FreeUserMessage(PUSER_SENT_MESSAGE);
VOID FASTCALL MsqDestroyMessage(PUSER_MESSAGE);
int UserShowCursor(BOOL bShow);
PCURICON_OBJECT

View file

@ -401,6 +401,7 @@ co_WinPosActivateOtherWindow(PWND Wnd)
if (IntIsDesktopWindow(Wnd))
{
//ERR("WinPosActivateOtherWindow Set Focus Msg Q No window!\n");
IntSetFocusMessageQueue(NULL);
return;
}
@ -437,6 +438,7 @@ co_WinPosActivateOtherWindow(PWND Wnd)
WndTo = WndTo->spwndChild;
if ( WndTo == NULL )
{
//ERR("WinPosActivateOtherWindow No window!\n");
return;
}
for (;;)
@ -464,10 +466,10 @@ done:
}
}
//ERR("WinPosActivateOtherWindow Set Active 0x%p\n",WndTo);
if (!co_IntSetActiveWindow(WndTo,FALSE,TRUE,FALSE)) /* Ok for WndTo to be NULL here */
if (!UserSetActiveWindow(WndTo)) /* Ok for WndTo to be NULL here */
{
//ERR("WPAOW SA 1\n");
co_IntSetActiveWindow(NULL,FALSE,TRUE,FALSE);
UserSetActiveWindow(NULL);
}
if (WndTo) UserDerefObjectCo(WndTo);
}
@ -1817,7 +1819,7 @@ co_WinPosSetWindowPos(
RECTL CopyRect;
PWND Ancestor;
BOOL bPointerInWindow, PosChanged = FALSE;
//PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
ASSERT_REFS_CO(Window);
@ -2215,10 +2217,15 @@ co_WinPosSetWindowPos(
else
{
//ERR("SetWindowPos Set FG Window!\n");
if (Window->state & WNDS_BEINGACTIVATED) // Inside SAW?
co_IntSetActiveWindow(Window, FALSE, TRUE, FALSE); // Fixes Api AttachThreadInput tests.
else
co_IntSetForegroundWindow(Window); // Fixes SW_HIDE issues. Wine win test_SetActiveWindow & test_SetForegroundWindow.
if ( pti->MessageQueue->spwndActive != Window ||
pti->MessageQueue != gpqForeground )
{
//ERR("WPSWP : set active window\n");
if (!(Window->state & WNDS_BEINGACTIVATED)) // Inside SAW?
{
co_IntSetForegroundWindow(Window); // Fixes SW_HIDE issues. Wine win test_SetActiveWindow & test_SetForegroundWindow.
}
}
}
}