Author: jimtabor
Date: Fri Jun  8 21:19:31 2012
New Revision: 56714

URL: http://svn.reactos.org/svn/reactos?rev=56714&view=rev
Log:
[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.

Modified:
    trunk/reactos/win32ss/user/ntuser/input.c

Modified: trunk/reactos/win32ss/user/ntuser/input.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/input.c?rev=56714&r1=56713&r2=56714&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/input.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/input.c [iso-8859-1] Fri Jun  8 21:19:31 
2012
@@ -397,6 +397,7 @@
 BOOL FASTCALL
 UserAttachThreadInput(PTHREADINFO ptiFrom, PTHREADINFO ptiTo, BOOL fAttach)
 {
+    MSG msg;
     PATTACHINFO pai;
 
     /* Can not be the same thread. */
@@ -424,9 +425,16 @@
         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 @@
        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;
 }
 


Reply via email to