[PATCH 7/8] server: Implement RegisterRawInputDevices RIDEV_NOLEGACY flag.
Rémi Bernon
rbernon at codeweavers.com
Sun Jun 7 06:21:19 CDT 2020
This makes legacy mouse window messages such as WM_MOUSEMOVE and others,
to stop being sent, including to low-level hooks. The desktop mouse
state should still be udpated.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
dlls/user32/rawinput.c | 2 +-
dlls/user32/tests/input.c | 2 +-
server/queue.c | 21 +++++++++++++++++++++
3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c
index dd2ac2e208b..7a9eb6ced17 100644
--- a/dlls/user32/rawinput.c
+++ b/dlls/user32/rawinput.c
@@ -306,7 +306,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH RegisterRawInputDevices(RAWINPUTDEVICE *devices, U
TRACE("device %u: page %#x, usage %#x, flags %#x, target %p.\n",
i, devices[i].usUsagePage, devices[i].usUsage,
devices[i].dwFlags, devices[i].hwndTarget);
- if (devices[i].dwFlags & ~RIDEV_REMOVE)
+ if (devices[i].dwFlags & ~(RIDEV_REMOVE|RIDEV_NOLEGACY))
FIXME("Unhandled flags %#x for device %u.\n", devices[i].dwFlags, i);
d[i].usage_page = devices[i].usUsagePage;
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c
index 7fa43f21fbb..f04c658da62 100644
--- a/dlls/user32/tests/input.c
+++ b/dlls/user32/tests/input.c
@@ -1876,7 +1876,7 @@ struct rawinput_test rawinput_tests[] =
{ FALSE, FALSE, 0, TRUE, FALSE, FALSE, /* todos: */ FALSE, FALSE, FALSE },
{ TRUE, FALSE, 0, TRUE, TRUE, TRUE, /* todos: */ FALSE, FALSE, FALSE },
{ TRUE, TRUE, 0, TRUE, TRUE, TRUE, /* todos: */ FALSE, FALSE, FALSE },
- { TRUE, TRUE, RIDEV_NOLEGACY, FALSE, TRUE, TRUE, /* todos: */ TRUE, FALSE, FALSE },
+ { TRUE, TRUE, RIDEV_NOLEGACY, FALSE, TRUE, TRUE, /* todos: */ FALSE, FALSE, FALSE },
/* same-process foreground tests */
{ TRUE, FALSE, 0, FALSE, FALSE, FALSE, /* todos: */ FALSE, FALSE, FALSE },
diff --git a/server/queue.c b/server/queue.c
index 3c1ef19df51..14cffbd6a76 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -384,8 +384,15 @@ static int update_desktop_cursor_pos( struct desktop *desktop, int x, int y )
static void set_cursor_pos( struct desktop *desktop, int x, int y )
{
static const struct hw_msg_source source = { IMDT_UNAVAILABLE, IMO_SYSTEM };
+ const struct rawinput_device *device;
struct message *msg;
+ if ((device = current->process->rawinput_mouse) && (device->flags & RIDEV_NOLEGACY))
+ {
+ update_desktop_cursor_pos( desktop, x, y );
+ return;
+ }
+
if (!(msg = alloc_hardware_message( 0, source, get_tick_count() ))) return;
msg->msg = WM_MOUSEMOVE;
@@ -1691,6 +1698,7 @@ done:
static int queue_mouse_message( struct desktop *desktop, user_handle_t win, const hw_input_t *input,
unsigned int origin, struct msg_queue *sender )
{
+ const struct rawinput_device *device;
struct hardware_msg_data *msg_data;
struct rawinput_message raw_msg;
struct message *msg;
@@ -1756,6 +1764,12 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
enum_processes( queue_rawinput_message, &raw_msg );
+ if ((device = current->process->rawinput_mouse) && (device->flags & RIDEV_NOLEGACY))
+ {
+ update_desktop_mouse_state( desktop, flags, x, y, input->mouse.data << 16 );
+ return 0;
+ }
+
for (i = 0; i < ARRAY_SIZE( messages ); i++)
{
if (!messages[i]) continue;
@@ -1790,6 +1804,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
unsigned int origin, struct msg_queue *sender )
{
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;
@@ -1877,6 +1892,12 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
enum_processes( queue_rawinput_message, &raw_msg );
+ if ((device = current->process->rawinput_kbd) && (device->flags & RIDEV_NOLEGACY))
+ {
+ update_input_key_state( desktop, desktop->keystate, message_code, vkey );
+ return 0;
+ }
+
if (!(msg = alloc_hardware_message( input->kbd.info, source, time ))) return 0;
msg_data = msg->data;
--
2.27.0
More information about the wine-devel
mailing list