mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 17:05:44 +00:00
[Win32k]
- Fast fix attach thread input. Tested with win Msg test_SetFocus, fixed the WM_ACTIVATE issue, still needs more testing. See bug 7098, used the test case and it works. svn path=/trunk/; revision=56703
This commit is contained in:
parent
0d6a879b5a
commit
d36d231899
2 changed files with 33 additions and 9 deletions
|
@ -595,8 +595,14 @@ co_UserSetFocus(PWND Window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if the specified window can be set in the input data of a given queue */
|
// Check again! SetActiveWindow could have set the focus via WM_ACTIVATE.
|
||||||
if ( !Window || ThreadQueue == Window->head.pti->MessageQueue)
|
if (ThreadQueue->spwndFocus && ThreadQueue->spwndFocus == Window)
|
||||||
|
{
|
||||||
|
hWndPrev = UserHMGetHandle(ThreadQueue->spwndFocus);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* check if the specified window can be set in the input data of a given queue */
|
||||||
|
if (ThreadQueue == Window->head.pti->MessageQueue)
|
||||||
/* set the current thread focus window */
|
/* set the current thread focus window */
|
||||||
ThreadQueue->spwndFocus = Window;
|
ThreadQueue->spwndFocus = Window;
|
||||||
|
|
||||||
|
|
|
@ -395,17 +395,17 @@ NtUserBlockInput(
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
UserAttachThreadInput(PTHREADINFO pti, PTHREADINFO ptiTo, BOOL fAttach)
|
UserAttachThreadInput(PTHREADINFO ptiFrom, PTHREADINFO ptiTo, BOOL fAttach)
|
||||||
{
|
{
|
||||||
PATTACHINFO pai;
|
PATTACHINFO pai;
|
||||||
|
|
||||||
/* Can not be the same thread. */
|
/* Can not be the same thread. */
|
||||||
if (pti == ptiTo) return FALSE;
|
if (ptiFrom == ptiTo) return FALSE;
|
||||||
|
|
||||||
/* Do not attach to system threads or between different desktops. */
|
/* Do not attach to system threads or between different desktops. */
|
||||||
if (pti->TIF_flags & TIF_DONTATTACHQUEUE ||
|
if (ptiFrom->TIF_flags & TIF_DONTATTACHQUEUE ||
|
||||||
ptiTo->TIF_flags & TIF_DONTATTACHQUEUE ||
|
ptiTo->TIF_flags & TIF_DONTATTACHQUEUE ||
|
||||||
pti->rpdesk != ptiTo->rpdesk)
|
ptiFrom->rpdesk != ptiTo->rpdesk)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* If Attach set, allocate and link. */
|
/* If Attach set, allocate and link. */
|
||||||
|
@ -415,9 +415,16 @@ UserAttachThreadInput(PTHREADINFO pti, PTHREADINFO ptiTo, BOOL fAttach)
|
||||||
if (!pai) return FALSE;
|
if (!pai) return FALSE;
|
||||||
|
|
||||||
pai->paiNext = gpai;
|
pai->paiNext = gpai;
|
||||||
pai->pti1 = pti;
|
pai->pti1 = ptiFrom;
|
||||||
pai->pti2 = ptiTo;
|
pai->pti2 = ptiTo;
|
||||||
gpai = pai;
|
gpai = pai;
|
||||||
|
ERR("Attach Allocated! ptiFrom 0x%p ptiTo 0x%p\n",ptiFrom,ptiTo);
|
||||||
|
|
||||||
|
ptiFrom->pqAttach = ptiFrom->MessageQueue;
|
||||||
|
ptiFrom->MessageQueue = ptiTo->MessageQueue;
|
||||||
|
// FIXME: conditions?
|
||||||
|
ptiFrom->MessageQueue->spwndActive = ptiFrom->pqAttach->spwndActive;
|
||||||
|
ptiFrom->MessageQueue->spwndFocus = ptiFrom->pqAttach->spwndFocus;
|
||||||
}
|
}
|
||||||
else /* If clear, unlink and free it. */
|
else /* If clear, unlink and free it. */
|
||||||
{
|
{
|
||||||
|
@ -430,7 +437,7 @@ UserAttachThreadInput(PTHREADINFO pti, PTHREADINFO ptiTo, BOOL fAttach)
|
||||||
/* Search list and free if found or return false. */
|
/* Search list and free if found or return false. */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (pai->pti2 == ptiTo && pai->pti1 == pti) break;
|
if (pai->pti2 == ptiTo && pai->pti1 == ptiFrom) break;
|
||||||
paiprev = pai;
|
paiprev = pai;
|
||||||
pai = pai->paiNext;
|
pai = pai->paiNext;
|
||||||
} while (pai);
|
} while (pai);
|
||||||
|
@ -440,8 +447,19 @@ UserAttachThreadInput(PTHREADINFO pti, PTHREADINFO ptiTo, BOOL fAttach)
|
||||||
if (paiprev) paiprev->paiNext = pai->paiNext;
|
if (paiprev) paiprev->paiNext = pai->paiNext;
|
||||||
|
|
||||||
ExFreePoolWithTag(pai, USERTAG_ATTACHINFO);
|
ExFreePoolWithTag(pai, USERTAG_ATTACHINFO);
|
||||||
}
|
ERR("Attach Free! ptiFrom 0x%p ptiTo 0x%p\n",ptiFrom,ptiTo);
|
||||||
|
|
||||||
|
ptiFrom->MessageQueue = ptiFrom->pqAttach;
|
||||||
|
// FIXME: conditions?
|
||||||
|
ptiFrom->MessageQueue->spwndActive = NULL;
|
||||||
|
ptiFrom->MessageQueue->spwndFocus = NULL;
|
||||||
|
ptiFrom->pqAttach = NULL;
|
||||||
|
}
|
||||||
|
/* Note that key state, which can be ascertained by calls to the GetKeyState
|
||||||
|
or GetKeyboardState function, is reset after a call to AttachThreadInput.
|
||||||
|
ATM which one?
|
||||||
|
*/
|
||||||
|
RtlCopyMemory(ptiTo->MessageQueue->afKeyState, gafAsyncKeyState, sizeof(gafAsyncKeyState));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue