Rémi Bernon : server: Implement RegisterRawInputDevices RIDEV_NOLEGACY flag.
Alexandre Julliard
julliard at winehq.org
Thu Jun 25 16:14:24 CDT 2020
Module: wine
Branch: master
Commit: 8cf7fe3b7c20665ad308ce3010cd635ac63da6b7
URL: https://source.winehq.org/git/wine.git/?a=commit;h=8cf7fe3b7c20665ad308ce3010cd635ac63da6b7
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Wed Jun 24 15:28:41 2020 +0200
server: Implement RegisterRawInputDevices RIDEV_NOLEGACY flag.
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>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/rawinput.c | 2 +-
dlls/user32/tests/input.c | 2 +-
server/queue.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 47 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c
index dd2ac2e208..7a9eb6ced1 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 e43e72532a..0c14de7d78 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 5b018085cc..92a9c5f2c2 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;
@@ -1352,6 +1359,30 @@ static void update_input_key_state( struct desktop *desktop, unsigned char *keys
}
}
+/* update the desktop key state according to a mouse message flags */
+static void update_desktop_mouse_state( struct desktop *desktop, unsigned int flags,
+ int x, int y, lparam_t wparam )
+{
+ if (flags & MOUSEEVENTF_MOVE)
+ update_desktop_cursor_pos( desktop, x, y );
+ if (flags & MOUSEEVENTF_LEFTDOWN)
+ update_input_key_state( desktop, desktop->keystate, WM_LBUTTONDOWN, wparam );
+ if (flags & MOUSEEVENTF_LEFTUP)
+ update_input_key_state( desktop, desktop->keystate, WM_LBUTTONUP, wparam );
+ if (flags & MOUSEEVENTF_RIGHTDOWN)
+ update_input_key_state( desktop, desktop->keystate, WM_RBUTTONDOWN, wparam );
+ if (flags & MOUSEEVENTF_RIGHTUP)
+ update_input_key_state( desktop, desktop->keystate, WM_RBUTTONUP, wparam );
+ if (flags & MOUSEEVENTF_MIDDLEDOWN)
+ update_input_key_state( desktop, desktop->keystate, WM_MBUTTONDOWN, wparam );
+ if (flags & MOUSEEVENTF_MIDDLEUP)
+ update_input_key_state( desktop, desktop->keystate, WM_MBUTTONUP, wparam );
+ if (flags & MOUSEEVENTF_XDOWN)
+ update_input_key_state( desktop, desktop->keystate, WM_XBUTTONDOWN, wparam );
+ if (flags & MOUSEEVENTF_XUP)
+ update_input_key_state( desktop, desktop->keystate, WM_XBUTTONUP, wparam );
+}
+
/* release the hardware message currently being processed by the given thread */
static void release_hardware_message( struct msg_queue *queue, unsigned int hw_id,
int remove )
@@ -1650,6 +1681,7 @@ static int queue_rawinput_message( struct process* process, void *arg )
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;
@@ -1721,6 +1753,12 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
release_object( foreground );
}
+ 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;
@@ -1755,6 +1793,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;
@@ -1848,6 +1887,12 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
release_object( foreground );
}
+ 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;
More information about the wine-cvs
mailing list