[PATCH 2/3] user32: Check for events before getting the cursor and reupload the cursor position to the server if we get the cursor from the driver

Max Qian public at maxqia.com
Thu Sep 8 03:15:56 CDT 2016


Signed-off-by: Max Qian <public at maxqia.com>
---
 dlls/user32/input.c | 31 +++++++++++++++++++++++--------
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/dlls/user32/input.c b/dlls/user32/input.c
index 63fae67..fd64180 100644
--- a/dlls/user32/input.c
+++ b/dlls/user32/input.c
@@ -233,6 +233,12 @@ void WINAPI mouse_event( DWORD dwFlags, DWORD dx, DWORD dy,
 }
 
 
+static void check_for_events( UINT flags )
+{
+    if (USER_Driver->pMsgWaitForMultipleObjectsEx( 0, NULL, 0, flags, 0 ) == WAIT_TIMEOUT)
+        flush_window_surfaces( TRUE );
+}
+
 /***********************************************************************
  *		GetCursorPos (USER32.@)
  */
@@ -242,7 +248,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetCursorPos( POINT *pt )
     DWORD last_change;
 
     if (!pt) return FALSE;
-
+    check_for_events( QS_INPUT );
     SERVER_START_REQ( set_cursor )
     {
         if ((ret = !wine_server_call( req )))
@@ -255,7 +261,22 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetCursorPos( POINT *pt )
     SERVER_END_REQ;
 
     /* query new position from graphics driver if we haven't updated recently */
-    if (ret && GetTickCount() - last_change > 100) ret = USER_Driver->pGetCursorPos( pt );
+    if (ret && GetTickCount() - last_change > 100)
+    {
+        USER_Driver->pGetCursorPos( pt );
+        SERVER_START_REQ( set_cursor )
+        {
+            req->flags = SET_CURSOR_POS;
+            req->x = pt->x;
+            req->y = pt->y;
+            if ((ret = !wine_server_call( req )))
+            {
+                pt->x = reply->new_x;
+                pt->y = reply->new_y;
+            }
+        }
+        SERVER_END_REQ;
+    }
     return ret;
 }
 
@@ -354,12 +375,6 @@ HWND WINAPI GetCapture(void)
 }
 
 
-static void check_for_events( UINT flags )
-{
-    if (USER_Driver->pMsgWaitForMultipleObjectsEx( 0, NULL, 0, flags, 0 ) == WAIT_TIMEOUT)
-        flush_window_surfaces( TRUE );
-}
-
 /**********************************************************************
  *		GetAsyncKeyState (USER32.@)
  *
-- 
2.9.3




More information about the wine-patches mailing list