server: Don't pass a thread id to send_hardware_message, determine it from the window.
This commit is contained in:
parent
8f88d4fe78
commit
bc4afb0786
|
@ -1267,7 +1267,6 @@ void X11DRV_send_keyboard_input( HWND hwnd, WORD wVk, WORD wScan, DWORD event_fl
|
|||
|
||||
SERVER_START_REQ( send_hardware_message )
|
||||
{
|
||||
req->id = (injected_flags & LLKHF_INJECTED) ? 0 : GetCurrentThreadId();
|
||||
req->win = wine_server_user_handle( hwnd );
|
||||
req->msg = message;
|
||||
req->wparam = wVk;
|
||||
|
|
|
@ -306,7 +306,6 @@ static void queue_raw_mouse_message( UINT message, HWND hwnd, DWORD x, DWORD y,
|
|||
|
||||
SERVER_START_REQ( send_hardware_message )
|
||||
{
|
||||
req->id = (injected_flags & LLMHF_INJECTED) ? 0 : GetCurrentThreadId();
|
||||
req->win = wine_server_user_handle( hwnd );
|
||||
req->msg = message;
|
||||
req->wparam = MAKEWPARAM( 0, data );
|
||||
|
|
|
@ -2761,22 +2761,18 @@ enum message_type
|
|||
struct send_hardware_message_request
|
||||
{
|
||||
struct request_header __header;
|
||||
thread_id_t id;
|
||||
user_handle_t win;
|
||||
unsigned int msg;
|
||||
unsigned int time;
|
||||
lparam_t wparam;
|
||||
lparam_t lparam;
|
||||
lparam_t info;
|
||||
int x;
|
||||
int y;
|
||||
unsigned int time;
|
||||
char __pad_60[4];
|
||||
};
|
||||
struct send_hardware_message_reply
|
||||
{
|
||||
struct reply_header __header;
|
||||
user_handle_t cursor;
|
||||
int count;
|
||||
};
|
||||
|
||||
|
||||
|
@ -5533,6 +5529,6 @@ union generic_reply
|
|||
struct set_cursor_reply set_cursor_reply;
|
||||
};
|
||||
|
||||
#define SERVER_PROTOCOL_VERSION 414
|
||||
#define SERVER_PROTOCOL_VERSION 415
|
||||
|
||||
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
|
||||
|
|
|
@ -2001,18 +2001,14 @@ enum message_type
|
|||
|
||||
/* Send a hardware message to a thread queue */
|
||||
@REQ(send_hardware_message)
|
||||
thread_id_t id; /* thread id */
|
||||
user_handle_t win; /* window handle */
|
||||
unsigned int msg; /* message code */
|
||||
unsigned int time; /* message time */
|
||||
lparam_t wparam; /* parameters */
|
||||
lparam_t lparam; /* parameters */
|
||||
lparam_t info; /* extra info */
|
||||
int x; /* x position */
|
||||
int y; /* y position */
|
||||
unsigned int time; /* message time */
|
||||
@REPLY
|
||||
user_handle_t cursor; /* current cursor for the target thread input */
|
||||
int count; /* current cursor count */
|
||||
@END
|
||||
|
||||
|
||||
|
|
|
@ -1237,8 +1237,8 @@ static void release_hardware_message( struct msg_queue *queue, unsigned int hw_i
|
|||
}
|
||||
|
||||
/* find the window that should receive a given hardware message */
|
||||
static user_handle_t find_hardware_message_window( struct thread_input *input, struct message *msg,
|
||||
unsigned int *msg_code )
|
||||
static user_handle_t find_hardware_message_window( struct desktop *desktop, struct thread_input *input,
|
||||
struct message *msg, unsigned int *msg_code )
|
||||
{
|
||||
struct hardware_msg_data *data = msg->data;
|
||||
user_handle_t win = 0;
|
||||
|
@ -1257,9 +1257,7 @@ static user_handle_t find_hardware_message_window( struct thread_input *input, s
|
|||
if (!input || !(win = input->capture))
|
||||
{
|
||||
if (!(win = msg->win) || !is_window_visible( win ) || is_window_transparent( win ))
|
||||
{
|
||||
if (input) win = window_from_point( input->desktop, data->x, data->y );
|
||||
}
|
||||
win = window_from_point( desktop, data->x, data->y );
|
||||
}
|
||||
}
|
||||
return win;
|
||||
|
@ -1273,11 +1271,11 @@ static void set_cursor_pos( struct desktop *desktop, int x, int y )
|
|||
}
|
||||
|
||||
/* queue a hardware message into a given thread input */
|
||||
static void queue_hardware_message( struct desktop *desktop, struct thread_input *input,
|
||||
struct message *msg )
|
||||
static void queue_hardware_message( struct desktop *desktop, struct message *msg )
|
||||
{
|
||||
user_handle_t win;
|
||||
struct thread *thread;
|
||||
struct thread_input *input;
|
||||
unsigned int msg_code;
|
||||
struct hardware_msg_data *data = msg->data;
|
||||
|
||||
|
@ -1298,7 +1296,14 @@ static void queue_hardware_message( struct desktop *desktop, struct thread_input
|
|||
data->x = desktop->cursor_x;
|
||||
data->y = desktop->cursor_y;
|
||||
|
||||
win = find_hardware_message_window( input, msg, &msg_code );
|
||||
if (msg->win && (thread = get_window_thread( msg->win )))
|
||||
{
|
||||
input = thread->queue->input;
|
||||
release_object( thread );
|
||||
}
|
||||
else input = desktop->foreground_input;
|
||||
|
||||
win = find_hardware_message_window( desktop, input, msg, &msg_code );
|
||||
if (!win || !(thread = get_window_thread(win)))
|
||||
{
|
||||
if (input) update_input_key_state( input->desktop, input->keystate, msg );
|
||||
|
@ -1387,7 +1392,7 @@ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user
|
|||
struct hardware_msg_data *data = msg->data;
|
||||
|
||||
ptr = list_next( &input->msg_list, ptr );
|
||||
win = find_hardware_message_window( input, msg, &msg_code );
|
||||
win = find_hardware_message_window( input->desktop, input, msg, &msg_code );
|
||||
if (!win || !(win_thread = get_window_thread( win )))
|
||||
{
|
||||
/* no window at all, remove it */
|
||||
|
@ -1732,31 +1737,17 @@ DECL_HANDLER(send_hardware_message)
|
|||
{
|
||||
struct message *msg;
|
||||
struct thread *thread = NULL;
|
||||
struct desktop *desktop = NULL;
|
||||
struct desktop *desktop;
|
||||
struct hardware_msg_data *data;
|
||||
struct thread_input *input;
|
||||
|
||||
if (req->id)
|
||||
if (req->win)
|
||||
{
|
||||
if (!(thread = get_thread_from_id( req->id ))) return;
|
||||
if (!thread->queue)
|
||||
{
|
||||
set_error( STATUS_INVALID_PARAMETER );
|
||||
release_object( thread );
|
||||
return;
|
||||
}
|
||||
input = thread->queue->input;
|
||||
desktop = (struct desktop *)grab_object( input->desktop );
|
||||
reply->cursor = input->cursor;
|
||||
reply->count = input->cursor_count;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(desktop = get_thread_desktop( current, 0 ))) return;
|
||||
input = desktop->foreground_input;
|
||||
if (!(thread = get_window_thread( req->win ))) return;
|
||||
desktop = (struct desktop *)grab_object( thread->queue->input->desktop );
|
||||
}
|
||||
else if (!(desktop = get_thread_desktop( current, 0 ))) return;
|
||||
|
||||
if (!req->msg || !(data = mem_alloc( sizeof(*data) ))) goto done;
|
||||
if (!(data = mem_alloc( sizeof(*data) ))) goto done;
|
||||
|
||||
memset( data, 0, sizeof(*data) );
|
||||
data->x = req->x;
|
||||
|
@ -1774,7 +1765,7 @@ DECL_HANDLER(send_hardware_message)
|
|||
msg->result = NULL;
|
||||
msg->data = data;
|
||||
msg->data_size = sizeof(*data);
|
||||
queue_hardware_message( desktop, input, msg );
|
||||
queue_hardware_message( desktop, msg );
|
||||
}
|
||||
else free( data );
|
||||
|
||||
|
|
|
@ -1377,19 +1377,15 @@ C_ASSERT( FIELD_OFFSET(struct send_message_request, timeout) == 48 );
|
|||
C_ASSERT( sizeof(struct send_message_request) == 56 );
|
||||
C_ASSERT( FIELD_OFFSET(struct post_quit_message_request, exit_code) == 12 );
|
||||
C_ASSERT( sizeof(struct post_quit_message_request) == 16 );
|
||||
C_ASSERT( FIELD_OFFSET(struct send_hardware_message_request, id) == 12 );
|
||||
C_ASSERT( FIELD_OFFSET(struct send_hardware_message_request, win) == 16 );
|
||||
C_ASSERT( FIELD_OFFSET(struct send_hardware_message_request, msg) == 20 );
|
||||
C_ASSERT( FIELD_OFFSET(struct send_hardware_message_request, win) == 12 );
|
||||
C_ASSERT( FIELD_OFFSET(struct send_hardware_message_request, msg) == 16 );
|
||||
C_ASSERT( FIELD_OFFSET(struct send_hardware_message_request, time) == 20 );
|
||||
C_ASSERT( FIELD_OFFSET(struct send_hardware_message_request, wparam) == 24 );
|
||||
C_ASSERT( FIELD_OFFSET(struct send_hardware_message_request, lparam) == 32 );
|
||||
C_ASSERT( FIELD_OFFSET(struct send_hardware_message_request, info) == 40 );
|
||||
C_ASSERT( FIELD_OFFSET(struct send_hardware_message_request, x) == 48 );
|
||||
C_ASSERT( FIELD_OFFSET(struct send_hardware_message_request, y) == 52 );
|
||||
C_ASSERT( FIELD_OFFSET(struct send_hardware_message_request, time) == 56 );
|
||||
C_ASSERT( sizeof(struct send_hardware_message_request) == 64 );
|
||||
C_ASSERT( FIELD_OFFSET(struct send_hardware_message_reply, cursor) == 8 );
|
||||
C_ASSERT( FIELD_OFFSET(struct send_hardware_message_reply, count) == 12 );
|
||||
C_ASSERT( sizeof(struct send_hardware_message_reply) == 16 );
|
||||
C_ASSERT( sizeof(struct send_hardware_message_request) == 56 );
|
||||
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 );
|
||||
|
|
|
@ -2464,21 +2464,14 @@ static void dump_post_quit_message_request( const struct post_quit_message_reque
|
|||
|
||||
static void dump_send_hardware_message_request( const struct send_hardware_message_request *req )
|
||||
{
|
||||
fprintf( stderr, " id=%04x", req->id );
|
||||
fprintf( stderr, ", win=%08x", req->win );
|
||||
fprintf( stderr, " win=%08x", req->win );
|
||||
fprintf( stderr, ", msg=%08x", req->msg );
|
||||
fprintf( stderr, ", time=%08x", req->time );
|
||||
dump_uint64( ", wparam=", &req->wparam );
|
||||
dump_uint64( ", lparam=", &req->lparam );
|
||||
dump_uint64( ", info=", &req->info );
|
||||
fprintf( stderr, ", x=%d", req->x );
|
||||
fprintf( stderr, ", y=%d", req->y );
|
||||
fprintf( stderr, ", time=%08x", req->time );
|
||||
}
|
||||
|
||||
static void dump_send_hardware_message_reply( const struct send_hardware_message_reply *req )
|
||||
{
|
||||
fprintf( stderr, " cursor=%08x", req->cursor );
|
||||
fprintf( stderr, ", count=%d", req->count );
|
||||
}
|
||||
|
||||
static void dump_get_message_request( const struct get_message_request *req )
|
||||
|
@ -4257,7 +4250,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
|
|||
(dump_func)dump_get_process_idle_event_reply,
|
||||
NULL,
|
||||
NULL,
|
||||
(dump_func)dump_send_hardware_message_reply,
|
||||
NULL,
|
||||
(dump_func)dump_get_message_reply,
|
||||
NULL,
|
||||
NULL,
|
||||
|
|
Loading…
Reference in New Issue