diff --git a/dlls/user32/input.c b/dlls/user32/input.c index d9fb7c065c5..905bda1742d 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -180,19 +180,7 @@ UINT WINAPI SendInput( UINT count, LPINPUT inputs, int size ) /* we need to update the coordinates to what the server expects */ INPUT input = inputs[i]; update_mouse_coords( &input ); - if (!(status = send_hardware_message( 0, &input, SEND_HWMSG_INJECTED ))) - { - if ((input.u.mi.dwFlags & MOUSEEVENTF_MOVE) && - ((input.u.mi.dwFlags & MOUSEEVENTF_ABSOLUTE) || input.u.mi.dx || input.u.mi.dy)) - { - /* we have to actually move the cursor */ - POINT pt; - GetCursorPos( &pt ); - if (!(input.u.mi.dwFlags & MOUSEEVENTF_ABSOLUTE) || - pt.x != input.u.mi.dx || pt.y != input.u.mi.dy) - USER_Driver->pSetCursorPos( pt.x, pt.y ); - } - } + status = send_hardware_message( 0, &input, SEND_HWMSG_INJECTED ); } else status = send_hardware_message( 0, &inputs[i], SEND_HWMSG_INJECTED ); diff --git a/dlls/user32/message.c b/dlls/user32/message.c index a38d77b9fce..4972bb832c2 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -3114,6 +3114,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, UINT flags ) { struct user_thread_info *thread_info = get_user_thread_info(); struct send_message_info info; + int prev_x, prev_y, new_x, new_y; NTSTATUS ret; BOOL wait; @@ -3153,10 +3154,19 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, UINT flags ) if (thread_info->key_state) wine_server_set_reply( req, thread_info->key_state, 256 ); ret = wine_server_call( req ); wait = reply->wait; + prev_x = reply->prev_x; + prev_y = reply->prev_y; + new_x = reply->new_x; + new_y = reply->new_y; } SERVER_END_REQ; - if (!ret && thread_info->key_state) thread_info->key_state_time = GetTickCount(); + if (!ret) + { + if (thread_info->key_state) thread_info->key_state_time = GetTickCount(); + if ((flags & SEND_HWMSG_INJECTED) && (prev_x != new_x || prev_y != new_y)) + USER_Driver->pSetCursorPos( new_x, new_y ); + } if (wait) { diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 5880b47f765..fc5129167b5 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -2796,8 +2796,12 @@ struct send_hardware_message_reply { struct reply_header __header; int wait; + int prev_x; + int prev_y; + int new_x; + int new_y; /* VARARG(keystate,bytes); */ - char __pad_12[4]; + char __pad_28[4]; }; #define SEND_HWMSG_INJECTED 0x01 @@ -5640,6 +5644,6 @@ union generic_reply struct set_suspend_context_reply set_suspend_context_reply; }; -#define SERVER_PROTOCOL_VERSION 429 +#define SERVER_PROTOCOL_VERSION 430 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */ diff --git a/server/protocol.def b/server/protocol.def index 91a59b2875a..73f2d8e98bc 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -2032,6 +2032,10 @@ enum message_type unsigned int flags; /* flags (see below) */ @REPLY int wait; /* do we need to wait for a reply? */ + int prev_x; /* previous cursor position */ + int prev_y; + int new_x; /* new cursor position */ + int new_y; VARARG(keystate,bytes); /* global state array for all the keys */ @END #define SEND_HWMSG_INJECTED 0x01 diff --git a/server/queue.c b/server/queue.c index 20d3e41c562..2cd82b49c15 100644 --- a/server/queue.c +++ b/server/queue.c @@ -2204,6 +2204,9 @@ DECL_HANDLER(send_hardware_message) } } + reply->prev_x = desktop->cursor.x; + reply->prev_y = desktop->cursor.y; + switch (req->input.type) { case INPUT_MOUSE: @@ -2219,6 +2222,9 @@ DECL_HANDLER(send_hardware_message) set_error( STATUS_INVALID_PARAMETER ); } if (thread) release_object( thread ); + + reply->new_x = desktop->cursor.x; + reply->new_y = desktop->cursor.y; set_reply_data( desktop->keystate, size ); release_object( desktop ); } diff --git a/server/request.h b/server/request.h index ac694618447..c1cca4c2318 100644 --- a/server/request.h +++ b/server/request.h @@ -1391,7 +1391,11 @@ C_ASSERT( FIELD_OFFSET(struct send_hardware_message_request, input) == 16 ); C_ASSERT( FIELD_OFFSET(struct send_hardware_message_request, flags) == 48 ); C_ASSERT( sizeof(struct send_hardware_message_request) == 56 ); C_ASSERT( FIELD_OFFSET(struct send_hardware_message_reply, wait) == 8 ); -C_ASSERT( sizeof(struct send_hardware_message_reply) == 16 ); +C_ASSERT( FIELD_OFFSET(struct send_hardware_message_reply, prev_x) == 12 ); +C_ASSERT( FIELD_OFFSET(struct send_hardware_message_reply, prev_y) == 16 ); +C_ASSERT( FIELD_OFFSET(struct send_hardware_message_reply, new_x) == 20 ); +C_ASSERT( FIELD_OFFSET(struct send_hardware_message_reply, new_y) == 24 ); +C_ASSERT( sizeof(struct send_hardware_message_reply) == 32 ); C_ASSERT( FIELD_OFFSET(struct get_message_request, flags) == 12 ); C_ASSERT( FIELD_OFFSET(struct get_message_request, get_win) == 16 ); C_ASSERT( FIELD_OFFSET(struct get_message_request, get_first) == 20 ); diff --git a/server/trace.c b/server/trace.c index 4a5023240cf..b8dc316b479 100644 --- a/server/trace.c +++ b/server/trace.c @@ -2452,6 +2452,10 @@ static void dump_send_hardware_message_request( const struct send_hardware_messa static void dump_send_hardware_message_reply( const struct send_hardware_message_reply *req ) { fprintf( stderr, " wait=%d", req->wait ); + fprintf( stderr, ", prev_x=%d", req->prev_x ); + fprintf( stderr, ", prev_y=%d", req->prev_y ); + fprintf( stderr, ", new_x=%d", req->new_x ); + fprintf( stderr, ", new_y=%d", req->new_y ); dump_varargs_bytes( ", keystate=", cur_size ); }