mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
183 lines
6.7 KiB
Diff
183 lines
6.7 KiB
Diff
|
From 9a0c9443ada9bccc1d10270398dbf9bddb483d53 Mon Sep 17 00:00:00 2001
|
||
|
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||
|
Date: Tue, 12 Nov 2019 12:41:55 +0100
|
||
|
Subject: [PATCH 05/12] server: Broadcast rawinput message if request flag is
|
||
|
SEND_HWMSG_RAWINPUT.
|
||
|
|
||
|
If the request flag is equal to SEND_HWMSG_RAWINPUT, we broadcast the
|
||
|
message to all listening processes -or at least to the foreground
|
||
|
process until RIDEV_INPUTSINK is supported.
|
||
|
---
|
||
|
dlls/user32/tests/input.c | 2 +-
|
||
|
server/queue.c | 98 ++++++++++++++++++++++++++++++---------
|
||
|
2 files changed, 78 insertions(+), 22 deletions(-)
|
||
|
|
||
|
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c
|
||
|
index cc7babd1af4..d18ccfebcaf 100644
|
||
|
--- a/dlls/user32/tests/input.c
|
||
|
+++ b/dlls/user32/tests/input.c
|
||
|
@@ -2057,7 +2057,7 @@ static void test_rawinput_mouse(const char *argv0)
|
||
|
{ TRUE, TRUE, RIDEV_INPUTSINK, 2, 2, 0, 0, TRUE },
|
||
|
|
||
|
/* cross-process foreground tests */
|
||
|
- { TRUE, TRUE, 0, 0, 0, 0, 0, TRUE },
|
||
|
+ { TRUE, TRUE, 0, 0, 0, 0, 0, FALSE },
|
||
|
{ TRUE, TRUE, RIDEV_INPUTSINK, 2, 0, 0, 0, TRUE },
|
||
|
};
|
||
|
|
||
|
diff --git a/server/queue.c b/server/queue.c
|
||
|
index 9528453b190..2bdd099d1bb 100644
|
||
|
--- a/server/queue.c
|
||
|
+++ b/server/queue.c
|
||
|
@@ -1734,12 +1734,67 @@ static int send_hook_ll_message( struct desktop *desktop, struct message *hardwa
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
|
+struct rawinput_message
|
||
|
+{
|
||
|
+ struct desktop *desktop;
|
||
|
+ struct hw_msg_source source;
|
||
|
+ unsigned int time;
|
||
|
+ struct hardware_msg_data data;
|
||
|
+};
|
||
|
+
|
||
|
+static int queue_rawinput_message( struct process* process, void* user )
|
||
|
+{
|
||
|
+ const struct rawinput_message* raw_msg = user;
|
||
|
+ const struct rawinput_device *device = NULL;
|
||
|
+ struct desktop *desktop = NULL;
|
||
|
+ struct thread *thread = NULL, *foreground = NULL;
|
||
|
+ struct message *msg;
|
||
|
+
|
||
|
+ if (raw_msg->data.rawinput.type == RIM_TYPEMOUSE)
|
||
|
+ device = process->rawinput_mouse;
|
||
|
+ else if (raw_msg->data.rawinput.type == RIM_TYPEKEYBOARD)
|
||
|
+ device = process->rawinput_kbd;
|
||
|
+
|
||
|
+ if (!device)
|
||
|
+ goto done;
|
||
|
+
|
||
|
+ if (!(desktop = get_desktop_obj( process, process->desktop, 0 )) ||
|
||
|
+ (raw_msg->desktop && desktop != raw_msg->desktop))
|
||
|
+ goto done;
|
||
|
+
|
||
|
+ if (!(thread = get_window_thread( device->target ? device->target : desktop->foreground_input->active )) ||
|
||
|
+ process != thread->process)
|
||
|
+ goto done;
|
||
|
+
|
||
|
+ /* FIXME: Implement RIDEV_INPUTSINK */
|
||
|
+ if (!(foreground = get_window_thread( desktop->foreground_input->active )) ||
|
||
|
+ thread->process != foreground->process)
|
||
|
+ goto done;
|
||
|
+
|
||
|
+ if (!(msg = alloc_hardware_message( raw_msg->data.info, raw_msg->source, raw_msg->time )))
|
||
|
+ goto done;
|
||
|
+
|
||
|
+ msg->win = device->target;
|
||
|
+ msg->msg = WM_INPUT;
|
||
|
+ msg->wparam = RIM_INPUT;
|
||
|
+ msg->lparam = 0;
|
||
|
+ memcpy( msg->data, &raw_msg->data, sizeof(raw_msg->data) );
|
||
|
+
|
||
|
+ queue_hardware_message( desktop, msg, 0 );
|
||
|
+
|
||
|
+done:
|
||
|
+ if (foreground) release_object( foreground );
|
||
|
+ if (thread) release_object( thread );
|
||
|
+ if (desktop) release_object( desktop );
|
||
|
+ return 0;
|
||
|
+}
|
||
|
+
|
||
|
/* 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 req_flags )
|
||
|
{
|
||
|
- const struct rawinput_device *device;
|
||
|
struct hardware_msg_data *msg_data;
|
||
|
+ struct rawinput_message raw_msg;
|
||
|
struct message *msg;
|
||
|
unsigned int i, time, flags;
|
||
|
struct hw_msg_source source = { IMDT_MOUSE, origin };
|
||
|
@@ -1789,24 +1844,24 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
|
||
|
y = desktop->cursor.y;
|
||
|
}
|
||
|
|
||
|
- if ((device = current->process->rawinput_mouse) &&
|
||
|
- (req_flags & SEND_HWMSG_RAWINPUT))
|
||
|
+ if (req_flags & SEND_HWMSG_RAWINPUT)
|
||
|
{
|
||
|
- if (!(msg = alloc_hardware_message( input->mouse.info, source, time ))) return 0;
|
||
|
- msg_data = msg->data;
|
||
|
-
|
||
|
- msg->win = device->target;
|
||
|
- msg->msg = WM_INPUT;
|
||
|
- msg->wparam = RIM_INPUT;
|
||
|
- msg->lparam = 0;
|
||
|
+ raw_msg.desktop = desktop;
|
||
|
+ raw_msg.source = source;
|
||
|
+ raw_msg.time = time;
|
||
|
|
||
|
+ msg_data = &raw_msg.data;
|
||
|
+ msg_data->info = input->mouse.info;
|
||
|
msg_data->flags = flags;
|
||
|
msg_data->rawinput.type = RIM_TYPEMOUSE;
|
||
|
msg_data->rawinput.mouse.x = x - desktop->cursor.x;
|
||
|
msg_data->rawinput.mouse.y = y - desktop->cursor.y;
|
||
|
msg_data->rawinput.mouse.data = input->mouse.data;
|
||
|
|
||
|
- queue_hardware_message( desktop, msg, 0 );
|
||
|
+ if (req_flags == SEND_HWMSG_RAWINPUT)
|
||
|
+ enum_processes( queue_rawinput_message, &raw_msg );
|
||
|
+ else
|
||
|
+ queue_rawinput_message( current->process, &raw_msg );
|
||
|
}
|
||
|
|
||
|
if (!(req_flags & SEND_HWMSG_WINDOW))
|
||
|
@@ -1846,8 +1901,8 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
|
||
|
unsigned int origin, struct msg_queue *sender, unsigned int req_flags )
|
||
|
{
|
||
|
struct hw_msg_source source = { IMDT_KEYBOARD, origin };
|
||
|
- const struct rawinput_device *device;
|
||
|
struct hardware_msg_data *msg_data;
|
||
|
+ struct rawinput_message raw_msg;
|
||
|
struct message *msg;
|
||
|
unsigned char vkey = input->kbd.vkey;
|
||
|
unsigned int message_code, time;
|
||
|
@@ -1919,23 +1974,24 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
- if ((device = current->process->rawinput_kbd) &&
|
||
|
- (req_flags & SEND_HWMSG_RAWINPUT))
|
||
|
+ if (req_flags & SEND_HWMSG_RAWINPUT)
|
||
|
{
|
||
|
- if (!(msg = alloc_hardware_message( input->kbd.info, source, time ))) return 0;
|
||
|
- msg_data = msg->data;
|
||
|
-
|
||
|
- msg->win = device->target;
|
||
|
- msg->msg = WM_INPUT;
|
||
|
- msg->wparam = RIM_INPUT;
|
||
|
+ raw_msg.desktop = desktop;
|
||
|
+ raw_msg.source = source;
|
||
|
+ raw_msg.time = time;
|
||
|
|
||
|
+ msg_data = &raw_msg.data;
|
||
|
+ msg_data->info = input->kbd.info;
|
||
|
msg_data->flags = input->kbd.flags;
|
||
|
msg_data->rawinput.type = RIM_TYPEKEYBOARD;
|
||
|
msg_data->rawinput.kbd.message = message_code;
|
||
|
msg_data->rawinput.kbd.vkey = vkey;
|
||
|
msg_data->rawinput.kbd.scan = input->kbd.scan;
|
||
|
|
||
|
- queue_hardware_message( desktop, msg, 0 );
|
||
|
+ if (req_flags == SEND_HWMSG_RAWINPUT)
|
||
|
+ enum_processes( queue_rawinput_message, &raw_msg );
|
||
|
+ else
|
||
|
+ queue_rawinput_message( current->process, &raw_msg );
|
||
|
}
|
||
|
|
||
|
if (!(req_flags & SEND_HWMSG_WINDOW))
|
||
|
--
|
||
|
2.24.1
|
||
|
|