Alexandre Julliard : user32: Retrieve the current cursor position from the server.

Alexandre Julliard julliard at winehq.org
Tue Mar 1 11:07:14 CST 2011


Module: wine
Branch: master
Commit: 39c4e6d1d9572e2015282578c124615128afa45f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=39c4e6d1d9572e2015282578c124615128afa45f

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Feb 28 22:50:21 2011 +0100

user32: Retrieve the current cursor position from the server.

---

 dlls/user32/input.c         |   25 +++++++++++++++++++++++--
 dlls/winex11.drv/keyboard.c |    2 --
 dlls/winex11.drv/mouse.c    |   11 ++++++-----
 dlls/winex11.drv/x11drv.h   |    2 --
 4 files changed, 29 insertions(+), 11 deletions(-)

diff --git a/dlls/user32/input.c b/dlls/user32/input.c
index 59cc047..455e55a 100644
--- a/dlls/user32/input.c
+++ b/dlls/user32/input.c
@@ -197,8 +197,29 @@ void WINAPI mouse_event( DWORD dwFlags, DWORD dx, DWORD dy,
  */
 BOOL WINAPI DECLSPEC_HOTPATCH GetCursorPos( POINT *pt )
 {
+    BOOL ret;
+
     if (!pt) return FALSE;
-    return USER_Driver->pGetCursorPos( pt );
+
+    ret = USER_Driver->pGetCursorPos( pt );
+
+    SERVER_START_REQ( set_cursor )
+    {
+        if (ret)  /* update it */
+        {
+            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;
+
 }
 
 
@@ -245,7 +266,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH SetCursorPos( INT x, INT y )
         }
     }
     SERVER_END_REQ;
-    if (ret) ret = USER_Driver->pSetCursorPos( x, y );
+    if (ret) USER_Driver->pSetCursorPos( x, y );
     return ret;
 }
 
diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c
index d99378a..901cd71 100644
--- a/dlls/winex11.drv/keyboard.c
+++ b/dlls/winex11.drv/keyboard.c
@@ -1272,8 +1272,6 @@ void X11DRV_send_keyboard_input( WORD wVk, WORD wScan, DWORD event_flags, DWORD
         req->msg      = message;
         req->wparam   = wVk;
         req->lparam   = lParam;
-        req->x        = cursor_pos.x;
-        req->y        = cursor_pos.y;
         req->time     = time;
         req->info     = dwExtraInfo;
         wine_server_call( req );
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
index a675bf7..2950246 100644
--- a/dlls/winex11.drv/mouse.c
+++ b/dlls/winex11.drv/mouse.c
@@ -92,7 +92,7 @@ static const UINT button_up_flags[NB_BUTTONS] =
     MOUSEEVENTF_XUP
 };
 
-POINT cursor_pos;
+static POINT cursor_pos;
 static HWND cursor_window;
 static DWORD last_time_modified;
 static RECT cursor_clip; /* Cursor clipping rect */
@@ -1042,6 +1042,7 @@ BOOL CDECL X11DRV_GetCursorPos(LPPOINT pos)
     Window root, child;
     int rootX, rootY, winX, winY;
     unsigned int xstate;
+    BOOL ret = FALSE;
 
     wine_tsx11_lock();
     if ((GetTickCount() - last_time_modified > 100) &&
@@ -1051,12 +1052,12 @@ BOOL CDECL X11DRV_GetCursorPos(LPPOINT pos)
         winX += virtual_screen_rect.left;
         winY += virtual_screen_rect.top;
         TRACE("pointer at (%d,%d)\n", winX, winY );
-        cursor_pos.x = winX;
-        cursor_pos.y = winY;
+        pos->x = winX;
+        pos->y = winY;
+        ret = TRUE;
     }
-    *pos = cursor_pos;
     wine_tsx11_unlock();
-    return TRUE;
+    return ret;
 }
 
 
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 8a75f37..6166755 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -609,8 +609,6 @@ extern int alloc_system_colors;
 extern int xrender_error_base;
 extern HMODULE x11drv_module;
 
-extern POINT cursor_pos;
-
 /* atoms */
 
 enum x11drv_atoms




More information about the wine-cvs mailing list