[PATCH v2 4/8] server: Add send_hardware_message flags for rawinput translation.
Rémi Bernon
rbernon at codeweavers.com
Thu Nov 14 15:29:00 CST 2019
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
dlls/user32/input.c | 6 +++---
server/protocol.def | 2 ++
server/queue.c | 20 ++++++++++++++------
3 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/dlls/user32/input.c b/dlls/user32/input.c
index 0325e2ce3df..fe7fc111aef 100644
--- a/dlls/user32/input.c
+++ b/dlls/user32/input.c
@@ -124,7 +124,7 @@ BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret )
*/
BOOL CDECL __wine_send_input( HWND hwnd, const INPUT *input )
{
- NTSTATUS status = send_hardware_message( hwnd, input, 0 );
+ NTSTATUS status = send_hardware_message( hwnd, input, SEND_HWMSG_RAWINPUT|SEND_HWMSG_WINDOW );
if (status) SetLastError( RtlNtStatusToDosError(status) );
return !status;
}
@@ -192,9 +192,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 = send_hardware_message( 0, &input, SEND_HWMSG_INJECTED|SEND_HWMSG_RAWINPUT|SEND_HWMSG_WINDOW );
}
- else status = send_hardware_message( 0, &inputs[i], SEND_HWMSG_INJECTED );
+ else status = send_hardware_message( 0, &inputs[i], SEND_HWMSG_INJECTED|SEND_HWMSG_RAWINPUT|SEND_HWMSG_WINDOW );
if (status)
{
diff --git a/server/protocol.def b/server/protocol.def
index 3a0df20bdba..e2afa476770 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -2314,6 +2314,8 @@ enum message_type
VARARG(keystate,bytes); /* global state array for all the keys */
@END
#define SEND_HWMSG_INJECTED 0x01
+#define SEND_HWMSG_RAWINPUT 0x02
+#define SEND_HWMSG_WINDOW 0x04
/* Get a message from the current queue */
diff --git a/server/queue.c b/server/queue.c
index b5e17be18fb..fb5452b1f17 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -1598,7 +1598,7 @@ static int send_hook_ll_message( struct desktop *desktop, struct message *hardwa
/* queue a hardware message for a mouse event */
static int queue_mouse_message( struct desktop *desktop, user_handle_t win, const hw_input_t *input,
- unsigned int origin, struct msg_queue *sender )
+ unsigned int origin, struct msg_queue *sender, unsigned int req_flags )
{
const struct rawinput_device *device;
struct hardware_msg_data *msg_data;
@@ -1651,7 +1651,8 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
y = desktop->cursor.y;
}
- if ((device = current->process->rawinput_mouse))
+ if ((device = current->process->rawinput_mouse) &&
+ (req_flags & SEND_HWMSG_RAWINPUT))
{
if (!(msg = alloc_hardware_message( input->mouse.info, source, time ))) return 0;
msg_data = msg->data;
@@ -1670,6 +1671,9 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
queue_hardware_message( desktop, msg, 0 );
}
+ if (!(req_flags & SEND_HWMSG_WINDOW))
+ return 0;
+
for (i = 0; i < ARRAY_SIZE( messages ); i++)
{
if (!messages[i]) continue;
@@ -1701,7 +1705,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
/* queue a hardware message for a keyboard event */
static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, const hw_input_t *input,
- unsigned int origin, struct msg_queue *sender )
+ unsigned int origin, struct msg_queue *sender, unsigned int req_flags )
{
struct hw_msg_source source = { IMDT_KEYBOARD, origin };
const struct rawinput_device *device;
@@ -1777,7 +1781,8 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
break;
}
- if ((device = current->process->rawinput_kbd))
+ if ((device = current->process->rawinput_kbd) &&
+ (req_flags & SEND_HWMSG_RAWINPUT))
{
if (!(msg = alloc_hardware_message( input->kbd.info, source, time ))) return 0;
msg_data = msg->data;
@@ -1795,6 +1800,9 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
queue_hardware_message( desktop, msg, 0 );
}
+ if (!(req_flags & SEND_HWMSG_WINDOW))
+ return 0;
+
if (!(msg = alloc_hardware_message( input->kbd.info, source, time ))) return 0;
msg_data = msg->data;
@@ -2351,10 +2359,10 @@ DECL_HANDLER(send_hardware_message)
switch (req->input.type)
{
case INPUT_MOUSE:
- reply->wait = queue_mouse_message( desktop, req->win, &req->input, origin, sender );
+ reply->wait = queue_mouse_message( desktop, req->win, &req->input, origin, sender, req->flags );
break;
case INPUT_KEYBOARD:
- reply->wait = queue_keyboard_message( desktop, req->win, &req->input, origin, sender );
+ reply->wait = queue_keyboard_message( desktop, req->win, &req->input, origin, sender, req->flags );
break;
case INPUT_HARDWARE:
queue_custom_hardware_message( desktop, req->win, origin, &req->input );
--
2.24.0.rc2
More information about the wine-devel
mailing list