From: Rémi Bernon <rbernon@codeweavers.com> --- include/ntuser.h | 4 ++++ server/protocol.def | 3 +-- server/queue.c | 20 ++++++++++++-------- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/include/ntuser.h b/include/ntuser.h index 2bbf77a4cf1..54d0d626d7b 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -1598,6 +1598,10 @@ struct hid_packet C_ASSERT(sizeof(struct hid_packet) == offsetof(struct hid_packet, data[0])); +#define SEND_HWMSG_INJECTED 1 +#define SEND_HWMSG_NO_RAW 2 +#define SEND_HWMSG_NO_MSG 4 + struct send_hardware_input_params { UINT flags; diff --git a/server/protocol.def b/server/protocol.def index e7d966613ac..ab028bcbf31 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -2394,7 +2394,7 @@ enum message_type @REQ(send_hardware_message) user_handle_t win; /* window handle */ union hw_input input; /* input data */ - unsigned int flags; /* flags (see below) */ + unsigned int flags; /* flags (see ntuser.h) */ VARARG(report,bytes); /* HID report data */ @REPLY int wait; /* do we need to wait for a reply? */ @@ -2403,7 +2403,6 @@ enum message_type int new_x; /* new cursor position */ int new_y; @END -#define SEND_HWMSG_INJECTED 0x01 /* Get a message from the current queue */ diff --git a/server/queue.c b/server/queue.c index a04b53b70de..4182ee7bf86 100644 --- a/server/queue.c +++ b/server/queue.c @@ -2211,7 +2211,7 @@ static void dispatch_rawinput_message( struct desktop *desktop, struct rawinput_ /* queue a hardware message for a mouse event */ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, const union hw_input *input, - unsigned int origin, struct msg_queue *sender ) + unsigned int origin, struct msg_queue *sender, unsigned int send_flags ) { desktop_shm_t *desktop_shm = desktop->shared; struct hardware_msg_data *msg_data; @@ -2271,7 +2271,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons y = desktop_shm->cursor.y; } - if ((foreground = get_foreground_thread( desktop, win ))) + if (!(send_flags & SEND_HWMSG_NO_RAW) && (foreground = get_foreground_thread( desktop, win ))) { memset( &raw_msg, 0, sizeof(raw_msg) ); raw_msg.foreground = foreground; @@ -2286,6 +2286,8 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons release_object( foreground ); } + if (send_flags & SEND_HWMSG_NO_MSG) return 0; + for (i = 0; i < ARRAY_SIZE( messages ); i++) { if (!messages[i]) continue; @@ -2316,14 +2318,14 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons } static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, const union hw_input *input, - unsigned int origin, struct msg_queue *sender, int repeat ); + unsigned int origin, struct msg_queue *sender, int repeat, unsigned int send_flags); static void key_repeat_timeout( void *private ) { struct desktop *desktop = private; desktop->key_repeat.timeout = NULL; - queue_keyboard_message( desktop, desktop->key_repeat.win, &desktop->key_repeat.input, IMO_HARDWARE, NULL, 1 ); + queue_keyboard_message( desktop, desktop->key_repeat.win, &desktop->key_repeat.input, IMO_HARDWARE, NULL, 1, 0 ); } static void stop_key_repeat( struct desktop *desktop ) @@ -2336,7 +2338,7 @@ static void stop_key_repeat( struct desktop *desktop ) /* queue a hardware message for a keyboard event */ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, const union hw_input *input, - unsigned int origin, struct msg_queue *sender, int repeat ) + unsigned int origin, struct msg_queue *sender, int repeat, unsigned int send_flags ) { desktop_shm_t *desktop_shm = desktop->shared; struct hw_msg_source source = { IMDT_KEYBOARD, origin }; @@ -2459,7 +2461,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c } } - if (!unicode && (foreground = get_foreground_thread( desktop, win ))) + if (!(send_flags & SEND_HWMSG_NO_RAW) && ((!unicode && (foreground = get_foreground_thread( desktop, win ))))) { struct rawinput_message raw_msg = {0}; raw_msg.foreground = foreground; @@ -2474,6 +2476,8 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c release_object( foreground ); } + if (send_flags & SEND_HWMSG_NO_MSG) return 0; + if (!(msg = alloc_hardware_message( input->kbd.info, source, time, 0 ))) return 0; msg_data = msg->data; @@ -3258,10 +3262,10 @@ DECL_HANDLER(send_hardware_message) switch (req->input.type) { case INPUT_MOUSE: - wait = queue_mouse_message( desktop, req->win, &req->input, origin, sender ); + wait = queue_mouse_message( desktop, req->win, &req->input, origin, sender, req->flags ); break; case INPUT_KEYBOARD: - wait = queue_keyboard_message( desktop, req->win, &req->input, origin, sender, 0 ); + wait = queue_keyboard_message( desktop, req->win, &req->input, origin, sender, 0, req->flags ); break; case INPUT_HARDWARE: queue_custom_hardware_message( desktop, req->win, origin, &req->input ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11117