Author: rharabien Date: Sun Feb 12 12:23:54 2012 New Revision: 55559
URL: http://svn.reactos.org/svn/reactos?rev=55559&view=rev Log: [WIN32K] - GetFocus returns NULL if calling thread is not a foreground thread
Modified: trunk/reactos/subsystems/win32/win32k/include/focus.h trunk/reactos/subsystems/win32/win32k/ntuser/focus.c trunk/reactos/subsystems/win32/win32k/ntuser/misc.c
Modified: trunk/reactos/subsystems/win32/win32k/include/focus.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/focus.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/focus.h [iso-8859-1] Sun Feb 12 12:23:54 2012 @@ -4,7 +4,6 @@ * These functions take the window handles from current message queue. */ HWND FASTCALL IntGetCaptureWindow(VOID); -HWND FASTCALL IntGetFocusWindow(VOID); HWND FASTCALL co_UserSetCapture(HWND hWnd); BOOL FASTCALL IntReleaseCapture(VOID);
@@ -13,6 +12,7 @@ */ HWND FASTCALL IntGetThreadFocusWindow(VOID); HWND APIENTRY IntGetCapture(VOID); +HWND FASTCALL UserGetFocusWindow(VOID); HWND FASTCALL UserGetActiveWindow(VOID); BOOL FASTCALL co_IntMouseActivateWindow(PWND Window); BOOL FASTCALL co_IntSetForegroundWindow(PWND Window);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/focus.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/focus.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/focus.c [iso-8859-1] Sun Feb 12 12:23:54 2012 @@ -20,10 +20,17 @@ }
HWND FASTCALL -IntGetFocusWindow(VOID) -{ - PUSER_MESSAGE_QUEUE ForegroundQueue = IntGetFocusMessageQueue(); - return ForegroundQueue != NULL ? ForegroundQueue->FocusWindow : 0; +UserGetFocusWindow(VOID) +{ + PTHREADINFO pti; + PUSER_MESSAGE_QUEUE ThreadQueue; + + pti = PsGetCurrentThreadWin32Thread(); + ThreadQueue = pti->MessageQueue; + /* Is it a foreground queue? */ + if (!ThreadQueue || ThreadQueue != IntGetFocusMessageQueue()) + return NULL; + return ThreadQueue->FocusWindow; }
HWND FASTCALL @@ -34,7 +41,9 @@
pti = PsGetCurrentThreadWin32Thread(); ThreadQueue = pti->MessageQueue; - return ThreadQueue != NULL ? ThreadQueue->FocusWindow : 0; + if (!ThreadQueue) + return NULL; + return ThreadQueue->FocusWindow; }
VOID FASTCALL
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/misc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/misc.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/misc.c [iso-8859-1] Sun Feb 12 12:23:54 2012 @@ -164,7 +164,7 @@ GetW32ThreadInfo(); break; case THREADSTATE_FOCUSWINDOW: - ret = (DWORD_PTR)IntGetThreadFocusWindow(); + ret = (DWORD_PTR)UserGetFocusWindow(); break; case THREADSTATE_CAPTUREWINDOW: /* FIXME: Should use UserEnterShared */