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)
{
ERR("ptiFrom is Foreground\n");
else
{
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;
if (ptiTo->MessageQueue == ptiFrom->MessageQueue)
{
+ PWND spwndActive = ptiTo->MessageQueue->spwndActive;
+ PWND spwndFocus = ptiTo->MessageQueue->spwndFocus;
+
if (gptiForeground == ptiFrom)
{
ERR("ptiTo is now pti FG.\n");
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;
}
else
*/
RtlCopyMemory(ptiTo->MessageQueue->afKeyState, gafAsyncKeyState, sizeof(gafAsyncKeyState));
+ ptiTo->MessageQueue->msgDblClk.message = 0;
+
/* Generate mouse move message */
msg.message = WM_MOUSEMOVE;
msg.wParam = UserGetMouseButtonsState();
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)
{
}
Entry = Entry->Flink;
}
+ break;
}
if (WaitStatus == STATUS_USER_APC) break;
}
}
-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;
POINT pt;
TRACE("Got mouse message for %p, hittest: 0x%x\n", msg->hwnd, hittest);
// 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.
UserSetCursor(SYSTEMCUR(ARROW), 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!
{
IntTrackMouseMove(pwndMsg, pDesk, msg, hittest);
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))
{
- return co_IntProcessMouseMessage(Msg, RemoveMessages, first, last);
+ return co_IntProcessMouseMessage(Msg, RemoveMessages, NotForUs, first, last);
}
else if ( IS_KBD_MESSAGE(Msg->message))
{
IN UINT QSflags,
OUT MSG* pMsg)
{
- BOOL AcceptMessage;
+ BOOL AcceptMessage, NotForUs;
PUSER_MESSAGE CurrentMessage;
PLIST_ENTRY ListHead;
MSG msg;
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;
}
msg = CurrentMessage->Msg;
QS_Flags = CurrentMessage->QS_Flags;
+ NotForUs = FALSE;
+
UpdateKeyStateFromMsg(MessageQueue, &msg);
- AcceptMessage = co_IntProcessHardwareMessage(&msg, &Remove, MsgFilterLow, MsgFilterHigh);
+ AcceptMessage = co_IntProcessHardwareMessage(&msg, &Remove, &NotForUs, MsgFilterLow, MsgFilterHigh);
if (Remove)
{
MessageQueue->idSysPeek = idSave;
+ if (NotForUs)
+ {
+ Ret = FALSE;
+ break;
+ }
+
if (AcceptMessage)
{
*pMsg = msg;