server: Split the queuing of hardware messages into a separate send_hardware_message request.

This commit is contained in:
Alexandre Julliard 2006-08-09 16:45:26 +02:00
parent 64c5142ae9
commit d3b3096756
8 changed files with 105 additions and 40 deletions

View File

@ -1390,7 +1390,6 @@ static BOOL post_dde_message( struct packed_message *data, const struct send_mes
req->msg = info->msg;
req->wparam = info->wparam;
req->lparam = lp;
req->time = GetCurrentTime();
req->timeout = 0;
for (i = 0; i < data->count; i++)
wine_server_add_data( req, data->data[i], data->size[i] );
@ -2196,7 +2195,6 @@ static BOOL put_message_in_queue( const struct send_message_info *info, size_t *
req->msg = info->msg;
req->wparam = info->wparam;
req->lparam = info->lparam;
req->time = GetCurrentTime();
req->timeout = timeout;
if (info->type == MSG_CALLBACK)

View File

@ -1183,11 +1183,9 @@ void X11DRV_send_keyboard_input( WORD wVk, WORD wScan, DWORD dwFlags, DWORD time
hook.dwExtraInfo = dwExtraInfo;
if (HOOK_CallHooks( WH_KEYBOARD_LL, HC_ACTION, message, (LPARAM)&hook, TRUE )) return;
SERVER_START_REQ( send_message )
SERVER_START_REQ( send_hardware_message )
{
req->id = (injected_flags & LLKHF_INJECTED) ? 0 : GetCurrentThreadId();
req->type = MSG_HARDWARE;
req->flags = 0;
req->win = 0;
req->msg = message;
req->wparam = wVk;
@ -1196,8 +1194,6 @@ void X11DRV_send_keyboard_input( WORD wVk, WORD wScan, DWORD dwFlags, DWORD time
req->y = cursor_pos.y;
req->time = time;
req->info = dwExtraInfo;
req->timeout = -1;
req->callback = NULL;
wine_server_call( req );
}
SERVER_END_REQ;

View File

@ -199,11 +199,9 @@ static void queue_raw_mouse_message( UINT message, HWND hwnd, DWORD x, DWORD y,
if (HOOK_CallHooks( WH_MOUSE_LL, HC_ACTION, message, (LPARAM)&hook, TRUE )) return;
SERVER_START_REQ( send_message )
SERVER_START_REQ( send_hardware_message )
{
req->id = (injected_flags & LLMHF_INJECTED) ? 0 : GetCurrentThreadId();
req->type = MSG_HARDWARE;
req->flags = 0;
req->win = hwnd;
req->msg = message;
req->wparam = MAKEWPARAM( get_key_state(), data );
@ -212,8 +210,6 @@ static void queue_raw_mouse_message( UINT message, HWND hwnd, DWORD x, DWORD y,
req->y = y;
req->time = time;
req->info = extra_info;
req->timeout = -1;
req->callback = NULL;
wine_server_call( req );
}
SERVER_END_REQ;

View File

@ -2199,9 +2199,6 @@ struct send_message_request
unsigned int msg;
unsigned long wparam;
unsigned long lparam;
int x;
int y;
unsigned int time;
unsigned int info;
int timeout;
void* callback;
@ -2238,6 +2235,26 @@ enum message_type
struct send_hardware_message_request
{
struct request_header __header;
thread_id_t id;
user_handle_t win;
unsigned int msg;
unsigned long wparam;
unsigned long lparam;
int x;
int y;
unsigned int time;
unsigned int info;
};
struct send_hardware_message_reply
{
struct reply_header __header;
};
struct get_message_request
{
struct request_header __header;
@ -3855,6 +3872,7 @@ enum request
REQ_get_process_idle_event,
REQ_send_message,
REQ_post_quit_message,
REQ_send_hardware_message,
REQ_get_message,
REQ_reply_message,
REQ_accept_hardware_message,
@ -4075,6 +4093,7 @@ union generic_request
struct get_process_idle_event_request get_process_idle_event_request;
struct send_message_request send_message_request;
struct post_quit_message_request post_quit_message_request;
struct send_hardware_message_request send_hardware_message_request;
struct get_message_request get_message_request;
struct reply_message_request reply_message_request;
struct accept_hardware_message_request accept_hardware_message_request;
@ -4293,6 +4312,7 @@ union generic_reply
struct get_process_idle_event_reply get_process_idle_event_reply;
struct send_message_reply send_message_reply;
struct post_quit_message_reply post_quit_message_reply;
struct send_hardware_message_reply send_hardware_message_reply;
struct get_message_reply get_message_reply;
struct reply_message_reply reply_message_reply;
struct accept_hardware_message_reply accept_hardware_message_reply;
@ -4385,6 +4405,6 @@ union generic_reply
struct query_symlink_reply query_symlink_reply;
};
#define SERVER_PROTOCOL_VERSION 244
#define SERVER_PROTOCOL_VERSION 245
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -1571,9 +1571,6 @@ enum char_info_mode
unsigned int msg; /* message code */
unsigned long wparam; /* parameters */
unsigned long lparam; /* parameters */
int x; /* x position */
int y; /* y position */
unsigned int time; /* message time */
unsigned int info; /* extra info */
int timeout; /* timeout for reply */
void* callback; /* callback address */
@ -1599,6 +1596,20 @@ enum message_type
#define SEND_MSG_ABORT_IF_HUNG 0x01
/* 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 long wparam; /* parameters */
unsigned long lparam; /* parameters */
int x; /* x position */
int y; /* y position */
unsigned int time; /* message time */
unsigned int info; /* extra info */
@END
/* Get a message from the current queue */
@REQ(get_message)
int flags; /* see below */

View File

@ -1569,24 +1569,15 @@ DECL_HANDLER(send_message)
struct msg_queue *recv_queue = NULL;
struct thread *thread = NULL;
if (req->id)
{
if (!(thread = get_thread_from_id( req->id ))) return;
}
else if (req->type != MSG_HARDWARE)
{
/* only hardware messages are allowed without destination thread */
set_error( STATUS_INVALID_PARAMETER );
return;
}
if (!(thread = get_thread_from_id( req->id ))) return;
if (thread && !(recv_queue = thread->queue))
if (!(recv_queue = thread->queue))
{
set_error( STATUS_INVALID_PARAMETER );
release_object( thread );
return;
}
if (recv_queue && (req->flags & SEND_MSG_ABORT_IF_HUNG) && is_queue_hung(recv_queue))
if ((req->flags & SEND_MSG_ABORT_IF_HUNG) && is_queue_hung(recv_queue))
{
set_error( STATUS_TIMEOUT );
release_object( thread );
@ -1600,9 +1591,9 @@ DECL_HANDLER(send_message)
msg->msg = req->msg;
msg->wparam = req->wparam;
msg->lparam = req->lparam;
msg->time = req->time;
msg->x = req->x;
msg->y = req->y;
msg->time = get_tick_count();
msg->x = 0;
msg->y = 0;
msg->info = req->info;
msg->hook = 0;
msg->hook_proc = NULL;
@ -1645,9 +1636,7 @@ DECL_HANDLER(send_message)
list_add_tail( &recv_queue->msg_list[POST_MESSAGE], &msg->entry );
set_queue_bits( recv_queue, QS_POSTMESSAGE|QS_ALLPOSTMESSAGE );
break;
case MSG_HARDWARE:
queue_hardware_message( recv_queue, msg );
break;
case MSG_HARDWARE: /* should use send_hardware_message instead */
case MSG_CALLBACK_RESULT: /* cannot send this one */
default:
set_error( STATUS_INVALID_PARAMETER );
@ -1655,6 +1644,46 @@ DECL_HANDLER(send_message)
break;
}
}
release_object( thread );
}
/* send a hardware message to a thread queue */
DECL_HANDLER(send_hardware_message)
{
struct message *msg;
struct msg_queue *recv_queue = NULL;
struct thread *thread = NULL;
if (req->id)
{
if (!(thread = get_thread_from_id( req->id ))) return;
}
if (thread && !(recv_queue = thread->queue))
{
set_error( STATUS_INVALID_PARAMETER );
release_object( thread );
return;
}
if ((msg = mem_alloc( sizeof(*msg) )))
{
msg->type = MSG_HARDWARE;
msg->win = get_user_full_handle( req->win );
msg->msg = req->msg;
msg->wparam = req->wparam;
msg->lparam = req->lparam;
msg->time = req->time;
msg->x = req->x;
msg->y = req->y;
msg->info = req->info;
msg->hook = 0;
msg->hook_proc = NULL;
msg->result = NULL;
msg->data = NULL;
msg->data_size = 0;
queue_hardware_message( recv_queue, msg );
}
if (thread) release_object( thread );
}

View File

@ -233,6 +233,7 @@ DECL_HANDLER(get_queue_status);
DECL_HANDLER(get_process_idle_event);
DECL_HANDLER(send_message);
DECL_HANDLER(post_quit_message);
DECL_HANDLER(send_hardware_message);
DECL_HANDLER(get_message);
DECL_HANDLER(reply_message);
DECL_HANDLER(accept_hardware_message);
@ -452,6 +453,7 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
(req_handler)req_get_process_idle_event,
(req_handler)req_send_message,
(req_handler)req_post_quit_message,
(req_handler)req_send_hardware_message,
(req_handler)req_get_message,
(req_handler)req_reply_message,
(req_handler)req_accept_hardware_message,

View File

@ -2091,9 +2091,6 @@ static void dump_send_message_request( const struct send_message_request *req )
fprintf( stderr, " msg=%08x,", req->msg );
fprintf( stderr, " wparam=%lx,", req->wparam );
fprintf( stderr, " lparam=%lx,", req->lparam );
fprintf( stderr, " x=%d,", req->x );
fprintf( stderr, " y=%d,", req->y );
fprintf( stderr, " time=%08x,", req->time );
fprintf( stderr, " info=%08x,", req->info );
fprintf( stderr, " timeout=%d,", req->timeout );
fprintf( stderr, " callback=%p,", req->callback );
@ -2106,6 +2103,19 @@ static void dump_post_quit_message_request( const struct post_quit_message_reque
fprintf( stderr, " exit_code=%d", req->exit_code );
}
static void dump_send_hardware_message_request( const struct send_hardware_message_request *req )
{
fprintf( stderr, " id=%04x,", req->id );
fprintf( stderr, " win=%p,", req->win );
fprintf( stderr, " msg=%08x,", req->msg );
fprintf( stderr, " wparam=%lx,", req->wparam );
fprintf( stderr, " lparam=%lx,", req->lparam );
fprintf( stderr, " x=%d,", req->x );
fprintf( stderr, " y=%d,", req->y );
fprintf( stderr, " time=%08x,", req->time );
fprintf( stderr, " info=%08x", req->info );
}
static void dump_get_message_request( const struct get_message_request *req )
{
fprintf( stderr, " flags=%d,", req->flags );
@ -3396,6 +3406,7 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_get_process_idle_event_request,
(dump_func)dump_send_message_request,
(dump_func)dump_post_quit_message_request,
(dump_func)dump_send_hardware_message_request,
(dump_func)dump_get_message_request,
(dump_func)dump_reply_message_request,
(dump_func)dump_accept_hardware_message_request,
@ -3612,6 +3623,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_get_process_idle_event_reply,
(dump_func)0,
(dump_func)0,
(dump_func)0,
(dump_func)dump_get_message_reply,
(dump_func)0,
(dump_func)0,
@ -3828,6 +3840,7 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
"get_process_idle_event",
"send_message",
"post_quit_message",
"send_hardware_message",
"get_message",
"reply_message",
"accept_hardware_message",