From: James Tabor Date: Fri, 8 Jun 2012 21:19:31 +0000 (+0000) Subject: [Win32k] X-Git-Tag: backups/ros-csrss@57560~829 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=b9c5be664ab215d721788902a0adbf0ca6f9e2ca [Win32k] - Fix attach thread input based on which thread is foreground. Tested with wine Msg test_SetFocus, CursorIcon test_SetCursor and test_ShowCursor, still needs more testing. See bug 7098 and bug 7107, used the test cases and it works with Qemu. svn path=/trunk/; revision=56714 --- diff --git a/reactos/win32ss/user/ntuser/input.c b/reactos/win32ss/user/ntuser/input.c index 2dcb5e7f73f..83d1463305f 100644 --- a/reactos/win32ss/user/ntuser/input.c +++ b/reactos/win32ss/user/ntuser/input.c @@ -397,6 +397,7 @@ NtUserBlockInput( BOOL FASTCALL UserAttachThreadInput(PTHREADINFO ptiFrom, PTHREADINFO ptiTo, BOOL fAttach) { + MSG msg; PATTACHINFO pai; /* Can not be the same thread. */ @@ -424,9 +425,16 @@ UserAttachThreadInput(PTHREADINFO ptiFrom, PTHREADINFO ptiTo, BOOL fAttach) ptiFrom->pqAttach = ptiFrom->MessageQueue; ptiFrom->MessageQueue = ptiTo->MessageQueue; // FIXME: conditions? + if (ptiFrom->pqAttach == gpqForeground) + { 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; + } } else /* If clear, unlink and free it. */ { @@ -464,6 +472,14 @@ UserAttachThreadInput(PTHREADINFO ptiFrom, PTHREADINFO ptiTo, BOOL fAttach) ATM which one? */ RtlCopyMemory(ptiTo->MessageQueue->afKeyState, gafAsyncKeyState, sizeof(gafAsyncKeyState)); + + /* Generate mouse move message */ + msg.message = WM_MOUSEMOVE; + msg.wParam = UserGetMouseButtonsState(); + msg.lParam = MAKELPARAM(gpsi->ptCursor.x, gpsi->ptCursor.y); + msg.pt = gpsi->ptCursor; + co_MsqInsertMouseMessage(&msg, 0, 0, TRUE); + return TRUE; }