[RFC PATCH 4/6] user32: Remove __wine_send_input function.

Rémi Bernon rbernon at codeweavers.com
Mon Nov 11 14:23:01 CST 2019


__wine_send_input was introduced at a time when SendInput was handled
in the graphics drivers, we don't do that anymore and it makes little
sense to go through user32 for user input now.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---

Notes:
    Making the request directly also bypasses the wait for the reply,
    as well as some state update, but I think it should be alright as
    we should not care about native vs injected input processing order.
    
    I'm not entirely sure of the implication of not waiting for the
    reply, but I think graphics drivers don't care about it. It also has
    a beneficial impact on performance in the case where we would have
    waited for the reply on each input.

 dlls/user32/input.c        | 17 ++---------------
 dlls/user32/message.c      |  8 ++++----
 dlls/user32/user32.spec    |  1 -
 dlls/user32/user_private.h |  2 +-
 include/winuser.h          |  4 ----
 5 files changed, 7 insertions(+), 25 deletions(-)

diff --git a/dlls/user32/input.c b/dlls/user32/input.c
index 8b2ae805aa7..4268a8c1d6c 100644
--- a/dlls/user32/input.c
+++ b/dlls/user32/input.c
@@ -117,19 +117,6 @@ BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret )
 }
 
 
-/***********************************************************************
- *		__wine_send_input  (USER32.@)
- *
- * Internal SendInput function to allow the graphics driver to inject real events.
- */
-BOOL CDECL __wine_send_input( HWND hwnd, const INPUT *input )
-{
-    NTSTATUS status = send_hardware_message( hwnd, input, 0 );
-    if (status) SetLastError( RtlNtStatusToDosError(status) );
-    return !status;
-}
-
-
 /***********************************************************************
  *		update_mouse_coords
  *
@@ -192,9 +179,9 @@ UINT WINAPI SendInput( UINT count, LPINPUT inputs, int size )
             /* we need to update the coordinates to what the server expects */
             INPUT input = inputs[i];
             update_mouse_coords( &input );
-            status = send_hardware_message( 0, &input, SEND_HWMSG_INJECTED );
+            status = inject_hardware_message( 0, &input );
         }
-        else status = send_hardware_message( 0, &inputs[i], SEND_HWMSG_INJECTED );
+        else status = inject_hardware_message( 0, &inputs[i] );
 
         if (status)
         {
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index 1336865112a..2327d66cb05 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -3319,9 +3319,9 @@ static BOOL send_message( struct send_message_info *info, DWORD_PTR *res_ptr, BO
 
 
 /***********************************************************************
- *		send_hardware_message
+ *		inject_hardware_message
  */
-NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, UINT flags )
+NTSTATUS inject_hardware_message( HWND hwnd, const INPUT *input )
 {
     struct user_key_state_info *key_state_info = get_user_thread_info()->key_state;
     struct send_message_info info;
@@ -3339,7 +3339,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, UINT flags )
     SERVER_START_REQ( send_hardware_message )
     {
         req->win        = wine_server_user_handle( hwnd );
-        req->flags      = flags;
+        req->flags      = SEND_HWMSG_INJECTED;
         req->input.type = input->type;
         switch (input->type)
         {
@@ -3381,7 +3381,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, UINT flags )
             key_state_info->time    = GetTickCount();
             key_state_info->counter = counter;
         }
-        if ((flags & SEND_HWMSG_INJECTED) && (prev_x != new_x || prev_y != new_y))
+        if ((prev_x != new_x || prev_y != new_y))
             USER_Driver->pSetCursorPos( new_x, new_y );
     }
 
diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec
index f9a4ae26df4..55fb438c3b1 100644
--- a/dlls/user32/user32.spec
+++ b/dlls/user32/user32.spec
@@ -832,5 +832,4 @@
 # All functions must be prefixed with '__wine_' (for internal functions)
 # or 'wine_' (for user-visible functions) to avoid namespace conflicts.
 #
-@ cdecl __wine_send_input(long ptr)
 @ cdecl __wine_set_pixel_format(long long)
diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h
index c11aae707c9..b11945c120f 100644
--- a/dlls/user32/user_private.h
+++ b/dlls/user32/user_private.h
@@ -249,7 +249,7 @@ extern RECT get_virtual_screen_rect(void) DECLSPEC_HIDDEN;
 extern LRESULT call_current_hook( HHOOK hhook, INT code, WPARAM wparam, LPARAM lparam ) DECLSPEC_HIDDEN;
 extern DWORD get_input_codepage( void ) DECLSPEC_HIDDEN;
 extern BOOL map_wparam_AtoW( UINT message, WPARAM *wparam, enum wm_char_mapping mapping ) DECLSPEC_HIDDEN;
-extern NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, UINT flags ) DECLSPEC_HIDDEN;
+extern NTSTATUS inject_hardware_message( HWND hwnd, const INPUT *input ) DECLSPEC_HIDDEN;
 extern LRESULT MSG_SendInternalMessageTimeout( DWORD dest_pid, DWORD dest_tid,
                                                UINT msg, WPARAM wparam, LPARAM lparam,
                                                UINT flags, UINT timeout, PDWORD_PTR res_ptr ) DECLSPEC_HIDDEN;
diff --git a/include/winuser.h b/include/winuser.h
index 51c73d25c2f..62d5f0dd110 100644
--- a/include/winuser.h
+++ b/include/winuser.h
@@ -4388,10 +4388,6 @@ static inline BOOL WINAPI SetRectEmpty(LPRECT rect)
 /* NOTE: This is SYSTEM.3, not USER.182, which is also named KillSystemTimer */
 WORD        WINAPI SYSTEM_KillSystemTimer( WORD );
 
-#ifdef __WINESRC__
-WINUSERAPI BOOL CDECL __wine_send_input( HWND hwnd, const INPUT *input );
-#endif
-
 #ifdef __cplusplus
 }
 #endif
-- 
2.24.0.rc2




More information about the wine-devel mailing list