user32: Return the cursor position in send_hardware_message and use it to update the driver's position.

oldstable
Alexandre Julliard 2012-01-07 20:29:29 +01:00
parent 9c112996d0
commit 02442b52a4
7 changed files with 37 additions and 17 deletions

View File

@ -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 );

View File

@ -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)
{

View File

@ -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 */

View File

@ -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

View File

@ -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 );
}

View File

@ -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 );

View File

@ -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 );
}