user32: Don't move mouse hardware messages to other threads queues.

This commit is contained in:
Piotr Caban 2014-10-14 13:29:06 +02:00 committed by Alexandre Julliard
parent 3f1bbdcae3
commit f747e5c8c9
3 changed files with 11 additions and 38 deletions

View File

@ -2266,13 +2266,12 @@ static void send_parent_notify( HWND hwnd, WORD event, WORD idChild, POINT pt )
* Tell the server we have passed the message to the app * Tell the server we have passed the message to the app
* (even though we may end up dropping it later on) * (even though we may end up dropping it later on)
*/ */
static void accept_hardware_message( UINT hw_id, BOOL remove, HWND new_hwnd ) static void accept_hardware_message( UINT hw_id, BOOL remove )
{ {
SERVER_START_REQ( accept_hardware_message ) SERVER_START_REQ( accept_hardware_message )
{ {
req->hw_id = hw_id; req->hw_id = hw_id;
req->remove = remove; req->remove = remove;
req->new_win = wine_server_user_handle( new_hwnd );
if (wine_server_call( req )) if (wine_server_call( req ))
FIXME("Failed to reply to MSG_HARDWARE message. Message may not be removed from queue.\n"); FIXME("Failed to reply to MSG_HARDWARE message. Message may not be removed from queue.\n");
} }
@ -2460,10 +2459,10 @@ static BOOL process_keyboard_message( MSG *msg, UINT hw_id, HWND hwnd_filter,
{ {
/* skip this message */ /* skip this message */
HOOK_CallHooks( WH_CBT, HCBT_KEYSKIPPED, LOWORD(msg->wParam), msg->lParam, TRUE ); HOOK_CallHooks( WH_CBT, HCBT_KEYSKIPPED, LOWORD(msg->wParam), msg->lParam, TRUE );
accept_hardware_message( hw_id, TRUE, 0 ); accept_hardware_message( hw_id, TRUE );
return FALSE; return FALSE;
} }
accept_hardware_message( hw_id, remove, 0 ); accept_hardware_message( hw_id, remove );
if ( remove && msg->message == WM_KEYDOWN ) if ( remove && msg->message == WM_KEYDOWN )
if (ImmProcessKey(msg->hwnd, GetKeyboardLayout(0), msg->wParam, msg->lParam, 0) ) if (ImmProcessKey(msg->hwnd, GetKeyboardLayout(0), msg->wParam, msg->lParam, 0) )
@ -2507,7 +2506,7 @@ static BOOL process_mouse_message( MSG *msg, UINT hw_id, ULONG_PTR extra_info, H
if (!msg->hwnd || !WIN_IsCurrentThread( msg->hwnd )) if (!msg->hwnd || !WIN_IsCurrentThread( msg->hwnd ))
{ {
accept_hardware_message( hw_id, TRUE, msg->hwnd ); accept_hardware_message( hw_id, TRUE );
return FALSE; return FALSE;
} }
@ -2596,7 +2595,7 @@ static BOOL process_mouse_message( MSG *msg, UINT hw_id, ULONG_PTR extra_info, H
hook.wHitTestCode = hittest; hook.wHitTestCode = hittest;
hook.dwExtraInfo = extra_info; hook.dwExtraInfo = extra_info;
HOOK_CallHooks( WH_CBT, HCBT_CLICKSKIPPED, message, (LPARAM)&hook, TRUE ); HOOK_CallHooks( WH_CBT, HCBT_CLICKSKIPPED, message, (LPARAM)&hook, TRUE );
accept_hardware_message( hw_id, TRUE, 0 ); accept_hardware_message( hw_id, TRUE );
return FALSE; return FALSE;
} }
@ -2604,11 +2603,11 @@ static BOOL process_mouse_message( MSG *msg, UINT hw_id, ULONG_PTR extra_info, H
{ {
SendMessageW( msg->hwnd, WM_SETCURSOR, (WPARAM)msg->hwnd, SendMessageW( msg->hwnd, WM_SETCURSOR, (WPARAM)msg->hwnd,
MAKELONG( hittest, msg->message )); MAKELONG( hittest, msg->message ));
accept_hardware_message( hw_id, TRUE, 0 ); accept_hardware_message( hw_id, TRUE );
return FALSE; return FALSE;
} }
accept_hardware_message( hw_id, remove, 0 ); accept_hardware_message( hw_id, remove );
if (!remove || info.hwndCapture) if (!remove || info.hwndCapture)
{ {

View File

@ -2156,7 +2156,6 @@ enum message_type
@REQ(accept_hardware_message) @REQ(accept_hardware_message)
unsigned int hw_id; /* id of the hardware message */ unsigned int hw_id; /* id of the hardware message */
int remove; /* should we remove the message? */ int remove; /* should we remove the message? */
user_handle_t new_win; /* new destination window for current message */
@END @END

View File

@ -1281,7 +1281,7 @@ static void update_input_key_state( struct desktop *desktop, unsigned char *keys
/* release the hardware message currently being processed by the given thread */ /* release the hardware message currently being processed by the given thread */
static void release_hardware_message( struct msg_queue *queue, unsigned int hw_id, static void release_hardware_message( struct msg_queue *queue, unsigned int hw_id,
int remove, user_handle_t new_win ) int remove )
{ {
struct thread_input *input = queue->input; struct thread_input *input = queue->input;
struct message *msg; struct message *msg;
@ -1293,7 +1293,7 @@ static void release_hardware_message( struct msg_queue *queue, unsigned int hw_i
if (&msg->entry == &input->msg_list) return; /* not found */ if (&msg->entry == &input->msg_list) return; /* not found */
/* clear the queue bit for that message */ /* clear the queue bit for that message */
if (remove || new_win) if (remove)
{ {
struct message *other; struct message *other;
int clr_bit; int clr_bit;
@ -1308,32 +1308,7 @@ static void release_hardware_message( struct msg_queue *queue, unsigned int hw_i
} }
} }
if (clr_bit) clear_queue_bits( queue, clr_bit ); if (clr_bit) clear_queue_bits( queue, clr_bit );
}
if (new_win) /* set the new window */
{
struct thread *owner = get_window_thread( new_win );
if (owner)
{
msg->win = new_win;
if (owner->queue->input != input)
{
list_remove( &msg->entry );
if (merge_message( owner->queue->input, msg ))
{
free_message( msg );
release_object( owner );
return;
}
list_add_tail( &owner->queue->input->msg_list, &msg->entry );
}
set_queue_bits( owner->queue, get_hardware_msg_bit( msg ));
remove = 0;
release_object( owner );
}
}
if (remove)
{
update_input_key_state( input->desktop, input->keystate, msg ); update_input_key_state( input->desktop, input->keystate, msg );
list_remove( &msg->entry ); list_remove( &msg->entry );
free_message( msg ); free_message( msg );
@ -1980,7 +1955,7 @@ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user
data->hw_id = msg->unique_id; data->hw_id = msg->unique_id;
set_reply_data( msg->data, msg->data_size ); set_reply_data( msg->data, msg->data_size );
if (msg->msg == WM_INPUT && (flags & PM_REMOVE)) if (msg->msg == WM_INPUT && (flags & PM_REMOVE))
release_hardware_message( current->queue, data->hw_id, 1, 0 ); release_hardware_message( current->queue, data->hw_id, 1 );
return 1; return 1;
} }
/* nothing found, clear the hardware queue bits */ /* nothing found, clear the hardware queue bits */
@ -2471,7 +2446,7 @@ DECL_HANDLER(reply_message)
DECL_HANDLER(accept_hardware_message) DECL_HANDLER(accept_hardware_message)
{ {
if (current->queue) if (current->queue)
release_hardware_message( current->queue, req->hw_id, req->remove, req->new_win ); release_hardware_message( current->queue, req->hw_id, req->remove );
else else
set_error( STATUS_ACCESS_DENIED ); set_error( STATUS_ACCESS_DENIED );
} }