From 39c4e6d1d9572e2015282578c124615128afa45f Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 28 Feb 2011 22:50:21 +0100 Subject: [PATCH] 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 59cc047a98f..455e55a98f4 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 d99378a1198..901cd7153f7 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 a675bf7eeb2..2950246843b 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 8a75f37eda6..61667554ce9 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