Huw Davies : server: Remove unnecessary 'remove' parameter from accept_hardware_message request.

Alexandre Julliard julliard at winehq.org
Tue Jul 7 15:47:07 CDT 2020


Module: wine
Branch: master
Commit: 434871fd1b6d1fef8c68e8d35689caec49367e20
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=434871fd1b6d1fef8c68e8d35689caec49367e20

Author: Huw Davies <huw at codeweavers.com>
Date:   Tue Jul  7 11:21:50 2020 +0100

server: Remove unnecessary 'remove' parameter from accept_hardware_message request.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/message.c          | 17 ++++++++---------
 include/wine/server_protocol.h |  4 +---
 server/protocol.def            |  3 +--
 server/queue.c                 | 36 +++++++++++++++---------------------
 server/request.h               |  3 +--
 server/trace.c                 |  1 -
 6 files changed, 26 insertions(+), 38 deletions(-)

diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index c5c7db667c..53e0b6495b 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -2271,12 +2271,11 @@ 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 )
+static void accept_hardware_message( UINT hw_id )
 {
     SERVER_START_REQ( accept_hardware_message )
     {
-        req->hw_id   = hw_id;
-        req->remove  = remove;
+        req->hw_id = hw_id;
         if (wine_server_call( req ))
             FIXME("Failed to reply to MSG_HARDWARE message. Message may not be removed from queue.\n");
     }
@@ -2363,10 +2362,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 );
+        accept_hardware_message( hw_id );
         return FALSE;
     }
-    accept_hardware_message( hw_id, remove );
+    if (remove) accept_hardware_message( hw_id );
     msg->pt = point_phys_to_win_dpi( msg->hwnd, msg->pt );
 
     if ( remove && msg->message == WM_KEYDOWN )
@@ -2421,7 +2420,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 );
+        accept_hardware_message( hw_id );
         return FALSE;
     }
 
@@ -2517,7 +2516,7 @@ static BOOL process_mouse_message( MSG *msg, UINT hw_id, ULONG_PTR extra_info, H
         hook.s.dwExtraInfo  = extra_info;
         hook.mouseData      = msg->wParam;
         HOOK_CallHooks( WH_CBT, HCBT_CLICKSKIPPED, message, (LPARAM)&hook, TRUE );
-        accept_hardware_message( hw_id, TRUE );
+        accept_hardware_message( hw_id );
         return FALSE;
     }
 
@@ -2525,11 +2524,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 );
+        accept_hardware_message( hw_id );
         return FALSE;
     }
 
-    accept_hardware_message( hw_id, remove );
+    if (remove) accept_hardware_message( hw_id );
 
     if (!remove || info.hwndCapture)
     {
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index d453f5e661..0f1a0b4477 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -3197,8 +3197,6 @@ struct accept_hardware_message_request
 {
     struct request_header __header;
     unsigned int    hw_id;
-    int             remove;
-    char __pad_20[4];
 };
 struct accept_hardware_message_reply
 {
@@ -6671,7 +6669,7 @@ union generic_reply
 
 /* ### protocol_version begin ### */
 
-#define SERVER_PROTOCOL_VERSION 616
+#define SERVER_PROTOCOL_VERSION 617
 
 /* ### protocol_version end ### */
 
diff --git a/server/protocol.def b/server/protocol.def
index 34c6b5f65d..e55d47bcd2 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -2352,10 +2352,9 @@ enum message_type
 @END
 
 
-/* Accept the current hardware message */
+/* Accept and remove the current hardware message */
 @REQ(accept_hardware_message)
     unsigned int    hw_id;     /* id of the hardware message */
-    int             remove;    /* should we remove the message? */
 @END
 
 
diff --git a/server/queue.c b/server/queue.c
index 432885f9e4..a65eab38bd 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -1384,11 +1384,11 @@ static void update_desktop_mouse_state( struct desktop *desktop, unsigned int fl
 }
 
 /* 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 )
+static void release_hardware_message( struct msg_queue *queue, unsigned int hw_id )
 {
     struct thread_input *input = queue->input;
-    struct message *msg;
+    struct message *msg, *other;
+    int clr_bit;
 
     LIST_FOR_EACH_ENTRY( msg, &input->msg_list, struct message, entry )
     {
@@ -1397,26 +1397,20 @@ 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)
+    clr_bit = get_hardware_msg_bit( msg );
+    LIST_FOR_EACH_ENTRY( other, &input->msg_list, struct message, entry )
     {
-        struct message *other;
-        int clr_bit;
-
-        clr_bit = get_hardware_msg_bit( msg );
-        LIST_FOR_EACH_ENTRY( other, &input->msg_list, struct message, entry )
+        if (other != msg && get_hardware_msg_bit( other ) == clr_bit)
         {
-            if (other != msg && get_hardware_msg_bit( other ) == clr_bit)
-            {
-                clr_bit = 0;
-                break;
-            }
+            clr_bit = 0;
+            break;
         }
-        if (clr_bit) clear_queue_bits( queue, clr_bit );
-
-        update_input_key_state( input->desktop, input->keystate, msg->msg, msg->wparam );
-        list_remove( &msg->entry );
-        free_message( msg );
     }
+    if (clr_bit) clear_queue_bits( queue, clr_bit );
+
+    update_input_key_state( input->desktop, input->keystate, msg->msg, msg->wparam );
+    list_remove( &msg->entry );
+    free_message( msg );
 }
 
 static int queue_hotkey_message( struct desktop *desktop, struct message *msg )
@@ -2080,7 +2074,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 );
+            release_hardware_message( current->queue, data->hw_id );
         return 1;
     }
     /* nothing found, clear the hardware queue bits */
@@ -2606,7 +2600,7 @@ DECL_HANDLER(reply_message)
 DECL_HANDLER(accept_hardware_message)
 {
     if (current->queue)
-        release_hardware_message( current->queue, req->hw_id, req->remove );
+        release_hardware_message( current->queue, req->hw_id );
     else
         set_error( STATUS_ACCESS_DENIED );
 }
diff --git a/server/request.h b/server/request.h
index d6e2613c0a..a81d64527d 100644
--- a/server/request.h
+++ b/server/request.h
@@ -1567,8 +1567,7 @@ C_ASSERT( FIELD_OFFSET(struct reply_message_request, remove) == 12 );
 C_ASSERT( FIELD_OFFSET(struct reply_message_request, result) == 16 );
 C_ASSERT( sizeof(struct reply_message_request) == 24 );
 C_ASSERT( FIELD_OFFSET(struct accept_hardware_message_request, hw_id) == 12 );
-C_ASSERT( FIELD_OFFSET(struct accept_hardware_message_request, remove) == 16 );
-C_ASSERT( sizeof(struct accept_hardware_message_request) == 24 );
+C_ASSERT( sizeof(struct accept_hardware_message_request) == 16 );
 C_ASSERT( FIELD_OFFSET(struct get_message_reply_request, cancel) == 12 );
 C_ASSERT( sizeof(struct get_message_reply_request) == 16 );
 C_ASSERT( FIELD_OFFSET(struct get_message_reply_reply, result) == 8 );
diff --git a/server/trace.c b/server/trace.c
index ad34cef118..16c35b93b5 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -2887,7 +2887,6 @@ static void dump_reply_message_request( const struct reply_message_request *req
 static void dump_accept_hardware_message_request( const struct accept_hardware_message_request *req )
 {
     fprintf( stderr, " hw_id=%08x", req->hw_id );
-    fprintf( stderr, ", remove=%d", req->remove );
 }
 
 static void dump_get_message_reply_request( const struct get_message_reply_request *req )




More information about the wine-cvs mailing list