[PATCH] Get the position from the driver on every GetCursorPos run

Max Qian public at maxqia.com
Fri Aug 19 00:10:22 CDT 2016


This reverts the GetCursorPos changes in commits 6576703 and f1a3480 to fix bug 24951.

Signed-off-by: Max Qian <public at maxqia.com>
---
 dlls/user32/input.c            | 14 ++++++--------
 include/wine/server_protocol.h |  4 +---
 server/protocol.def            |  1 -
 server/queue.c                 |  5 +----
 server/request.h               |  3 +--
 server/trace.c                 |  1 -
 server/user.h                  |  1 -
 7 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/dlls/user32/input.c b/dlls/user32/input.c
index 63fae67..3595ea7 100644
--- a/dlls/user32/input.c
+++ b/dlls/user32/input.c
@@ -239,23 +239,21 @@ void WINAPI mouse_event( DWORD dwFlags, DWORD dx, DWORD dy,
 BOOL WINAPI DECLSPEC_HOTPATCH GetCursorPos( POINT *pt )
 {
     BOOL ret;
-    DWORD last_change;
 
     if (!pt) return FALSE;
+    ret = USER_Driver->pGetCursorPos( pt );
 
     SERVER_START_REQ( set_cursor )
     {
-        if ((ret = !wine_server_call( req )))
+        if (ret)  /* update it */
         {
-            pt->x = reply->new_x;
-            pt->y = reply->new_y;
-            last_change = reply->last_change;
+            req->flags = SET_CURSOR_POS;
+            req->x     = pt->x;
+            req->y     = pt->y;
+            wine_server_call( req );
         }
     }
     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 );
     return ret;
 }
 
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 8f5b7aa..6d6afb5 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -5263,8 +5263,6 @@ struct set_cursor_reply
     int            new_x;
     int            new_y;
     rectangle_t    new_clip;
-    unsigned int   last_change;
-    char __pad_52[4];
 };
 #define SET_CURSOR_HANDLE 0x01
 #define SET_CURSOR_COUNT  0x02
@@ -6250,6 +6248,6 @@ union generic_reply
     struct terminate_job_reply terminate_job_reply;
 };
 
-#define SERVER_PROTOCOL_VERSION 509
+#define SERVER_PROTOCOL_VERSION 510
 
 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/server/protocol.def b/server/protocol.def
index 8f28548..bcaf8dc 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -3650,7 +3650,6 @@ struct handle_info
     int            new_x;         /* new position */
     int            new_y;
     rectangle_t    new_clip;      /* new clip rectangle */
-    unsigned int   last_change;   /* time of last position change */
 @END
 #define SET_CURSOR_HANDLE 0x01
 #define SET_CURSOR_COUNT  0x02
diff --git a/server/queue.c b/server/queue.c
index f82060f..c765fab 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -1494,7 +1494,6 @@ static void queue_hardware_message( struct desktop *desktop, struct message *msg
             if (desktop->cursor.x != x || desktop->cursor.y != y) always_queue = 1;
             desktop->cursor.x = x;
             desktop->cursor.y = y;
-            desktop->cursor.last_change = get_tick_count();
         }
         if (desktop->keystate[VK_LBUTTON] & 0x80)  msg->wparam |= MK_LBUTTON;
         if (desktop->keystate[VK_MBUTTON] & 0x80)  msg->wparam |= MK_MBUTTON;
@@ -1610,10 +1609,9 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
         WM_MOUSEHWHEEL   /* 0x1000 = MOUSEEVENTF_HWHEEL */
     };
 
-    desktop->cursor.last_change = get_tick_count();
     flags = input->mouse.flags;
     time  = input->mouse.time;
-    if (!time) time = desktop->cursor.last_change;
+    if (!time) time = get_tick_count();
 
     if (flags & MOUSEEVENTF_MOVE)
     {
@@ -3116,7 +3114,6 @@ DECL_HANDLER(set_cursor)
     reply->new_x       = input->desktop->cursor.x;
     reply->new_y       = input->desktop->cursor.y;
     reply->new_clip    = input->desktop->cursor.clip;
-    reply->last_change = input->desktop->cursor.last_change;
 }
 
 DECL_HANDLER(update_rawinput_devices)
diff --git a/server/request.h b/server/request.h
index d55b7e7..09435d4 100644
--- a/server/request.h
+++ b/server/request.h
@@ -2276,8 +2276,7 @@ C_ASSERT( FIELD_OFFSET(struct set_cursor_reply, prev_y) == 20 );
 C_ASSERT( FIELD_OFFSET(struct set_cursor_reply, new_x) == 24 );
 C_ASSERT( FIELD_OFFSET(struct set_cursor_reply, new_y) == 28 );
 C_ASSERT( FIELD_OFFSET(struct set_cursor_reply, new_clip) == 32 );
-C_ASSERT( FIELD_OFFSET(struct set_cursor_reply, last_change) == 48 );
-C_ASSERT( sizeof(struct set_cursor_reply) == 56 );
+C_ASSERT( sizeof(struct set_cursor_reply) == 48 );
 C_ASSERT( sizeof(struct update_rawinput_devices_request) == 16 );
 C_ASSERT( sizeof(struct get_suspend_context_request) == 16 );
 C_ASSERT( sizeof(struct get_suspend_context_reply) == 8 );
diff --git a/server/trace.c b/server/trace.c
index 4d8a2eb..8563d3c 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -4287,7 +4287,6 @@ static void dump_set_cursor_reply( const struct set_cursor_reply *req )
     fprintf( stderr, ", new_x=%d", req->new_x );
     fprintf( stderr, ", new_y=%d", req->new_y );
     dump_rectangle( ", new_clip=", &req->new_clip );
-    fprintf( stderr, ", last_change=%08x", req->last_change );
 }
 
 static void dump_update_rawinput_devices_request( const struct update_rawinput_devices_request *req )
diff --git a/server/user.h b/server/user.h
index 89646f1..82cf6d9 100644
--- a/server/user.h
+++ b/server/user.h
@@ -58,7 +58,6 @@ struct global_cursor
     int                  y;
     rectangle_t          clip;             /* cursor clip rectangle */
     unsigned int         clip_msg;         /* message to post for cursor clip changes */
-    unsigned int         last_change;      /* time of last position change */
     user_handle_t        win;              /* window that contains the cursor */
 };
 
-- 
2.9.2




More information about the wine-patches mailing list