mirror of
https://github.com/reactos/reactos.git
synced 2024-06-29 01:12:06 +00:00
[WIN32K]
* GetGUIThreadInfo: When they said "foreground thread", they meant the one with the keyboard focus, not the currently running one. NOTE: This needs verification, as I have no idea how to properly handle IntGetFocusMessageQueue() returning NULL. [MAGNIFY] * Make use of the new-found ability to call GetGUIThreadInfo with 0 as the threadId. CORE-10691 svn path=/trunk/; revision=70338
This commit is contained in:
parent
901e051b93
commit
66d1d19b39
|
@ -350,12 +350,11 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
case WM_TIMER:
|
||||
{
|
||||
BOOL hasMoved = FALSE;
|
||||
HWND hwndForeground = GetForegroundWindow ();
|
||||
DWORD threadId = GetWindowThreadProcessId(hwndForeground, NULL);
|
||||
|
||||
GUITHREADINFO guiInfo;
|
||||
guiInfo.cbSize = sizeof(guiInfo);
|
||||
|
||||
GetGUIThreadInfo(threadId, &guiInfo);
|
||||
GetGUIThreadInfo(0, &guiInfo);
|
||||
|
||||
if (bFollowMouse)
|
||||
{
|
||||
|
@ -374,7 +373,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
}
|
||||
}
|
||||
|
||||
if (bFollowCaret && hwndForeground && guiInfo.hwndCaret)
|
||||
if (bFollowCaret && guiInfo.hwndCaret)
|
||||
{
|
||||
POINT ptCaret;
|
||||
ptCaret.x = (guiInfo.rcCaret.left + guiInfo.rcCaret.right) / 2;
|
||||
|
@ -394,7 +393,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
}
|
||||
}
|
||||
|
||||
if (bFollowFocus && hwndForeground && guiInfo.hwndFocus)
|
||||
if (bFollowFocus && guiInfo.hwndFocus)
|
||||
{
|
||||
POINT ptFocus;
|
||||
RECT activeRect;
|
||||
|
|
|
@ -371,27 +371,31 @@ NtUserGetGUIThreadInfo(
|
|||
}
|
||||
W32Thread = (PTHREADINFO)Thread->Tcb.Win32Thread;
|
||||
Desktop = W32Thread->rpdesk;
|
||||
|
||||
if (!Thread || !Desktop )
|
||||
{
|
||||
if(Thread)
|
||||
ObDereferenceObject(Thread);
|
||||
EngSetLastError(ERROR_ACCESS_DENIED);
|
||||
RETURN( FALSE);
|
||||
}
|
||||
|
||||
if ( W32Thread->MessageQueue )
|
||||
MsgQueue = W32Thread->MessageQueue;
|
||||
else
|
||||
{
|
||||
if ( Desktop ) MsgQueue = Desktop->ActiveMessageQueue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ /* Get the foreground thread */
|
||||
Thread = PsGetCurrentThread();
|
||||
W32Thread = (PTHREADINFO)Thread->Tcb.Win32Thread;
|
||||
Desktop = W32Thread->rpdesk;
|
||||
}
|
||||
|
||||
if (!Thread || !Desktop )
|
||||
{
|
||||
if(idThread && Thread)
|
||||
ObDereferenceObject(Thread);
|
||||
EngSetLastError(ERROR_ACCESS_DENIED);
|
||||
RETURN( FALSE);
|
||||
}
|
||||
|
||||
if ( W32Thread->MessageQueue )
|
||||
MsgQueue = W32Thread->MessageQueue;
|
||||
else
|
||||
{
|
||||
if ( Desktop ) MsgQueue = Desktop->ActiveMessageQueue;
|
||||
/* FIXME: Handle NULL queue properly? */
|
||||
MsgQueue = IntGetFocusMessageQueue();
|
||||
if(!MsgQueue)
|
||||
{
|
||||
EngSetLastError(ERROR_ACCESS_DENIED);
|
||||
RETURN( FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
CaretInfo = &MsgQueue->CaretInfo;
|
||||
|
|
Loading…
Reference in a new issue