From ccd0bc4ccdd9174a49c71762713a9d42f39a7e9a Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 10 Jan 2020 08:20:14 +1100 Subject: [PATCH] Updated user32-rawinput-nolegacy patchset Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48433 --- patches/patchinstall.sh | 2 + ...ra-data-for-hardware_msg_data-messag.patch | 30 ++++---- ...sktop-cursor-pos-even-if-RIDEV_NOLEG.patch | 76 +++++++++++++++++++ 3 files changed, 93 insertions(+), 15 deletions(-) create mode 100644 patches/user32-rawinput-nolegacy/0005-server-Update-desktop-cursor-pos-even-if-RIDEV_NOLEG.patch diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 1028198d..fadcc4b4 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -6609,11 +6609,13 @@ if test "$enable_user32_rawinput_nolegacy" -eq 1; then patch_apply user32-rawinput-nolegacy/0002-user32-Add-support-for-RIDEV_NOLEGACY-flag-in-Regist.patch patch_apply user32-rawinput-nolegacy/0003-dinput-Set-RIDEV_INPUTSINK-flag-only-when-DISCL_BACK.patch patch_apply user32-rawinput-nolegacy/0004-dinput-Set-correct-rawinput-flags-for-DISCL_EXCLUSIV.patch + patch_apply user32-rawinput-nolegacy/0005-server-Update-desktop-cursor-pos-even-if-RIDEV_NOLEG.patch ( printf '%s\n' '+ { "Rémi Bernon", "dinput8/tests: Add test for DISCL_EXCLUSIVE flag interaction with rawinput.", 1 },'; printf '%s\n' '+ { "Derek Lesho", "user32: Add support for RIDEV_NOLEGACY flag in RegisterRawInputDevices.", 1 },'; printf '%s\n' '+ { "Rémi Bernon", "dinput: Set RIDEV_INPUTSINK flag only when DISCL_BACKGROUND is requested.", 1 },'; printf '%s\n' '+ { "Rémi Bernon", "dinput: Set correct rawinput flags for DISCL_EXCLUSIVE.", 1 },'; + printf '%s\n' '+ { "Rémi Bernon", "server: Update desktop cursor pos even if RIDEV_NOLEGACY flag is set.", 1 },'; ) >> "$patchlist" fi diff --git a/patches/user32-rawinput-hid/0002-server-Allow-extra-data-for-hardware_msg_data-messag.patch b/patches/user32-rawinput-hid/0002-server-Allow-extra-data-for-hardware_msg_data-messag.patch index f02292e0..476dac09 100644 --- a/patches/user32-rawinput-hid/0002-server-Allow-extra-data-for-hardware_msg_data-messag.patch +++ b/patches/user32-rawinput-hid/0002-server-Allow-extra-data-for-hardware_msg_data-messag.patch @@ -1,7 +1,7 @@ -From 56609fdaab139ec8718cf0c4963e6990c9b88003 Mon Sep 17 00:00:00 2001 +From 9aca9116db8ca84eea5be6a67b748ff6fdde9a31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 19 Sep 2019 09:20:44 +0200 -Subject: [PATCH 2/5] server: Allow extra data for hardware_msg_data message. +Subject: [PATCH] server: Allow extra data for hardware_msg_data message. The RIM_TYPEHID messages will have to carry the variable length HID report. @@ -10,7 +10,7 @@ report. 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/server/queue.c b/server/queue.c -index 3ed7e82a906..feff00e2b9f 100644 +index 9dca519cad2..364c8e43485 100644 --- a/server/queue.c +++ b/server/queue.c @@ -398,13 +398,13 @@ static int assign_thread_input( struct thread *thread, struct thread_input *new_ @@ -41,16 +41,16 @@ index 3ed7e82a906..feff00e2b9f 100644 msg_data->info = info; msg_data->source = source; return msg; -@@ -430,7 +430,7 @@ static void set_cursor_pos( struct desktop *desktop, int x, int y ) - if (current->process->rawinput_mouse && - current->process->rawinput_mouse->flags & RIDEV_NOLEGACY) return; +@@ -448,7 +448,7 @@ static void set_cursor_pos( struct desktop *desktop, int x, int y ) + return; + } - if (!(msg = alloc_hardware_message( 0, source, get_tick_count() ))) return; + if (!(msg = alloc_hardware_message( 0, source, get_tick_count(), 0 ))) return; msg->msg = WM_MOUSEMOVE; msg->x = x; -@@ -1743,6 +1743,8 @@ struct rawinput_message +@@ -1756,6 +1756,8 @@ struct rawinput_message struct hw_msg_source source; unsigned int time; struct hardware_msg_data data; @@ -59,7 +59,7 @@ index 3ed7e82a906..feff00e2b9f 100644 }; static int queue_rawinput_message( struct process* process, void* user ) -@@ -1752,6 +1754,7 @@ static int queue_rawinput_message( struct process* process, void* user ) +@@ -1765,6 +1767,7 @@ static int queue_rawinput_message( struct process* process, void* user ) struct desktop *desktop = NULL; struct thread *thread = NULL, *foreground = NULL; struct message *msg; @@ -67,7 +67,7 @@ index 3ed7e82a906..feff00e2b9f 100644 if (raw_msg->data.rawinput.type == RIM_TYPEMOUSE) device = process->rawinput_mouse; -@@ -1774,14 +1777,18 @@ static int queue_rawinput_message( struct process* process, void* user ) +@@ -1787,14 +1790,18 @@ static int queue_rawinput_message( struct process* process, void* user ) thread->process != foreground->process) goto done; @@ -88,7 +88,7 @@ index 3ed7e82a906..feff00e2b9f 100644 queue_hardware_message( desktop, msg, 0 ); -@@ -1850,9 +1857,11 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons +@@ -1863,9 +1870,11 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons if (req_flags & SEND_HWMSG_RAWINPUT) { @@ -103,7 +103,7 @@ index 3ed7e82a906..feff00e2b9f 100644 msg_data = &raw_msg.data; msg_data->info = input->mouse.info; -@@ -1879,7 +1888,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons +@@ -1895,7 +1904,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons if (!(flags & (1 << i))) continue; flags &= ~(1 << i); @@ -112,7 +112,7 @@ index 3ed7e82a906..feff00e2b9f 100644 msg_data = msg->data; msg->win = get_user_full_handle( win ); -@@ -1983,9 +1992,11 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c +@@ -1999,9 +2008,11 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c if (req_flags & SEND_HWMSG_RAWINPUT) { @@ -127,7 +127,7 @@ index 3ed7e82a906..feff00e2b9f 100644 msg_data = &raw_msg.data; msg_data->info = input->kbd.info; -@@ -2006,7 +2017,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c +@@ -2022,7 +2033,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c if ((device = current->process->rawinput_kbd) && (device->flags & RIDEV_NOLEGACY)) return 0; @@ -136,7 +136,7 @@ index 3ed7e82a906..feff00e2b9f 100644 msg_data = msg->data; msg->win = get_user_full_handle( win ); -@@ -2044,7 +2055,7 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_ +@@ -2060,7 +2071,7 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_ struct hw_msg_source source = { IMDT_UNAVAILABLE, origin }; struct message *msg; @@ -146,5 +146,5 @@ index 3ed7e82a906..feff00e2b9f 100644 msg->win = get_user_full_handle( win ); msg->msg = input->hw.msg; -- -2.24.1 +2.17.1 diff --git a/patches/user32-rawinput-nolegacy/0005-server-Update-desktop-cursor-pos-even-if-RIDEV_NOLEG.patch b/patches/user32-rawinput-nolegacy/0005-server-Update-desktop-cursor-pos-even-if-RIDEV_NOLEG.patch new file mode 100644 index 00000000..91679553 --- /dev/null +++ b/patches/user32-rawinput-nolegacy/0005-server-Update-desktop-cursor-pos-even-if-RIDEV_NOLEG.patch @@ -0,0 +1,76 @@ +From a09689c9022603d7c7d41e6095a400fbf7841869 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?R=C3=A9mi=20Bernon?= +Date: Thu, 9 Jan 2020 17:50:32 +0100 +Subject: [PATCH] server: Update desktop cursor pos even if RIDEV_NOLEGACY flag + is set. + +--- + server/queue.c | 30 +++++++++++++++++++++++------- + 1 file changed, 23 insertions(+), 7 deletions(-) + +diff --git a/server/queue.c b/server/queue.c +index f5dc06100d1..4b2fef8a20a 100644 +--- a/server/queue.c ++++ b/server/queue.c +@@ -421,6 +421,20 @@ static struct message *alloc_hardware_message( lparam_t info, struct hw_msg_sour + return msg; + } + ++static int update_desktop_cursor_pos( struct desktop *desktop, int x, int y ) ++{ ++ int updated; ++ ++ x = max( min( x, desktop->cursor.clip.right - 1 ), desktop->cursor.clip.left ); ++ y = max( min( y, desktop->cursor.clip.bottom - 1 ), desktop->cursor.clip.top ); ++ updated = (desktop->cursor.x != x || desktop->cursor.y != y); ++ desktop->cursor.x = x; ++ desktop->cursor.y = y; ++ desktop->cursor.last_change = get_tick_count(); ++ ++ return updated; ++} ++ + /* set the cursor position and queue the corresponding mouse message */ + static void set_cursor_pos( struct desktop *desktop, int x, int y ) + { +@@ -428,7 +442,11 @@ static void set_cursor_pos( struct desktop *desktop, int x, int y ) + struct message *msg; + + if (current->process->rawinput_mouse && +- current->process->rawinput_mouse->flags & RIDEV_NOLEGACY) return; ++ current->process->rawinput_mouse->flags & RIDEV_NOLEGACY) ++ { ++ update_desktop_cursor_pos( desktop, x, y ); ++ return; ++ } + + if (!(msg = alloc_hardware_message( 0, source, get_tick_count() ))) return; + +@@ -1634,12 +1652,7 @@ static void queue_hardware_message( struct desktop *desktop, struct message *msg + { + if (msg->msg == WM_MOUSEMOVE) + { +- int x = max( min( msg->x, desktop->cursor.clip.right - 1 ), desktop->cursor.clip.left ); +- int y = max( min( msg->y, desktop->cursor.clip.bottom - 1 ), desktop->cursor.clip.top ); +- if (desktop->cursor.x != x || desktop->cursor.y != y) always_queue = 1; +- desktop->cursor.x = x; +- desktop->cursor.y = y; +- desktop->cursor.last_change = get_tick_count(); ++ if (update_desktop_cursor_pos( desktop, msg->x, msg->y )) always_queue = 1; + } + if (desktop->keystate[VK_LBUTTON] & 0x80) msg->wparam |= MK_LBUTTON; + if (desktop->keystate[VK_MBUTTON] & 0x80) msg->wparam |= MK_MBUTTON; +@@ -1871,7 +1884,10 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons + if (!(req_flags & SEND_HWMSG_WINDOW)) + return 0; + if ((device = current->process->rawinput_mouse) && (device->flags & RIDEV_NOLEGACY)) ++ { ++ if (flags & MOUSEEVENTF_MOVE) update_desktop_cursor_pos( desktop, x, y ); + return 0; ++ } + + for (i = 0; i < ARRAY_SIZE( messages ); i++) + { +-- +2.25.0.rc1 +