From: Max Qian Subject: [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 Message-Id: <20160908081557.9725-2-public@maxqia.com> Date: Thu, 8 Sep 2016 01:15:56 -0700 In-Reply-To: <20160908081557.9725-1-public@maxqia.com> References: <20160908081557.9725-1-public@maxqia.com> Signed-off-by: Max Qian --- 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