From f747e5c8c982d76e160d67b8f5a1c784585e4c18 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Tue, 14 Oct 2014 13:29:06 +0200 Subject: [PATCH] user32: Don't move mouse hardware messages to other threads queues. --- dlls/user32/message.c | 15 +++++++-------- server/protocol.def | 1 - server/queue.c | 33 ++++----------------------------- 3 files changed, 11 insertions(+), 38 deletions(-) diff --git a/dlls/user32/message.c b/dlls/user32/message.c index fd824983276..b75c7e930e0 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -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 * (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 ) { req->hw_id = hw_id; req->remove = remove; - req->new_win = wine_server_user_handle( new_hwnd ); if (wine_server_call( req )) 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 */ 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; } - accept_hardware_message( hw_id, remove, 0 ); + accept_hardware_message( hw_id, remove ); if ( remove && msg->message == WM_KEYDOWN ) 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 )) { - accept_hardware_message( hw_id, TRUE, msg->hwnd ); + accept_hardware_message( hw_id, TRUE ); 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.dwExtraInfo = extra_info; 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; } @@ -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, MAKELONG( hittest, msg->message )); - accept_hardware_message( hw_id, TRUE, 0 ); + accept_hardware_message( hw_id, TRUE ); return FALSE; } - accept_hardware_message( hw_id, remove, 0 ); + accept_hardware_message( hw_id, remove ); if (!remove || info.hwndCapture) { diff --git a/server/protocol.def b/server/protocol.def index c9270ea098e..4854e3dcb51 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -2156,7 +2156,6 @@ enum message_type @REQ(accept_hardware_message) unsigned int hw_id; /* id of the hardware message */ int remove; /* should we remove the message? */ - user_handle_t new_win; /* new destination window for current message */ @END diff --git a/server/queue.c b/server/queue.c index 71dfc11d434..5f8720352b9 100644 --- a/server/queue.c +++ b/server/queue.c @@ -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 */ 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 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 */ /* clear the queue bit for that message */ - if (remove || new_win) + if (remove) { struct message *other; 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 (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 ); list_remove( &msg->entry ); 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; set_reply_data( msg->data, msg->data_size ); 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; } /* nothing found, clear the hardware queue bits */ @@ -2471,7 +2446,7 @@ DECL_HANDLER(reply_message) DECL_HANDLER(accept_hardware_message) { 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 set_error( STATUS_ACCESS_DENIED ); }