diff --git a/reactos/win32ss/user/ntuser/focus.c b/reactos/win32ss/user/ntuser/focus.c index 65ebe51adb5..59eb49e2669 100644 --- a/reactos/win32ss/user/ntuser/focus.c +++ b/reactos/win32ss/user/ntuser/focus.c @@ -29,7 +29,7 @@ HWND FASTCALL IntGetCaptureWindow(VOID) { PUSER_MESSAGE_QUEUE ForegroundQueue = IntGetFocusMessageQueue(); - return ForegroundQueue != NULL ? ForegroundQueue->CaptureWindow : 0; + return ( ForegroundQueue ? (ForegroundQueue->spwndCapture ? UserHMGetHandle(ForegroundQueue->spwndCapture) : 0) : 0); } HWND FASTCALL @@ -655,7 +655,7 @@ IntGetCapture(VOID) pti = PsGetCurrentThreadWin32Thread(); ThreadQueue = pti->MessageQueue; - RETURN( ThreadQueue ? ThreadQueue->CaptureWindow : 0); + RETURN( ThreadQueue ? (ThreadQueue->spwndCapture ? UserHMGetHandle(ThreadQueue->spwndCapture) : 0) : 0); CLEANUP: TRACE("Leave IntGetCapture, ret=%i\n",_ret_); @@ -705,7 +705,7 @@ co_UserSetCapture(HWND hWnd) ThreadQueue->QF_flags &= ~QF_CAPTURELOCKED; } - ThreadQueue->CaptureWindow = hWnd; + ThreadQueue->spwndCapture = Window; if (hWnd == NULL) // Release mode. { diff --git a/reactos/win32ss/user/ntuser/input.c b/reactos/win32ss/user/ntuser/input.c index 193ee688138..58dbe704ff9 100644 --- a/reactos/win32ss/user/ntuser/input.c +++ b/reactos/win32ss/user/ntuser/input.c @@ -454,7 +454,6 @@ UserAttachThreadInput(PTHREADINFO ptiFrom, PTHREADINFO ptiTo, BOOL fAttach) ptiFrom->MessageQueue->spwndActive = ptiFrom->pqAttach->spwndActive; ptiFrom->MessageQueue->spwndFocus = ptiFrom->pqAttach->spwndFocus; ptiFrom->MessageQueue->CursorObject = ptiFrom->pqAttach->CursorObject; - ptiFrom->MessageQueue->CaptureWindow = ptiFrom->pqAttach->CaptureWindow; ptiFrom->MessageQueue->spwndCapture = ptiFrom->pqAttach->spwndCapture; ptiFrom->MessageQueue->QF_flags ^= ((ptiFrom->MessageQueue->QF_flags ^ ptiFrom->pqAttach->QF_flags) & QF_CAPTURELOCKED); ptiFrom->MessageQueue->CaretInfo = ptiFrom->pqAttach->CaretInfo; @@ -489,6 +488,7 @@ UserAttachThreadInput(PTHREADINFO ptiFrom, PTHREADINFO ptiTo, BOOL fAttach) ptiFrom->MessageQueue->CursorObject = NULL; ptiFrom->MessageQueue->spwndActive = NULL; ptiFrom->MessageQueue->spwndFocus = NULL; + ptiFrom->MessageQueue->spwndCapture = NULL; ptiFrom->pqAttach = NULL; ptiTo->MessageQueue->iCursorLevel -= ptiFrom->iCursorLevel; } diff --git a/reactos/win32ss/user/ntuser/misc.c b/reactos/win32ss/user/ntuser/misc.c index 37f14e891d0..7a8d238dcb7 100644 --- a/reactos/win32ss/user/ntuser/misc.c +++ b/reactos/win32ss/user/ntuser/misc.c @@ -360,7 +360,7 @@ NtUserGetGUIThreadInfo( SafeGui.hwndActive = MsgQueue->spwndActive ? UserHMGetHandle(MsgQueue->spwndActive) : 0; SafeGui.hwndFocus = MsgQueue->spwndFocus ? UserHMGetHandle(MsgQueue->spwndFocus) : 0; - SafeGui.hwndCapture = MsgQueue->CaptureWindow; + SafeGui.hwndCapture = MsgQueue->spwndCapture ? UserHMGetHandle(MsgQueue->spwndCapture) : 0; SafeGui.hwndMenuOwner = MsgQueue->MenuOwner; SafeGui.hwndMoveSize = MsgQueue->MoveSize; SafeGui.hwndCaret = CaretInfo->hWnd; diff --git a/reactos/win32ss/user/ntuser/msgqueue.c b/reactos/win32ss/user/ntuser/msgqueue.c index ec02c1c6393..233a7e3d736 100644 --- a/reactos/win32ss/user/ntuser/msgqueue.c +++ b/reactos/win32ss/user/ntuser/msgqueue.c @@ -1343,10 +1343,11 @@ BOOL co_IntProcessMouseMessage(MSG* msg, BOOL* RemoveMessages, UINT first, UINT pDesk = pwndDesktop->head.rpdesk; /* find the window to dispatch this mouse message to */ - if (MessageQueue->CaptureWindow) + if (MessageQueue->spwndCapture) { hittest = HTCLIENT; - pwndMsg = IntGetWindowObject(MessageQueue->CaptureWindow); + pwndMsg = MessageQueue->spwndCapture; + if (pwndMsg) UserReferenceObject(pwndMsg); } else { @@ -1521,7 +1522,7 @@ BOOL co_IntProcessMouseMessage(MSG* msg, BOOL* RemoveMessages, UINT first, UINT RETURN(FALSE); } - if ((*RemoveMessages == FALSE) || MessageQueue->CaptureWindow) + if ((*RemoveMessages == FALSE) || MessageQueue->spwndCapture) { /* Accept the message */ msg->message = message; @@ -2180,8 +2181,8 @@ MsqSetStateWindow(PUSER_MESSAGE_QUEUE MessageQueue, ULONG Type, HWND hWnd) switch(Type) { case MSQ_STATE_CAPTURE: - Prev = MessageQueue->CaptureWindow; - MessageQueue->CaptureWindow = hWnd; + Prev = MessageQueue->spwndCapture ? UserHMGetHandle(MessageQueue->spwndCapture) : 0; + MessageQueue->spwndCapture = UserGetWindowObject(hWnd); return Prev; case MSQ_STATE_ACTIVE: Prev = MessageQueue->spwndActive ? UserHMGetHandle(MessageQueue->spwndActive) : 0; diff --git a/reactos/win32ss/user/ntuser/msgqueue.h b/reactos/win32ss/user/ntuser/msgqueue.h index ff8ba3bbef4..0cc4a01af4c 100644 --- a/reactos/win32ss/user/ntuser/msgqueue.h +++ b/reactos/win32ss/user/ntuser/msgqueue.h @@ -75,7 +75,6 @@ typedef struct _USER_MESSAGE_QUEUE /* Last time PeekMessage() was called. */ ULONG LastMsgRead; /* Current capture window for this queue. */ - HWND CaptureWindow; PWND spwndCapture; /* Current window with focus (ie. receives keyboard input) for this queue. */ PWND spwndFocus; diff --git a/reactos/win32ss/user/ntuser/window.c b/reactos/win32ss/user/ntuser/window.c index ca0079969df..9f2cea73253 100644 --- a/reactos/win32ss/user/ntuser/window.c +++ b/reactos/win32ss/user/ntuser/window.c @@ -2430,8 +2430,8 @@ BOOLEAN FASTCALL co_UserDestroyWindow(PWND Window) Window->head.pti->MessageQueue->spwndFocus = NULL; if (Window->head.pti->MessageQueue->spwndActivePrev == Window) Window->head.pti->MessageQueue->spwndActivePrev = NULL; - if (Window->head.pti->MessageQueue->CaptureWindow == Window->head.h) - Window->head.pti->MessageQueue->CaptureWindow = NULL; + if (Window->head.pti->MessageQueue->spwndCapture == Window) + Window->head.pti->MessageQueue->spwndCapture = NULL; /* * Check if this window is the Shell's Desktop Window. If so set hShellWindow to NULL