- Fix more ATI issues, pass more related tests. See CORE-6551.

svn path=/trunk/; revision=68889
This commit is contained in:
James Tabor 2015-09-01 01:48:37 +00:00
parent e4fd9b81bc
commit 7627920bef
2 changed files with 58 additions and 18 deletions

View file

@ -492,16 +492,6 @@ UserAttachThreadInput(PTHREADINFO ptiFrom, PTHREADINFO ptiTo, BOOL fAttach)
ptiTo->MessageQueue->iCursorLevel -= ptiFrom->iCursorLevel; ptiTo->MessageQueue->iCursorLevel -= ptiFrom->iCursorLevel;
// FIXME: conditions?
if (ptiTo->MessageQueue == gpqForeground)
{
ERR("ptiTo is Foreground\n");
}
else
{
ERR("ptiTo NOT Foreground\n");
}
if (ptiFrom->MessageQueue == gpqForeground) if (ptiFrom->MessageQueue == gpqForeground)
{ {
ERR("ptiFrom is Foreground\n"); ERR("ptiFrom is Foreground\n");
@ -517,6 +507,10 @@ UserAttachThreadInput(PTHREADINFO ptiFrom, PTHREADINFO ptiTo, BOOL fAttach)
else else
{ {
ERR("ptiFrom NOT Foreground\n"); ERR("ptiFrom NOT Foreground\n");
if ( ptiTo->MessageQueue->spwndActive == 0 )
ptiTo->MessageQueue->spwndActive = ptiFrom->MessageQueue->spwndActive;
if ( ptiTo->MessageQueue->spwndFocus == 0 )
ptiTo->MessageQueue->spwndFocus = ptiFrom->MessageQueue->spwndFocus;
} }
CurIcon = ptiFrom->MessageQueue->CursorObject; CurIcon = ptiFrom->MessageQueue->CursorObject;
@ -584,6 +578,9 @@ UserAttachThreadInput(PTHREADINFO ptiFrom, PTHREADINFO ptiTo, BOOL fAttach)
if (ptiTo->MessageQueue == ptiFrom->MessageQueue) if (ptiTo->MessageQueue == ptiFrom->MessageQueue)
{ {
PWND spwndActive = ptiTo->MessageQueue->spwndActive;
PWND spwndFocus = ptiTo->MessageQueue->spwndFocus;
if (gptiForeground == ptiFrom) if (gptiForeground == ptiFrom)
{ {
ERR("ptiTo is now pti FG.\n"); ERR("ptiTo is now pti FG.\n");
@ -598,6 +595,22 @@ UserAttachThreadInput(PTHREADINFO ptiFrom, PTHREADINFO ptiTo, BOOL fAttach)
ptiFrom->MessageQueue = MsqCreateMessageQueue(ptiFrom); ptiFrom->MessageQueue = MsqCreateMessageQueue(ptiFrom);
if (spwndActive)
{
if (spwndActive->head.pti == ptiFrom)
{
ptiFrom->MessageQueue->spwndActive = spwndActive;
ptiTo->MessageQueue->spwndActive = 0;
}
}
if (spwndFocus)
{
if (spwndFocus->head.pti == ptiFrom)
{
ptiFrom->MessageQueue->spwndFocus = spwndFocus;
ptiTo->MessageQueue->spwndFocus = 0;
}
}
ptiTo->MessageQueue->iCursorLevel -= ptiFrom->iCursorLevel; ptiTo->MessageQueue->iCursorLevel -= ptiFrom->iCursorLevel;
} }
else else
@ -611,6 +624,8 @@ UserAttachThreadInput(PTHREADINFO ptiFrom, PTHREADINFO ptiTo, BOOL fAttach)
*/ */
RtlCopyMemory(ptiTo->MessageQueue->afKeyState, gafAsyncKeyState, sizeof(gafAsyncKeyState)); RtlCopyMemory(ptiTo->MessageQueue->afKeyState, gafAsyncKeyState, sizeof(gafAsyncKeyState));
ptiTo->MessageQueue->msgDblClk.message = 0;
/* Generate mouse move message */ /* Generate mouse move message */
msg.message = WM_MOUSEMOVE; msg.message = WM_MOUSEMOVE;
msg.wParam = UserGetMouseButtonsState(); msg.wParam = UserGetMouseButtonsState();

View file

@ -639,7 +639,13 @@ co_MsqInsertMouseMessage(MSG* Msg, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook
return; return;
} }
MessageQueue->ptiMouse = pti; // Check to see if this is attached.
if ( pti != MessageQueue->ptiMouse &&
MessageQueue->cThreads > 1 )
{
// Set the send pti to the message queue mouse pti.
pti = MessageQueue->ptiMouse;
}
if (Msg->message == WM_MOUSEMOVE) if (Msg->message == WM_MOUSEMOVE)
{ {
@ -1252,6 +1258,7 @@ co_MsqSendMessage(PTHREADINFO ptirec,
} }
Entry = Entry->Flink; Entry = Entry->Flink;
} }
break;
} }
if (WaitStatus == STATUS_USER_APC) break; if (WaitStatus == STATUS_USER_APC) break;
@ -1413,7 +1420,7 @@ IntTrackMouseMove(PWND pwndTrack, PDESKTOP pDesk, PMSG msg, USHORT hittest)
} }
} }
BOOL co_IntProcessMouseMessage(MSG* msg, BOOL* RemoveMessages, UINT first, UINT last) BOOL co_IntProcessMouseMessage(MSG* msg, BOOL* RemoveMessages, BOOL* NotForUs, UINT first, UINT last)
{ {
MSG clk_msg; MSG clk_msg;
POINT pt; POINT pt;
@ -1454,7 +1461,7 @@ BOOL co_IntProcessMouseMessage(MSG* msg, BOOL* RemoveMessages, UINT first, UINT
TRACE("Got mouse message for %p, hittest: 0x%x\n", msg->hwnd, hittest); TRACE("Got mouse message for %p, hittest: 0x%x\n", msg->hwnd, hittest);
// Null window or not the same "Hardware" message queue. // Null window or not the same "Hardware" message queue.
if (pwndMsg == NULL || pwndMsg->head.pti->MessageQueue != pti->MessageQueue) if (pwndMsg == NULL || pwndMsg->head.pti->MessageQueue != MessageQueue)
{ {
// Crossing a boundary, so set cursor. See default message queue cursor. // Crossing a boundary, so set cursor. See default message queue cursor.
UserSetCursor(SYSTEMCUR(ARROW), FALSE); UserSetCursor(SYSTEMCUR(ARROW), FALSE);
@ -1463,6 +1470,16 @@ BOOL co_IntProcessMouseMessage(MSG* msg, BOOL* RemoveMessages, UINT first, UINT
return FALSE; return FALSE;
} }
// Check to see if this is attached,
if ( pwndMsg->head.pti != pti && // window thread is not current,
MessageQueue->cThreads > 1 ) // and is attached...
{
// This is not for us and we should leave so the other thread can check for messages!!!
*NotForUs = TRUE;
*RemoveMessages = TRUE;
return FALSE;
}
if ( MessageQueue == gpqCursor ) // Cursor must use the same Queue! if ( MessageQueue == gpqCursor ) // Cursor must use the same Queue!
{ {
IntTrackMouseMove(pwndMsg, pDesk, msg, hittest); IntTrackMouseMove(pwndMsg, pDesk, msg, hittest);
@ -1795,11 +1812,11 @@ BOOL co_IntProcessKeyboardMessage(MSG* Msg, BOOL* RemoveMessages)
return Ret; return Ret;
} }
BOOL co_IntProcessHardwareMessage(MSG* Msg, BOOL* RemoveMessages, UINT first, UINT last) BOOL co_IntProcessHardwareMessage(MSG* Msg, BOOL* RemoveMessages, BOOL* NotForUs, UINT first, UINT last)
{ {
if ( IS_MOUSE_MESSAGE(Msg->message)) if ( IS_MOUSE_MESSAGE(Msg->message))
{ {
return co_IntProcessMouseMessage(Msg, RemoveMessages, first, last); return co_IntProcessMouseMessage(Msg, RemoveMessages, NotForUs, first, last);
} }
else if ( IS_KBD_MESSAGE(Msg->message)) else if ( IS_KBD_MESSAGE(Msg->message))
{ {
@ -1835,7 +1852,7 @@ co_MsqPeekHardwareMessage(IN PTHREADINFO pti,
IN UINT QSflags, IN UINT QSflags,
OUT MSG* pMsg) OUT MSG* pMsg)
{ {
BOOL AcceptMessage; BOOL AcceptMessage, NotForUs;
PUSER_MESSAGE CurrentMessage; PUSER_MESSAGE CurrentMessage;
PLIST_ENTRY ListHead; PLIST_ENTRY ListHead;
MSG msg; MSG msg;
@ -1858,7 +1875,7 @@ co_MsqPeekHardwareMessage(IN PTHREADINFO pti,
if (MessageQueue->ptiSysLock != pti) if (MessageQueue->ptiSysLock != pti)
{ {
ERR("MsqPeekHardwareMessage: Thread Q is locked to another pti!\n"); ERR("Thread Q is locked to ptiSysLock 0x%p pti 0x%p\n",MessageQueue->ptiSysLock,pti);
return FALSE; return FALSE;
} }
@ -1891,8 +1908,10 @@ co_MsqPeekHardwareMessage(IN PTHREADINFO pti,
msg = CurrentMessage->Msg; msg = CurrentMessage->Msg;
QS_Flags = CurrentMessage->QS_Flags; QS_Flags = CurrentMessage->QS_Flags;
NotForUs = FALSE;
UpdateKeyStateFromMsg(MessageQueue, &msg); UpdateKeyStateFromMsg(MessageQueue, &msg);
AcceptMessage = co_IntProcessHardwareMessage(&msg, &Remove, MsgFilterLow, MsgFilterHigh); AcceptMessage = co_IntProcessHardwareMessage(&msg, &Remove, &NotForUs, MsgFilterLow, MsgFilterHigh);
if (Remove) if (Remove)
{ {
@ -1906,6 +1925,12 @@ co_MsqPeekHardwareMessage(IN PTHREADINFO pti,
MessageQueue->idSysPeek = idSave; MessageQueue->idSysPeek = idSave;
if (NotForUs)
{
Ret = FALSE;
break;
}
if (AcceptMessage) if (AcceptMessage)
{ {
*pMsg = msg; *pMsg = msg;