diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 9e190daf..5c0e05c4 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -300,6 +300,7 @@ patch_enable_all () enable_user32_ScrollWindowEx="$1" enable_user32_ShowWindow="$1" enable_user32_msgbox_Support_WM_COPY_mesg="$1" + enable_user32_rawinput="$1" enable_user32_recursive_activation="$1" enable_uxtheme_CloseThemeClass="$1" enable_uxtheme_GTK_Theming="$1" @@ -1026,6 +1027,9 @@ patch_enable () user32-msgbox-Support-WM_COPY-mesg) enable_user32_msgbox_Support_WM_COPY_mesg="$2" ;; + user32-rawinput) + enable_user32_rawinput="$2" + ;; user32-recursive-activation) enable_user32_recursive_activation="$2" ;; @@ -6399,6 +6403,46 @@ if test "$enable_user32_msgbox_Support_WM_COPY_mesg" -eq 1; then ) >> "$patchlist" fi +# Patchset user32-rawinput +# | +# | This patchset fixes the following Wine bugs: +# | * [#42675] - Overwatch - Phantom mouse input / view pulled up to ceiling. +# | * [#45882] - Raw Input should use untransformed mouse values (affects Overwatch, several Source games). +# | * [#47457] - Mouse click-click-hold is treated as double click, causing gun jam in Overwatch. +# | * [#42631] - user32: Add Raw Input support. +# | +# | Modified files: +# | * dlls/user32/input.c, dlls/user32/message.c, dlls/user32/rawinput.c, dlls/user32/user32.spec, dlls/winex11.drv/event.c, +# | dlls/winex11.drv/mouse.c, dlls/winex11.drv/x11drv.h, dlls/winex11.drv/x11drv_main.c, include/winuser.h, +# | server/protocol.def, server/queue.c, server/trace.c, tools/make_requests +# | +if test "$enable_user32_rawinput" -eq 1; then + patch_apply user32-rawinput/0001-user32-Add-support-for-RIDEV_NOLEGACY-flag.patch + patch_apply user32-rawinput/0002-server-Move-mouse-raw-input-message-faking-from-user.patch + patch_apply user32-rawinput/0003-server-Add-request-for-sending-native-raw-input-mess.patch + patch_apply user32-rawinput/0004-user32-Add-helper-for-input-drivers-to-submit-native.patch + patch_apply user32-rawinput/0005-server-Don-t-emulate-rawinput-mouse-events-if-native.patch + patch_apply user32-rawinput/0006-winex11.drv-Directly-listen-to-master-XInput2-device.patch + patch_apply user32-rawinput/0007-winex11.drv-Implement-native-mouse-movement-raw-inpu.patch + patch_apply user32-rawinput/0008-winex11.drv-Implement-native-mouse-button-raw-input-.patch + patch_apply user32-rawinput/0009-winex11.drv-Don-t-react-to-small-slow-mouse-movement.patch + patch_apply user32-rawinput/0010-server-Implement-RIDEV_INPUTSINK-flag.patch + patch_apply user32-rawinput/0011-winex11.drv-HACK-XWayland-workaround.patch + ( + printf '%s\n' '+ { "Derek Lesho", "user32: Add support for RIDEV_NOLEGACY flag.", 1 },'; + printf '%s\n' '+ { "Derek Lesho", "server: Move mouse raw-input message faking from user32 to wineserver.", 1 },'; + printf '%s\n' '+ { "Derek Lesho", "server: Add request for sending native raw-input messages.", 1 },'; + printf '%s\n' '+ { "Derek Lesho", "user32: Add helper for input drivers to submit native rawinput msgs.", 1 },'; + printf '%s\n' '+ { "Derek Lesho", "server: Don'\''t emulate rawinput mouse events if native exist.", 1 },'; + printf '%s\n' '+ { "RĂ©mi Bernon", "winex11.drv: Directly listen to master XInput2 devices if supported.", 1 },'; + printf '%s\n' '+ { "Derek Lesho", "winex11.drv: Implement native mouse-movement raw-input using RawMotion.", 1 },'; + printf '%s\n' '+ { "Derek Lesho", "winex11.drv: Implement native mouse-button raw-input using RawButton*.", 1 },'; + printf '%s\n' '+ { "Jordan Galby", "winex11.drv: Don'\''t react to small slow mouse movements.", 1 },'; + printf '%s\n' '+ { "Derek Lesho", "server: Implement RIDEV_INPUTSINK flag.", 1 },'; + printf '%s\n' '+ { "Derek Lesho", "winex11.drv: [HACK] XWayland workaround.", 1 },'; + ) >> "$patchlist" +fi + # Patchset user32-recursive-activation # | # | This patchset fixes the following Wine bugs: diff --git a/patches/user32-rawinput/0001-user32-Add-support-for-RIDEV_NOLEGACY-flag.patch b/patches/user32-rawinput/0001-user32-Add-support-for-RIDEV_NOLEGACY-flag.patch index 55168c9c..3b625f02 100644 --- a/patches/user32-rawinput/0001-user32-Add-support-for-RIDEV_NOLEGACY-flag.patch +++ b/patches/user32-rawinput/0001-user32-Add-support-for-RIDEV_NOLEGACY-flag.patch @@ -1,7 +1,7 @@ -From 743222b233535c172c4fdba1e878251d3be038e1 Mon Sep 17 00:00:00 2001 +From 5b72eb081757521ee2f86aad97c36ed751733b1d Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Tue, 25 Jun 2019 16:23:02 -0400 -Subject: [PATCH 01/10] user32: Add support for RIDEV_NOLEGACY flag. +Subject: [PATCH 01/11] user32: Add support for RIDEV_NOLEGACY flag. Signed-off-by: Derek Lesho --- @@ -10,10 +10,10 @@ Signed-off-by: Derek Lesho 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c -index 94cf7a9a5d2..661a0e3b255 100644 +index 49cf9f73a0..58480b8ae7 100644 --- a/dlls/user32/rawinput.c +++ b/dlls/user32/rawinput.c -@@ -282,7 +282,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH RegisterRawInputDevices(RAWINPUTDEVICE *devices, U +@@ -271,7 +271,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); @@ -23,10 +23,10 @@ index 94cf7a9a5d2..661a0e3b255 100644 d[i].usage_page = devices[i].usUsagePage; diff --git a/server/queue.c b/server/queue.c -index af65b5f6b4c..94c612efb03 100644 +index 96587d11d1..40a566a2b7 100644 --- a/server/queue.c +++ b/server/queue.c -@@ -427,6 +427,9 @@ static void set_cursor_pos( struct desktop *desktop, int x, int y ) +@@ -372,6 +372,9 @@ static void set_cursor_pos( struct desktop *desktop, int x, int y ) static const struct hw_msg_source source = { IMDT_UNAVAILABLE, IMO_SYSTEM }; struct message *msg; @@ -36,7 +36,7 @@ index af65b5f6b4c..94c612efb03 100644 if (!(msg = alloc_hardware_message( 0, source, get_tick_count() ))) return; msg->msg = WM_MOUSEMOVE; -@@ -1808,6 +1811,9 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons +@@ -1670,6 +1673,9 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons queue_hardware_message( desktop, msg, 0 ); } @@ -46,7 +46,7 @@ index af65b5f6b4c..94c612efb03 100644 for (i = 0; i < ARRAY_SIZE( messages ); i++) { if (!messages[i]) continue; -@@ -1933,6 +1939,9 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c +@@ -1795,6 +1801,9 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c queue_hardware_message( desktop, msg, 0 ); } @@ -57,5 +57,5 @@ index af65b5f6b4c..94c612efb03 100644 msg_data = msg->data; -- -2.17.1 +2.23.0 diff --git a/patches/user32-rawinput/0002-server-Move-mouse-raw-input-message-faking-from-user.patch b/patches/user32-rawinput/0002-server-Move-mouse-raw-input-message-faking-from-user.patch index 0b7e641e..b7a83219 100644 --- a/patches/user32-rawinput/0002-server-Move-mouse-raw-input-message-faking-from-user.patch +++ b/patches/user32-rawinput/0002-server-Move-mouse-raw-input-message-faking-from-user.patch @@ -1,7 +1,7 @@ -From 06678989a4cdc051fc86cfc93ca9f91f26ea8d3e Mon Sep 17 00:00:00 2001 +From 8cd2c66e39dee6edb4dda9faef5601785a8eb9eb Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Tue, 25 Jun 2019 20:47:20 -0400 -Subject: [PATCH 02/10] server: Move mouse raw-input message faking from user32 +Subject: [PATCH 02/11] server: Move mouse raw-input message faking from user32 to wineserver. Signed-off-by: Derek Lesho @@ -12,7 +12,7 @@ Signed-off-by: Derek Lesho 3 files changed, 52 insertions(+), 49 deletions(-) diff --git a/dlls/user32/message.c b/dlls/user32/message.c -index cc25d2f6c2f..f2442670f44 100644 +index 43ce77c2dd..b6dd7d5932 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -2295,54 +2295,14 @@ static BOOL process_rawinput_message( MSG *msg, const struct hardware_msg_data * @@ -74,10 +74,10 @@ index cc25d2f6c2f..f2442670f44 100644 rawinput->data.mouse.ulRawButtons = 0; rawinput->data.mouse.lLastX = msg_data->rawinput.mouse.x; diff --git a/server/protocol.def b/server/protocol.def -index fab68f9d8fe..e7e6b817172 100644 +index 8157199f2f..f7e0008b04 100644 --- a/server/protocol.def +++ b/server/protocol.def -@@ -316,10 +316,11 @@ struct hardware_msg_data +@@ -304,10 +304,11 @@ struct hardware_msg_data } kbd; struct { @@ -94,10 +94,10 @@ index fab68f9d8fe..e7e6b817172 100644 } rawinput; }; diff --git a/server/queue.c b/server/queue.c -index 94c612efb03..7eecd286fab 100644 +index 40a566a2b7..b58dfd5213 100644 --- a/server/queue.c +++ b/server/queue.c -@@ -1765,6 +1765,16 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons +@@ -1627,6 +1627,16 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons WM_MOUSEHWHEEL /* 0x1000 = MOUSEEVENTF_HWHEEL */ }; @@ -114,7 +114,7 @@ index 94c612efb03..7eecd286fab 100644 desktop->cursor.last_change = get_tick_count(); flags = input->mouse.flags; time = input->mouse.time; -@@ -1802,11 +1812,43 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons +@@ -1664,11 +1674,43 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons msg->wparam = RIM_INPUT; msg->lparam = 0; @@ -161,5 +161,5 @@ index 94c612efb03..7eecd286fab 100644 queue_hardware_message( desktop, msg, 0 ); } -- -2.17.1 +2.23.0 diff --git a/patches/user32-rawinput/0003-server-Add-request-for-sending-native-raw-input-mess.patch b/patches/user32-rawinput/0003-server-Add-request-for-sending-native-raw-input-mess.patch index 6d2b02b5..391cccb1 100644 --- a/patches/user32-rawinput/0003-server-Add-request-for-sending-native-raw-input-mess.patch +++ b/patches/user32-rawinput/0003-server-Add-request-for-sending-native-raw-input-mess.patch @@ -1,22 +1,36 @@ -From 0cd4df0e1c8cb9859933b2131568d6da2bea5a9f Mon Sep 17 00:00:00 2001 +From 2fd717d14d73b529d09aa786346cc2d205f29137 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Tue, 25 Jun 2019 21:24:12 -0400 -Subject: [PATCH 03/10] server: Add request for sending native raw-input +Subject: [PATCH 03/11] server: Add request for sending native raw-input messages. Signed-off-by: Derek Lesho --- - server/protocol.def | 50 ++++++++++++++++++++++++++++----------------- - server/queue.c | 48 +++++++++++++++++++++++++++++++++++++++++++ - server/trace.c | 21 +++++++++++++++++++ - tools/make_requests | 1 + - 4 files changed, 101 insertions(+), 19 deletions(-) + dlls/user32/message.c | 2 +- + server/protocol.def | 51 +++++++++++++++++++++++++++---------------- + server/queue.c | 49 +++++++++++++++++++++++++++++++++++++++++ + server/trace.c | 21 ++++++++++++++++++ + tools/make_requests | 1 + + 5 files changed, 104 insertions(+), 20 deletions(-) +diff --git a/dlls/user32/message.c b/dlls/user32/message.c +index b6dd7d5932..4c8d485954 100644 +--- a/dlls/user32/message.c ++++ b/dlls/user32/message.c +@@ -2299,7 +2299,7 @@ static BOOL process_rawinput_message( MSG *msg, const struct hardware_msg_data * + rawinput->header.hDevice = WINE_MOUSE_HANDLE; + rawinput->header.wParam = 0; + +- rawinput->data.mouse.usFlags = MOUSE_MOVE_RELATIVE; ++ rawinput->data.mouse.usFlags = msg_data->rawinput.mouse.flags; + + rawinput->data.mouse.u.s.usButtonFlags = msg_data->rawinput.mouse.button_flags; + rawinput->data.mouse.u.s.usButtonData = msg_data->rawinput.mouse.button_data; diff --git a/server/protocol.def b/server/protocol.def -index e7e6b817172..6fe4f3040ba 100644 +index f7e0008b04..009e0b2593 100644 --- a/server/protocol.def +++ b/server/protocol.def -@@ -298,31 +298,38 @@ struct hw_msg_source +@@ -286,31 +286,39 @@ struct hw_msg_source unsigned int origin; /* source origin (IMO_* values) */ }; @@ -33,6 +47,7 @@ index e7e6b817172..6fe4f3040ba 100644 + struct + { + int type; /* RIM_TYPEMOUSE */ ++ unsigned short flags; /* event flags */ + int x; /* x coordinate */ + int y; /* y coordinate */ + unsigned short button_flags; /* mouse button */ @@ -74,7 +89,7 @@ index e7e6b817172..6fe4f3040ba 100644 }; struct callback_msg_data -@@ -2361,6 +2368,11 @@ enum message_type +@@ -2318,6 +2326,11 @@ enum message_type #define SEND_HWMSG_INJECTED 0x01 @@ -87,10 +102,10 @@ index e7e6b817172..6fe4f3040ba 100644 @REQ(get_message) unsigned int flags; /* PM_* flags */ diff --git a/server/queue.c b/server/queue.c -index 7eecd286fab..edd577bcdc7 100644 +index b58dfd5213..246fcffd23 100644 --- a/server/queue.c +++ b/server/queue.c -@@ -2564,6 +2564,54 @@ DECL_HANDLER(send_hardware_message) +@@ -2421,6 +2421,55 @@ DECL_HANDLER(send_hardware_message) release_object( desktop ); } @@ -128,6 +143,7 @@ index 7eecd286fab..edd577bcdc7 100644 + msg_data->rawinput.mouse.y = req->input.mouse.y; + msg_data->rawinput.mouse.button_flags = req->input.mouse.button_flags; + msg_data->rawinput.mouse.button_data = req->input.mouse.button_data; ++ msg_data->rawinput.mouse.flags = req->input.mouse.flags; + + queue_hardware_message( desktop, msg, 0 ); + @@ -146,7 +162,7 @@ index 7eecd286fab..edd577bcdc7 100644 DECL_HANDLER(post_quit_message) { diff --git a/server/trace.c b/server/trace.c -index 9078acd0867..5973bbe36f4 100644 +index 0df649ea29..4fbfee88c8 100644 --- a/server/trace.c +++ b/server/trace.c @@ -405,6 +405,27 @@ static void dump_hw_input( const char *prefix, const hw_input_t *input ) @@ -158,9 +174,9 @@ index 9078acd0867..5973bbe36f4 100644 + switch (rawinput->type) + { + case RIM_TYPEMOUSE: -+ fprintf( stderr, "%s{type=MOUSE,x=%d,y=%d,button_flags=%04hx,button_data=%04hx}", -+ prefix, rawinput->mouse.x, rawinput->mouse.y, rawinput->mouse.button_flags, -+ rawinput->mouse.button_data); ++ fprintf( stderr, "%s{type=MOUSE,flags=%04hx,x=%d,y=%d,button_flags=%04hx,button_data=%04hx}", ++ prefix, rawinput->mouse.flags, rawinput->mouse.x, rawinput->mouse.y, ++ rawinput->mouse.button_flags, rawinput->mouse.button_data); + break; + case RIM_TYPEKEYBOARD: + fprintf( stderr, "%s{type=KEYBOARD}\n", prefix); @@ -178,17 +194,17 @@ index 9078acd0867..5973bbe36f4 100644 { fprintf( stderr, "%s%d.%u", prefix, luid->high_part, luid->low_part ); diff --git a/tools/make_requests b/tools/make_requests -index faeabe5852d..8b1f1a263b9 100755 +index faeabe5852..a6f12af041 100755 --- a/tools/make_requests +++ b/tools/make_requests @@ -53,6 +53,7 @@ my %formats = "ioctl_code_t" => [ 4, 4, "&dump_ioctl_code" ], "client_cpu_t" => [ 4, 4, "&dump_client_cpu" ], "hw_input_t" => [ 32, 8, "&dump_hw_input" ], -+ "hw_rawinput_t" => [ 16, 8, "&dump_hw_rawinput" ] ++ "hw_rawinput_t" => [ 20, 4, "&dump_hw_rawinput" ] ); my @requests = (); -- -2.17.1 +2.23.0 diff --git a/patches/user32-rawinput/0004-user32-Add-helper-for-input-drivers-to-submit-native.patch b/patches/user32-rawinput/0004-user32-Add-helper-for-input-drivers-to-submit-native.patch index b450c294..ee8a49ef 100644 --- a/patches/user32-rawinput/0004-user32-Add-helper-for-input-drivers-to-submit-native.patch +++ b/patches/user32-rawinput/0004-user32-Add-helper-for-input-drivers-to-submit-native.patch @@ -1,7 +1,7 @@ -From 507b928e640284dd7a3e83ab974a25eeaeee25e8 Mon Sep 17 00:00:00 2001 +From 1f278c6a5f906910c08e6e122850c7df00f30b7a Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Tue, 25 Jun 2019 21:28:54 -0400 -Subject: [PATCH 04/10] user32: Add helper for input drivers to submit native +Subject: [PATCH 04/11] user32: Add helper for input drivers to submit native rawinput msgs. Signed-off-by: Derek Lesho @@ -12,7 +12,7 @@ Signed-off-by: Derek Lesho 3 files changed, 32 insertions(+) diff --git a/dlls/user32/input.c b/dlls/user32/input.c -index a45d7fe90a9..e05f436005f 100644 +index 8b2ae805aa..9b9cc4f0d7 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -33,6 +33,7 @@ @@ -37,11 +37,11 @@ index a45d7fe90a9..e05f436005f 100644 + switch (raw_input->header.dwType) + { + case RIM_TYPEMOUSE: -+ if (raw_input->data.mouse.usFlags || -+ raw_input->data.mouse.ulRawButtons || ++ if (raw_input->data.mouse.ulRawButtons || + raw_input->data.mouse.ulExtraInformation) + FIXME("Unhandled parameters\n"); + ++ req->input.mouse.flags = raw_input->data.mouse.usFlags; + req->input.mouse.x = raw_input->data.mouse.lLastX; + req->input.mouse.y = raw_input->data.mouse.lLastY; + req->input.mouse.button_flags = raw_input->data.mouse.u.s.usButtonFlags; @@ -60,7 +60,7 @@ index a45d7fe90a9..e05f436005f 100644 /*********************************************************************** * update_mouse_coords diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec -index 6d70df366eb..49df59572fe 100644 +index f9a4ae26df..3311dcd685 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -833,4 +833,5 @@ @@ -70,7 +70,7 @@ index 6d70df366eb..49df59572fe 100644 +@ cdecl __wine_send_raw_input(ptr) @ cdecl __wine_set_pixel_format(long long) diff --git a/include/winuser.h b/include/winuser.h -index 51c73d25c2f..259db275c49 100644 +index 51c73d25c2..259db275c4 100644 --- a/include/winuser.h +++ b/include/winuser.h @@ -4390,6 +4390,7 @@ WORD WINAPI SYSTEM_KillSystemTimer( WORD ); @@ -82,5 +82,5 @@ index 51c73d25c2f..259db275c49 100644 #ifdef __cplusplus -- -2.17.1 +2.23.0 diff --git a/patches/user32-rawinput/0005-server-Don-t-emulate-rawinput-mouse-events-if-native.patch b/patches/user32-rawinput/0005-server-Don-t-emulate-rawinput-mouse-events-if-native.patch index a8c8e7a3..e348b744 100644 --- a/patches/user32-rawinput/0005-server-Don-t-emulate-rawinput-mouse-events-if-native.patch +++ b/patches/user32-rawinput/0005-server-Don-t-emulate-rawinput-mouse-events-if-native.patch @@ -1,7 +1,7 @@ -From 82c8cec6e0f28592603b9b66402178422497f9db Mon Sep 17 00:00:00 2001 +From d7343cb3d9c68873003bbf92315dad23808221c4 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Tue, 25 Jun 2019 21:58:34 -0400 -Subject: [PATCH 05/10] server: Don't emulate rawinput mouse events if native +Subject: [PATCH 05/11] server: Don't emulate rawinput mouse events if native exist. Signed-off-by: Derek Lesho @@ -10,10 +10,10 @@ Signed-off-by: Derek Lesho 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/queue.c b/server/queue.c -index edd577bcdc7..7ddee7c91ed 100644 +index 246fcffd23..c9446f7f4b 100644 --- a/server/queue.c +++ b/server/queue.c -@@ -1737,6 +1737,8 @@ static int send_hook_ll_message( struct desktop *desktop, struct message *hardwa +@@ -1599,6 +1599,8 @@ static int send_hook_ll_message( struct desktop *desktop, struct message *hardwa return 1; } @@ -22,7 +22,7 @@ index edd577bcdc7..7ddee7c91ed 100644 /* 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 ) -@@ -1802,7 +1804,8 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons +@@ -1664,7 +1666,8 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons y = desktop->cursor.y; } @@ -32,7 +32,7 @@ index edd577bcdc7..7ddee7c91ed 100644 { if (!(msg = alloc_hardware_message( input->mouse.info, source, time ))) return 0; msg_data = msg->data; -@@ -2578,6 +2581,7 @@ DECL_HANDLER(send_rawinput_message) +@@ -2435,6 +2438,7 @@ DECL_HANDLER(send_rawinput_message) switch (req->input.type) { case RIM_TYPEMOUSE: @@ -41,5 +41,5 @@ index edd577bcdc7..7ddee7c91ed 100644 { struct thread *thread = device->target ? get_window_thread( device->target ) : NULL; -- -2.17.1 +2.23.0 diff --git a/patches/user32-rawinput/0006-winex11.drv-Directly-listen-to-master-XInput2-device.patch b/patches/user32-rawinput/0006-winex11.drv-Directly-listen-to-master-XInput2-device.patch index 6dac177f..28720f09 100644 --- a/patches/user32-rawinput/0006-winex11.drv-Directly-listen-to-master-XInput2-device.patch +++ b/patches/user32-rawinput/0006-winex11.drv-Directly-listen-to-master-XInput2-device.patch @@ -1,7 +1,7 @@ -From 6e594b2977c582dad95043512ab2828cc2dee52e Mon Sep 17 00:00:00 2001 +From 7bc3e25b06e580c82ca1289f1758a980cfd51543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 23 Jul 2019 14:10:44 +0200 -Subject: [PATCH 06/10] winex11.drv: Directly listen to master XInput2 devices +Subject: [PATCH 06/11] winex11.drv: Directly listen to master XInput2 devices if supported Under XInput2 protocol version < 2.1, raw events should not be received @@ -21,10 +21,10 @@ Signed-off-by: Derek Lesho 2 files changed, 42 insertions(+), 56 deletions(-) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c -index 6b604fc9f15..e1da2b62148 100644 +index 5c465aa033..1e64f0d2a3 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c -@@ -274,46 +274,6 @@ enum event_merge_action +@@ -271,46 +271,6 @@ enum event_merge_action MERGE_IGNORE /* ignore the new event, keep the old one */ }; @@ -71,7 +71,7 @@ index 6b604fc9f15..e1da2b62148 100644 /*********************************************************************** * merge_events * -@@ -365,7 +325,7 @@ static enum event_merge_action merge_events( XEvent *prev, XEvent *next ) +@@ -362,7 +322,7 @@ static enum event_merge_action merge_events( XEvent *prev, XEvent *next ) if (next->xcookie.extension != xinput2_opcode) break; if (next->xcookie.evtype != XI_RawMotion) break; if (x11drv_thread_data()->warp_serial) break; @@ -81,10 +81,10 @@ index 6b604fc9f15..e1da2b62148 100644 } break; diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c -index 3c49762cee4..d55e208490e 100644 +index f737a306a5..90fd11831b 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c -@@ -133,6 +133,8 @@ static Cursor create_cursor( HANDLE handle ); +@@ -130,6 +130,8 @@ static Cursor create_cursor( HANDLE handle ); #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H static BOOL xinput2_available; @@ -93,7 +93,7 @@ index 3c49762cee4..d55e208490e 100644 static BOOL broken_rawevents; #define MAKE_FUNCPTR(f) static typeof(f) * p##f MAKE_FUNCPTR(XIGetClientPointer); -@@ -304,8 +306,11 @@ static void enable_xinput2(void) +@@ -301,8 +303,11 @@ static void enable_xinput2(void) if (data->xi2_state == xi_unknown) { @@ -107,7 +107,7 @@ index 3c49762cee4..d55e208490e 100644 else { data->xi2_state = xi_unavailable; -@@ -317,12 +322,20 @@ static void enable_xinput2(void) +@@ -314,11 +319,19 @@ static void enable_xinput2(void) mask.mask = mask_bits; mask.mask_len = sizeof(mask_bits); @@ -117,20 +117,19 @@ index 3c49762cee4..d55e208490e 100644 - XISetMask( mask_bits, XI_DeviceChanged ); XISetMask( mask_bits, XI_RawMotion ); XISetMask( mask_bits, XI_ButtonPress ); - ++ XISetMask( mask_bits, XI_DeviceChanged ); ++ + /* XInput 2.0 has a problematic behavior where master pointer will + * not send raw events to the root window whenever a grab is active + */ + if (xinput2_version_major == 2 && xinput2_version_minor == 0) + { + mask.deviceid = XIAllDevices; -+ XISetMask( mask_bits, XI_DeviceChanged ); + } -+ + pXISelectEvents( data->display, DefaultRootWindow( data->display ), &mask, 1 ); - pointer_info = pXIQueryDevice( data->display, data->xi2_core_pointer, &count ); -@@ -336,7 +349,7 @@ static void enable_xinput2(void) +@@ -333,7 +346,7 @@ static void enable_xinput2(void) * safe to be obtained statically at enable_xinput2() time. */ if (data->xi2_devices) pXIFreeDeviceInfo( data->xi2_devices ); @@ -139,7 +138,7 @@ index 3c49762cee4..d55e208490e 100644 data->xi2_current_slave = 0; data->xi2_state = xi_enabled; -@@ -359,7 +372,13 @@ static void disable_xinput2(void) +@@ -356,7 +369,13 @@ static void disable_xinput2(void) mask.mask = NULL; mask.mask_len = 0; @@ -154,7 +153,7 @@ index 3c49762cee4..d55e208490e 100644 pXISelectEvents( data->display, DefaultRootWindow( data->display ), &mask, 1 ); pXIFreeDeviceInfo( data->xi2_devices ); -@@ -1823,25 +1842,32 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) +@@ -1735,25 +1754,32 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) if (!event->valuators.mask_len) return FALSE; if (thread_data->xi2_state != xi_enabled) return FALSE; @@ -197,5 +196,5 @@ index 3c49762cee4..d55e208490e 100644 x_rel = &thread_data->x_rel_valuator; y_rel = &thread_data->y_rel_valuator; -- -2.17.1 +2.23.0 diff --git a/patches/user32-rawinput/0007-winex11.drv-Implement-native-mouse-movement-raw-inpu.patch b/patches/user32-rawinput/0007-winex11.drv-Implement-native-mouse-movement-raw-inpu.patch index 22bf95b9..010070de 100644 --- a/patches/user32-rawinput/0007-winex11.drv-Implement-native-mouse-movement-raw-inpu.patch +++ b/patches/user32-rawinput/0007-winex11.drv-Implement-native-mouse-movement-raw-inpu.patch @@ -1,21 +1,47 @@ -From f270475e7fe23001af3f19d918f290783823be63 Mon Sep 17 00:00:00 2001 +From 5ce9048468f363c5f844a35327aecc40d8304c9b Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Tue, 25 Jun 2019 22:37:34 -0400 -Subject: [PATCH 07/10] winex11.drv: Implement native mouse-movement raw-input - using RawMotion. +Subject: [PATCH] winex11.drv: Implement native mouse-movement raw-input using + RawMotion. Signed-off-by: Derek Lesho --- - dlls/winex11.drv/mouse.c | 66 ++++++++++++++++++++++++++-------- - dlls/winex11.drv/x11drv.h | 4 ++- - dlls/winex11.drv/x11drv_main.c | 4 +++ - 3 files changed, 58 insertions(+), 16 deletions(-) + dlls/winex11.drv/mouse.c | 102 +++++++++++++++++++++++++++------ + dlls/winex11.drv/x11drv.h | 8 ++- + dlls/winex11.drv/x11drv_main.c | 6 ++ + 3 files changed, 97 insertions(+), 19 deletions(-) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c -index d55e208490e..1ec077bca74 100644 +index 23c7c6fb35b..212511fde84 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c -@@ -291,9 +291,9 @@ static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuator +@@ -262,6 +262,8 @@ static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuator + + thread_data->x_rel_valuator.number = -1; + thread_data->y_rel_valuator.number = -1; ++ thread_data->x_abs_valuator.number = -1; ++ thread_data->y_abs_valuator.number = -1; + + for (i = 0; i < n_valuators; i++) + { +@@ -279,6 +281,16 @@ static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuator + { + valuator_data = &thread_data->y_rel_valuator; + } ++ else if (class->label == x11drv_atom( Abs_X ) || ++ (!class->label && class->number == 0 && class->mode == XIModeAbsolute)) ++ { ++ valuator_data = &thread_data->x_abs_valuator; ++ } ++ else if (class->label == x11drv_atom( Abs_Y ) || ++ (!class->label && class->number == 1 && class->mode == XIModeAbsolute)) ++ { ++ valuator_data = &thread_data->y_abs_valuator; ++ } + + if (valuator_data) { + valuator_data->number = class->number; +@@ -291,9 +303,9 @@ static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuator /*********************************************************************** @@ -27,15 +53,17 @@ index d55e208490e..1ec077bca74 100644 { #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H struct x11drv_thread_data *data = x11drv_thread_data(); -@@ -325,7 +325,6 @@ static void enable_xinput2(void) +@@ -324,8 +336,8 @@ static void enable_xinput2(void) + mask.mask_len = sizeof(mask_bits); mask.deviceid = XIAllMasterDevices; memset( mask_bits, 0, sizeof(mask_bits) ); ++ XISetMask( mask_bits, XI_DeviceChanged ); XISetMask( mask_bits, XI_RawMotion ); - XISetMask( mask_bits, XI_ButtonPress ); + XISetMask( mask_bits, XI_DeviceChanged ); /* XInput 2.0 has a problematic behavior where master pointer will - * not send raw events to the root window whenever a grab is active -@@ -357,15 +356,15 @@ static void enable_xinput2(void) +@@ -357,15 +369,15 @@ static void enable_xinput2(void) } /*********************************************************************** @@ -54,7 +82,7 @@ index d55e208490e..1ec077bca74 100644 TRACE( "disabling\n" ); data->xi2_state = xi_disabled; -@@ -390,6 +389,21 @@ static void disable_xinput2(void) +@@ -390,6 +402,21 @@ static void disable_xinput2(void) #endif } @@ -76,7 +104,7 @@ index d55e208490e..1ec077bca74 100644 /*********************************************************************** * grab_clipping_window -@@ -428,9 +442,9 @@ static BOOL grab_clipping_window( const RECT *clip ) +@@ -428,9 +455,9 @@ static BOOL grab_clipping_window( const RECT *clip ) } /* enable XInput2 unless we are already clipping */ @@ -88,7 +116,7 @@ index d55e208490e..1ec077bca74 100644 { WARN( "XInput2 not supported, refusing to clip to %s\n", wine_dbgstr_rect(clip) ); DestroyWindow( msg_hwnd ); -@@ -458,7 +472,7 @@ static BOOL grab_clipping_window( const RECT *clip ) +@@ -458,7 +485,7 @@ static BOOL grab_clipping_window( const RECT *clip ) if (!clipping_cursor) { @@ -97,7 +125,7 @@ index d55e208490e..1ec077bca74 100644 DestroyWindow( msg_hwnd ); return FALSE; } -@@ -539,7 +553,7 @@ LRESULT clip_cursor_notify( HWND hwnd, HWND prev_clip_hwnd, HWND new_clip_hwnd ) +@@ -539,7 +566,7 @@ LRESULT clip_cursor_notify( HWND hwnd, HWND prev_clip_hwnd, HWND new_clip_hwnd ) TRACE( "clip hwnd reset from %p\n", hwnd ); data->clip_hwnd = 0; data->clip_reset = GetTickCount(); @@ -106,7 +134,7 @@ index d55e208490e..1ec077bca74 100644 DestroyWindow( hwnd ); } else if (hwnd == GetForegroundWindow()) /* request to clip */ -@@ -1831,16 +1845,18 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) +@@ -1801,16 +1828,20 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) { XIRawEvent *event = xev->data; const double *values = event->valuators.values; @@ -116,26 +144,33 @@ index d55e208490e..1ec077bca74 100644 + RAWINPUT raw_input; int i; - double dx = 0, dy = 0, val; -+ double dx = 0, dy = 0, raw_dx = 0, raw_dy = 0, val, raw_val; ++ double dx = 0, dy = 0, raw_x = 0, raw_y = 0, val, raw_val; struct x11drv_thread_data *thread_data = x11drv_thread_data(); - struct x11drv_valuator_data *x_rel, *y_rel; +- struct x11drv_valuator_data *x_rel, *y_rel; ++ struct x11drv_valuator_data *x_rel, *y_rel, *x_abs, *y_abs; ++ ++ if ((thread_data->x_rel_valuator.number < 0 || thread_data->y_rel_valuator.number < 0) && ++ (thread_data->x_abs_valuator.number < 0 || thread_data->y_abs_valuator.number < 0) return FALSE; - if (thread_data->x_rel_valuator.number < 0 || thread_data->y_rel_valuator.number < 0) return FALSE; +- if (thread_data->x_rel_valuator.number < 0 || thread_data->y_rel_valuator.number < 0) return FALSE; if (!event->valuators.mask_len) return FALSE; - if (thread_data->xi2_state != xi_enabled) return FALSE; + if (thread_data->xi2_state < xi_enabled) return FALSE; if (xinput2_version_major == 2 && xinput2_version_minor == 0) { -@@ -1872,6 +1888,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) +@@ -1841,7 +1872,10 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) + x_rel = &thread_data->x_rel_valuator; y_rel = &thread_data->y_rel_valuator; ++ x_abs = &thread_data->x_abs_valuator; ++ y_abs = &thread_data->y_abs_valuator; + input.type = INPUT_MOUSE; input.u.mi.mouseData = 0; input.u.mi.dwFlags = MOUSEEVENTF_MOVE; input.u.mi.time = EVENT_x11_time_to_win32_time( event->time ); -@@ -1879,18 +1896,30 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) +@@ -1849,18 +1883,31 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) input.u.mi.dx = 0; input.u.mi.dy = 0; @@ -150,7 +185,8 @@ index d55e208490e..1ec077bca74 100644 + virtual_rect = get_virtual_screen_rect(); - for (i = 0; i <= max ( x_rel->number, y_rel->number ); i++) +- for (i = 0; i <= max ( x_rel->number, y_rel->number ); i++) ++ for (i = 0; i <= max(max(max( x_abs->number, y_abs->number), x_rel->number), y_rel->number); i++) { if (!XIMaskIsSet( event->valuators.mask, i )) continue; val = *values++; @@ -162,20 +198,32 @@ index d55e208490e..1ec077bca74 100644 input.u.mi.dx = val * (virtual_rect.right - virtual_rect.left) / (x_rel->max - x_rel->min); + -+ raw_input.data.mouse.lLastX = raw_dx = raw_val; ++ raw_input.data.mouse.usFlags = MOUSE_MOVE_RELATIVE; ++ raw_input.data.mouse.lLastX = raw_x = raw_val; } if (i == y_rel->number) { -@@ -1898,6 +1927,8 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) +@@ -1868,6 +1915,19 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) if (y_rel->min < y_rel->max) input.u.mi.dy = val * (virtual_rect.bottom - virtual_rect.top) / (y_rel->max - y_rel->min); + -+ raw_input.data.mouse.lLastY = raw_dy = raw_val; ++ raw_input.data.mouse.usFlags = MOUSE_MOVE_RELATIVE; ++ raw_input.data.mouse.lLastY = raw_y = raw_val; ++ } ++ if (i == x_abs->number) ++ { ++ raw_input.data.mouse.usFlags = MOUSE_MOVE_ABSOLUTE | MOUSE_VIRTUAL_DESKTOP; ++ raw_input.data.mouse.lLastX = raw_x = raw_val * (65536 / (x_abs->max - x_abs->min)); ++ } ++ if (i == y_abs->number) ++ { ++ raw_input.data.mouse.usFlags = MOUSE_MOVE_ABSOLUTE | MOUSE_VIRTUAL_DESKTOP; ++ raw_input.data.mouse.lLastY = raw_y = raw_val * (65536 / (y_abs->max - y_abs->min)); } } -@@ -1907,10 +1938,15 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) +@@ -1877,10 +1937,16 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) return FALSE; } @@ -186,7 +234,8 @@ index d55e208490e..1ec077bca74 100644 + __wine_send_input( 0, &input ); + } + -+ TRACE("raw event %f,%f\n", raw_dx, raw_dy); ++ TRACE("raw %s event %f,%f\n", ++ raw_input.data.mouse.usFlags ? "absolute" : "relative", raw_x, raw_y); + __wine_send_raw_input( &raw_input ); - input.type = INPUT_MOUSE; @@ -195,7 +244,7 @@ index d55e208490e..1ec077bca74 100644 } diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h -index 68ef1881a45..81ad38df918 100644 +index b8cfda43410..d79c78ecbc9 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -194,6 +194,8 @@ extern BOOL CDECL X11DRV_UnrealizePalette( HPALETTE hpal ) DECLSPEC_HIDDEN; @@ -207,7 +256,7 @@ index 68ef1881a45..81ad38df918 100644 extern DWORD copy_image_bits( BITMAPINFO *info, BOOL is_r8g8b8, XImage *image, const struct gdi_image_bits *src_bits, struct gdi_image_bits *dst_bits, -@@ -337,7 +339,7 @@ struct x11drv_thread_data +@@ -336,11 +338,13 @@ struct x11drv_thread_data HWND clip_hwnd; /* message window stored in desktop while clipping is active */ DWORD clip_reset; /* time when clipping was last reset */ HKL kbd_layout; /* active keyboard layout */ @@ -216,11 +265,35 @@ index 68ef1881a45..81ad38df918 100644 void *xi2_devices; /* list of XInput2 devices (valid when state is enabled) */ int xi2_device_count; struct x11drv_valuator_data x_rel_valuator; + struct x11drv_valuator_data y_rel_valuator; ++ struct x11drv_valuator_data x_abs_valuator; ++ struct x11drv_valuator_data y_abs_valuator; + int xi2_core_pointer; /* XInput2 core pointer id */ + int xi2_current_slave; /* Current slave driving the Core pointer */ + }; +@@ -427,6 +431,8 @@ enum x11drv_atoms + XATOM_RAW_CAP_HEIGHT, + XATOM_Rel_X, + XATOM_Rel_Y, ++ XATOM_Abs_X, ++ XATOM_Abs_Y, + XATOM_WM_PROTOCOLS, + XATOM_WM_DELETE_WINDOW, + XATOM_WM_STATE, diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c -index 0120ca06a20..cfcf1f19dd1 100644 +index 54de5d8a6b0..9f896bddd9a 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c -@@ -616,6 +616,8 @@ void CDECL X11DRV_ThreadDetach(void) +@@ -120,6 +120,8 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] = + "RAW_CAP_HEIGHT", + "Rel X", + "Rel Y", ++ "Abs X", ++ "Abs Y", + "WM_PROTOCOLS", + "WM_DELETE_WINDOW", + "WM_STATE", +@@ -611,6 +613,8 @@ void CDECL X11DRV_ThreadDetach(void) if (data) { @@ -229,7 +302,7 @@ index 0120ca06a20..cfcf1f19dd1 100644 if (data->xim) XCloseIM( data->xim ); if (data->font_set) XFreeFontSet( data->display, data->font_set ); XCloseDisplay( data->display ); -@@ -689,6 +691,8 @@ struct x11drv_thread_data *x11drv_init_thread_data(void) +@@ -684,6 +688,8 @@ struct x11drv_thread_data *x11drv_init_thread_data(void) if (use_xim) X11DRV_SetupXIM(); @@ -239,5 +312,5 @@ index 0120ca06a20..cfcf1f19dd1 100644 } -- -2.17.1 +2.23.0 diff --git a/patches/user32-rawinput/0008-winex11.drv-Implement-native-mouse-button-raw-input-.patch b/patches/user32-rawinput/0008-winex11.drv-Implement-native-mouse-button-raw-input-.patch index 43568257..9a7b0b0c 100644 --- a/patches/user32-rawinput/0008-winex11.drv-Implement-native-mouse-button-raw-input-.patch +++ b/patches/user32-rawinput/0008-winex11.drv-Implement-native-mouse-button-raw-input-.patch @@ -1,31 +1,45 @@ -From cd40a026040d5f981e2dc3051826befa3d5df8f6 Mon Sep 17 00:00:00 2001 +From 8cd3d08315b108d2736356318c6ef74d3a0b1ec8 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Fri, 26 Jul 2019 17:37:19 -0400 -Subject: [PATCH 08/10] winex11.drv: Implement native mouse-button raw-input +Subject: [PATCH 08/11] winex11.drv: Implement native mouse-button raw-input using RawButton*. Signed-off-by: Derek Lesho --- - dlls/winex11.drv/mouse.c | 89 ++++++++++++++++++++++++++++++++-- - dlls/winex11.drv/x11drv.h | 2 + + dlls/winex11.drv/mouse.c | 97 +++++++++++++++++++++++++++++++--- + dlls/winex11.drv/x11drv.h | 3 ++ dlls/winex11.drv/x11drv_main.c | 1 + - 3 files changed, 87 insertions(+), 5 deletions(-) + 3 files changed, 95 insertions(+), 6 deletions(-) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c -index 1ec077bca74..6e09bebfdb8 100644 +index 472ba77d0a..65b1b500d0 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c -@@ -262,6 +262,7 @@ static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuator - - thread_data->x_rel_valuator.number = -1; +@@ -261,12 +261,21 @@ static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuator thread_data->y_rel_valuator.number = -1; + thread_data->x_abs_valuator.number = -1; + thread_data->y_abs_valuator.number = -1; + thread_data->wheel_valuator.number = -1; ++ ++ thread_data->xi2_wheel_multiplier = 0; for (i = 0; i < n_valuators; i++) { -@@ -279,6 +280,11 @@ static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuator + XIValuatorClassInfo *class = (XIValuatorClassInfo *)valuators[i]; ++ XIScrollClassInfo *scroll_class = (XIScrollClassInfo *)valuators[i]; + struct x11drv_valuator_data *valuator_data = NULL; + ++ if (valuators[i]->type == XIScrollClass) ++ { ++ if (scroll_class->scroll_type == XIScrollTypeVertical) ++ thread_data->xi2_wheel_multiplier = WHEEL_DELTA / scroll_class->increment; ++ } + if (valuators[i]->type != XIValuatorClass) continue; + if (class->label == x11drv_atom( Rel_X ) || + (!class->label && class->number == 0 && class->mode == XIModeRelative)) +@@ -288,6 +297,11 @@ static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuator { - valuator_data = &thread_data->y_rel_valuator; + valuator_data = &thread_data->y_abs_valuator; } + else if (class->label == x11drv_atom( Rel_Vert_Scroll ) || + (!class->label && class->number == 3 && class->mode == XIModeRelative)) @@ -35,16 +49,16 @@ index 1ec077bca74..6e09bebfdb8 100644 if (valuator_data) { valuator_data->number = class->number; -@@ -325,6 +331,8 @@ void X11DRV_XInput2_Enable(void) - mask.deviceid = XIAllMasterDevices; - memset( mask_bits, 0, sizeof(mask_bits) ); +@@ -336,6 +350,8 @@ void X11DRV_XInput2_Enable(void) + XISetMask( mask_bits, XI_DeviceChanged ); XISetMask( mask_bits, XI_RawMotion ); + XISetMask( mask_bits, XI_DeviceChanged ); + XISetMask( mask_bits, XI_RawButtonPress ); + XISetMask( mask_bits, XI_RawButtonRelease ); /* XInput 2.0 has a problematic behavior where master pointer will * not send raw events to the root window whenever a grab is active -@@ -383,6 +391,7 @@ void X11DRV_XInput2_Disable(void) +@@ -393,6 +409,7 @@ void X11DRV_XInput2_Disable(void) pXIFreeDeviceInfo( data->xi2_devices ); data->x_rel_valuator.number = -1; data->y_rel_valuator.number = -1; @@ -52,64 +66,65 @@ index 1ec077bca74..6e09bebfdb8 100644 data->xi2_devices = NULL; data->xi2_core_pointer = 0; data->xi2_current_slave = 0; -@@ -1850,11 +1859,11 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) +@@ -1775,12 +1792,13 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) INPUT input; RAWINPUT raw_input; int i; -- double dx = 0, dy = 0, raw_dx = 0, raw_dy = 0, val, raw_val; -+ double dx = 0, dy = 0, raw_dx = 0, raw_dy = 0, raw_dwheel = 0, val, raw_val; +- double dx = 0, dy = 0, raw_x = 0, raw_y = 0, val, raw_val; ++ double dx = 0, dy = 0, raw_x = 0, raw_y = 0, raw_dwheel = 0, val, raw_val; struct x11drv_thread_data *thread_data = x11drv_thread_data(); -- struct x11drv_valuator_data *x_rel, *y_rel; -+ struct x11drv_valuator_data *x_rel, *y_rel, *wheel; +- struct x11drv_valuator_data *x_rel, *y_rel, *x_abs, *y_abs; ++ struct x11drv_valuator_data *x_rel, *y_rel, *x_abs, *y_abs, *wheel; + + if ((thread_data->x_rel_valuator.number < 0 || thread_data->y_rel_valuator.number < 0) && +- (thread_data->x_abs_valuator.number < 0 || thread_data->y_abs_valuator.number < 0) return FALSE; ++ (thread_data->x_abs_valuator.number < 0 || thread_data->y_abs_valuator.number < 0) && ++ thread_data->wheel_valuator.number < 0) return FALSE; -- if (thread_data->x_rel_valuator.number < 0 || thread_data->y_rel_valuator.number < 0) return FALSE; -+ if (thread_data->x_rel_valuator.number < 0 || thread_data->y_rel_valuator.number < 0 || thread_data->wheel_valuator.number < 0) return FALSE; if (!event->valuators.mask_len) return FALSE; if (thread_data->xi2_state < xi_enabled) return FALSE; - -@@ -1887,6 +1896,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) - - x_rel = &thread_data->x_rel_valuator; +@@ -1816,6 +1834,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) y_rel = &thread_data->y_rel_valuator; + x_abs = &thread_data->x_abs_valuator; + y_abs = &thread_data->y_abs_valuator; + wheel = &thread_data->wheel_valuator; input.type = INPUT_MOUSE; input.u.mi.mouseData = 0; -@@ -1907,7 +1917,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) +@@ -1836,7 +1855,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) virtual_rect = get_virtual_screen_rect(); -- for (i = 0; i <= max ( x_rel->number, y_rel->number ); i++) -+ for (i = 0; i <= max( wheel->number, max( x_rel->number, y_rel->number ) ); i++) +- for (i = 0; i <= max(max(max( x_abs->number, y_abs->number), x_rel->number), y_rel->number); i++) ++ for (i = 0; i <= max(max(max(max(x_abs->number, y_abs->number), x_rel->number), y_rel->number), wheel->number); i++) { if (!XIMaskIsSet( event->valuators.mask, i )) continue; val = *values++; -@@ -1930,6 +1940,13 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) - - raw_input.data.mouse.lLastY = raw_dy = raw_val; +@@ -1871,6 +1890,10 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) + raw_input.data.mouse.usFlags = MOUSE_MOVE_ABSOLUTE | MOUSE_VIRTUAL_DESKTOP; + raw_input.data.mouse.lLastY = raw_y = raw_val * (65536 / (y_abs->max - y_abs->min)); } + if (i == wheel->number) + { -+ /* NOTE: Testing showed a 8x factor between X11 and Windows -+ * values, but that may be device specific -+ */ -+ raw_dwheel = raw_val * -8; ++ raw_dwheel = raw_val * thread_data->xi2_wheel_multiplier; + } } if (broken_rawevents && is_old_motion_event( xev->serial )) -@@ -1944,12 +1961,69 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) +@@ -1885,13 +1908,70 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) __wine_send_input( 0, &input ); } -- TRACE("raw event %f,%f\n", raw_dx, raw_dy); +- TRACE("raw %s event %f,%f\n", +- raw_input.data.mouse.usFlags ? "absolute" : "relative", raw_x, raw_y); + if (raw_dwheel) + { + raw_input.data.mouse.u.usButtonFlags = RI_MOUSE_WHEEL; + raw_input.data.mouse.u.usButtonData = raw_dwheel; + } + -+ TRACE("raw event %f,%f + %f\n", raw_dx, raw_dy, raw_dwheel); ++ TRACE("raw %s event %f,%f + %f\n", ++ raw_input.data.mouse.usFlags ? "absolute" : "relative", raw_x, raw_y, raw_dwheel); __wine_send_raw_input( &raw_input ); return TRUE; @@ -169,7 +184,7 @@ index 1ec077bca74..6e09bebfdb8 100644 #endif /* HAVE_X11_EXTENSIONS_XINPUT2_H */ -@@ -2014,6 +2088,11 @@ BOOL X11DRV_GenericEvent( HWND hwnd, XEvent *xev ) +@@ -1956,6 +2036,11 @@ BOOL X11DRV_GenericEvent( HWND hwnd, XEvent *xev ) case XI_RawMotion: ret = X11DRV_RawMotion( event ); break; @@ -182,37 +197,38 @@ index 1ec077bca74..6e09bebfdb8 100644 default: TRACE( "Unhandled event %#x\n", event->evtype ); diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h -index 81ad38df918..7a9b2c8b909 100644 +index 2c59f19815..928f858924 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h -@@ -344,6 +344,7 @@ struct x11drv_thread_data - int xi2_device_count; - struct x11drv_valuator_data x_rel_valuator; +@@ -344,6 +344,8 @@ struct x11drv_thread_data struct x11drv_valuator_data y_rel_valuator; + struct x11drv_valuator_data x_abs_valuator; + struct x11drv_valuator_data y_abs_valuator; + struct x11drv_valuator_data wheel_valuator; ++ double xi2_wheel_multiplier; int xi2_core_pointer; /* XInput2 core pointer id */ int xi2_current_slave; /* Current slave driving the Core pointer */ }; -@@ -431,6 +432,7 @@ enum x11drv_atoms - XATOM_RAW_CAP_HEIGHT, - XATOM_Rel_X, +@@ -431,6 +433,7 @@ enum x11drv_atoms XATOM_Rel_Y, + XATOM_Abs_X, + XATOM_Abs_Y, + XATOM_Rel_Vert_Scroll, XATOM_WM_PROTOCOLS, XATOM_WM_DELETE_WINDOW, XATOM_WM_STATE, diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c -index cfcf1f19dd1..093a5fa785e 100644 +index fb25a45ae2..05a445a9c1 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c -@@ -121,6 +121,7 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] = - "RAW_CAP_HEIGHT", - "Rel X", +@@ -122,6 +122,7 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] = "Rel Y", + "Abs X", + "Abs Y", + "Rel Vert Scroll", "WM_PROTOCOLS", "WM_DELETE_WINDOW", "WM_STATE", -- -2.17.1 +2.23.0 diff --git a/patches/user32-rawinput/0009-winex11.drv-Don-t-react-to-small-slow-mouse-movement.patch b/patches/user32-rawinput/0009-winex11.drv-Don-t-react-to-small-slow-mouse-movement.patch index 163c76a2..81d7abc2 100644 --- a/patches/user32-rawinput/0009-winex11.drv-Don-t-react-to-small-slow-mouse-movement.patch +++ b/patches/user32-rawinput/0009-winex11.drv-Don-t-react-to-small-slow-mouse-movement.patch @@ -1,7 +1,7 @@ -From c2c9aa68949b930f329c9d9a21327ea509e0dd66 Mon Sep 17 00:00:00 2001 +From acc742850b54dcd6d3fc0ad91efd7146ffbeff93 Mon Sep 17 00:00:00 2001 From: Jordan Galby Date: Tue, 16 Jul 2019 00:34:38 -0400 -Subject: [PATCH 09/10] winex11.drv: Don't react to small slow mouse movements. +Subject: [PATCH 09/11] winex11.drv: Don't react to small slow mouse movements. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=42631 From: Jordan Galby @@ -12,21 +12,21 @@ Signed-off-by: Derek Lesho 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c -index 6e09bebfdb8..ecab4530457 100644 +index 65b1b500d0..4d5b0a45ff 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c -@@ -264,6 +264,10 @@ static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuator - thread_data->y_rel_valuator.number = -1; +@@ -263,6 +263,10 @@ static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuator + thread_data->y_abs_valuator.number = -1; thread_data->wheel_valuator.number = -1; + thread_data->x_rel_valuator.accum = 0; + thread_data->y_rel_valuator.accum = 0; + thread_data->wheel_valuator.accum = 0; + + thread_data->xi2_wheel_multiplier = 0; + for (i = 0; i < n_valuators; i++) - { - XIValuatorClassInfo *class = (XIValuatorClassInfo *)valuators[i]; -@@ -1924,18 +1928,18 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) +@@ -1862,9 +1866,9 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) raw_val = *raw_values++; if (i == x_rel->number) { @@ -37,7 +37,8 @@ index 6e09bebfdb8..ecab4530457 100644 + dx = val * (virtual_rect.right - virtual_rect.left) / (x_rel->max - x_rel->min); - raw_input.data.mouse.lLastX = raw_dx = raw_val; + raw_input.data.mouse.usFlags = MOUSE_MOVE_RELATIVE; +@@ -1872,9 +1876,9 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) } if (i == y_rel->number) { @@ -48,8 +49,8 @@ index 6e09bebfdb8..ecab4530457 100644 + dy = val * (virtual_rect.bottom - virtual_rect.top) / (y_rel->max - y_rel->min); - raw_input.data.mouse.lLastY = raw_dy = raw_val; -@@ -1951,20 +1955,47 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) + raw_input.data.mouse.usFlags = MOUSE_MOVE_RELATIVE; +@@ -1898,20 +1902,47 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) if (broken_rawevents && is_old_motion_event( xev->serial )) { @@ -68,7 +69,7 @@ index 6e09bebfdb8..ecab4530457 100644 + + x_rel->accum += dx; + y_rel->accum += dy; -+ if (fabs(x_rel->accum) < 1.0 && fabs(y_rel->accum) < 1.0) ++ if ((dy || dy) && fabs(x_rel->accum) < 1.0 && fabs(y_rel->accum) < 1.0) + { + TRACE( "accumulating raw motion (event %f,%f, accum %f,%f)\n", dx, dy, x_rel->accum, y_rel->accum ); + } @@ -90,7 +91,7 @@ index 6e09bebfdb8..ecab4530457 100644 - if (raw_dwheel) + wheel->accum += raw_dwheel; -+ if (fabs(wheel->accum) < 1.0) ++ if (raw_dwheel && fabs(wheel->accum) < 1.0) + { + TRACE("accumulating wheel motion (event %f, accum %f)\n", raw_dwheel, wheel->accum); + } @@ -102,12 +103,12 @@ index 6e09bebfdb8..ecab4530457 100644 + wheel->accum -= raw_dwheel; } - TRACE("raw event %f,%f + %f\n", raw_dx, raw_dy, raw_dwheel); + TRACE("raw %s event %f,%f + %f\n", diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h -index 7a9b2c8b909..b47019d299e 100644 +index 928f858924..206473fde9 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h -@@ -321,6 +321,7 @@ struct x11drv_valuator_data +@@ -320,6 +320,7 @@ struct x11drv_valuator_data double min; double max; int number; @@ -116,5 +117,5 @@ index 7a9b2c8b909..b47019d299e 100644 struct x11drv_thread_data -- -2.17.1 +2.23.0 diff --git a/patches/user32-rawinput/0010-server-Implement-RIDEV_INPUTSINK-flag.patch b/patches/user32-rawinput/0010-server-Implement-RIDEV_INPUTSINK-flag.patch index 12eeadbc..000a9c0f 100644 --- a/patches/user32-rawinput/0010-server-Implement-RIDEV_INPUTSINK-flag.patch +++ b/patches/user32-rawinput/0010-server-Implement-RIDEV_INPUTSINK-flag.patch @@ -1,7 +1,7 @@ -From 2269a833a000d6b0ea2ffbab2c92f6aa0e0918ab Mon Sep 17 00:00:00 2001 +From 068d3780cc90fccfd49c23670baf526c4f93ad82 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Sat, 10 Aug 2019 12:20:59 -0400 -Subject: [PATCH 10/10] server: Implement RIDEV_INPUTSINK flag +Subject: [PATCH 10/11] server: Implement RIDEV_INPUTSINK flag Signed-off-by: Derek Lesho --- @@ -10,10 +10,10 @@ Signed-off-by: Derek Lesho 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c -index 661a0e3b255..a93dc365006 100644 +index 58480b8ae7..c231e2059c 100644 --- a/dlls/user32/rawinput.c +++ b/dlls/user32/rawinput.c -@@ -282,7 +282,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH RegisterRawInputDevices(RAWINPUTDEVICE *devices, U +@@ -271,7 +271,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); @@ -23,10 +23,10 @@ index 661a0e3b255..a93dc365006 100644 d[i].usage_page = devices[i].usUsagePage; diff --git a/server/queue.c b/server/queue.c -index 7ddee7c91ed..1a2a2d1b5d2 100644 +index c9446f7f4b..2596925aca 100644 --- a/server/queue.c +++ b/server/queue.c -@@ -2585,7 +2585,9 @@ DECL_HANDLER(send_rawinput_message) +@@ -2442,7 +2442,9 @@ DECL_HANDLER(send_rawinput_message) if ((device = current->process->rawinput_mouse)) { struct thread *thread = device->target ? get_window_thread( device->target ) : NULL; @@ -38,5 +38,5 @@ index 7ddee7c91ed..1a2a2d1b5d2 100644 if (!(msg = alloc_hardware_message( 0, source, 0 ))) goto done; -- -2.17.1 +2.23.0 diff --git a/patches/user32-rawinput/definition b/patches/user32-rawinput/definition index 0a83de56..5edbe7c0 100644 --- a/patches/user32-rawinput/definition +++ b/patches/user32-rawinput/definition @@ -2,4 +2,3 @@ Fixes: [42675] - Overwatch - Phantom mouse input / view pulled up to ceiling. Fixes: [45882] - Raw Input should use untransformed mouse values (affects Overwatch, several Source games). Fixes: [47457] - Mouse click-click-hold is treated as double click, causing gun jam in Overwatch. Fixes: [42631] - user32: Add Raw Input support. -Disabled: True