From 3d32dd06263b797f6313100b128e8a54da9f0c57 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Sat, 2 Apr 2022 14:01:42 +1100 Subject: [PATCH] Rebase against 0de8d01b09b1cc7ca34f7ae3890b4a416ff801fe. --- patches/patchinstall.sh | 4 +- ...hardware_message-flags-for-rawinput-.patch | 52 ++++++------- ...HWMSG_RAWINPUT-flags-only-when-RAWIN.patch | 78 +++++++++---------- ...ending-RIM_TYPEMOUSE-through-__wine_.patch | 22 +++--- staging/upstream-commit | 2 +- 5 files changed, 79 insertions(+), 79 deletions(-) diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 171965cc..86176e1e 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -51,7 +51,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "3c9d2cbaea2039d8ce5d8180ed231b0be6cfa072" + echo "0de8d01b09b1cc7ca34f7ae3890b4a416ff801fe" } # Show version information @@ -3318,7 +3318,7 @@ fi # | * [#42675] Overwatch: Phantom mouse input / view pulled up to ceiling # | # | Modified files: -# | * dlls/user32/input.c, dlls/user32/message.c, dlls/wineandroid.drv/keyboard.c, dlls/wineandroid.drv/window.c, +# | * dlls/win32u/input.c, dlls/win32u/message.c, dlls/wineandroid.drv/keyboard.c, dlls/wineandroid.drv/window.c, # | dlls/winemac.drv/ime.c, dlls/winemac.drv/keyboard.c, dlls/winemac.drv/mouse.c, dlls/winex11.drv/desktop.c, # | dlls/winex11.drv/event.c, dlls/winex11.drv/keyboard.c, dlls/winex11.drv/mouse.c, dlls/winex11.drv/window.c, # | dlls/winex11.drv/x11drv.h, dlls/winex11.drv/x11drv_main.c, server/protocol.def, server/queue.c diff --git a/patches/user32-rawinput-mouse/0005-server-Add-send_hardware_message-flags-for-rawinput-.patch b/patches/user32-rawinput-mouse/0005-server-Add-send_hardware_message-flags-for-rawinput-.patch index b63f5db6..49f1e1e3 100644 --- a/patches/user32-rawinput-mouse/0005-server-Add-send_hardware_message-flags-for-rawinput-.patch +++ b/patches/user32-rawinput-mouse/0005-server-Add-send_hardware_message-flags-for-rawinput-.patch @@ -1,40 +1,40 @@ -From 265a4a77fa8b971040526ddfbdb4cf85e81b4dbd Mon Sep 17 00:00:00 2001 +From b3e1675f4654daecf5237f86a6bfa5d3512c109c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 26 Aug 2019 14:37:20 +0200 -Subject: [PATCH 5/8] server: Add send_hardware_message flags for rawinput +Subject: [PATCH] server: Add send_hardware_message flags for rawinput translation. --- - dlls/user32/message.c | 2 ++ + dlls/win32u/message.c | 2 ++ server/protocol.def | 1 + server/queue.c | 12 ++++++------ 3 files changed, 9 insertions(+), 6 deletions(-) -diff --git a/dlls/user32/message.c b/dlls/user32/message.c -index e5ea0735ed2..c14c726273f 100644 ---- a/dlls/user32/message.c -+++ b/dlls/user32/message.c -@@ -3279,6 +3279,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r - req->input.mouse.flags = input->u.mi.dwFlags; - req->input.mouse.time = input->u.mi.time; - req->input.mouse.info = input->u.mi.dwExtraInfo; +diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c +index 74cfec0651a..fbdd09ad806 100644 +--- a/dlls/win32u/message.c ++++ b/dlls/win32u/message.c +@@ -1912,6 +1912,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r + req->input.mouse.flags = input->mi.dwFlags; + req->input.mouse.time = input->mi.time; + req->input.mouse.info = input->mi.dwExtraInfo; + req->flags |= SEND_HWMSG_RAWINPUT; break; case INPUT_KEYBOARD: - req->input.kbd.vkey = input->u.ki.wVk; -@@ -3286,6 +3287,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r - req->input.kbd.flags = input->u.ki.dwFlags; - req->input.kbd.time = input->u.ki.time; - req->input.kbd.info = input->u.ki.dwExtraInfo; + req->input.kbd.vkey = input->ki.wVk; +@@ -1919,6 +1920,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r + req->input.kbd.flags = input->ki.dwFlags; + req->input.kbd.time = input->ki.time; + req->input.kbd.info = input->ki.dwExtraInfo; + req->flags |= SEND_HWMSG_RAWINPUT; break; case INPUT_HARDWARE: - req->input.hw.msg = input->u.hi.uMsg; + req->input.hw.msg = input->hi.uMsg; diff --git a/server/protocol.def b/server/protocol.def -index 6a25db0326f..a61e4cca152 100644 +index 673fcdd6c8d..0c1b6b57518 100644 --- a/server/protocol.def +++ b/server/protocol.def -@@ -2042,6 +2042,7 @@ enum message_type +@@ -2041,6 +2041,7 @@ enum message_type VARARG(keystate,bytes); /* global state array for all the keys */ @END #define SEND_HWMSG_INJECTED 0x01 @@ -43,10 +43,10 @@ index 6a25db0326f..a61e4cca152 100644 /* Get a message from the current queue */ diff --git a/server/queue.c b/server/queue.c -index fe5a3f2d5be..a4bea986b94 100644 +index e11e24378e6..950a2cdce22 100644 --- a/server/queue.c +++ b/server/queue.c -@@ -1736,7 +1736,7 @@ done: +@@ -1815,7 +1815,7 @@ done: /* 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, @@ -55,7 +55,7 @@ index fe5a3f2d5be..a4bea986b94 100644 { const struct rawinput_device *device; struct hardware_msg_data *msg_data; -@@ -1791,7 +1791,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons +@@ -1870,7 +1870,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons y = desktop->cursor.y; } @@ -64,7 +64,7 @@ index fe5a3f2d5be..a4bea986b94 100644 { memset( &raw_msg, 0, sizeof(raw_msg) ); raw_msg.foreground = foreground; -@@ -1850,7 +1850,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons +@@ -1929,7 +1929,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons /* queue a hardware message for a keyboard event */ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, const hw_input_t *input, @@ -73,7 +73,7 @@ index fe5a3f2d5be..a4bea986b94 100644 { struct hw_msg_source source = { IMDT_KEYBOARD, origin }; const struct rawinput_device *device; -@@ -1928,7 +1928,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c +@@ -2007,7 +2007,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c break; } @@ -82,7 +82,7 @@ index fe5a3f2d5be..a4bea986b94 100644 { memset( &raw_msg, 0, sizeof(raw_msg) ); raw_msg.foreground = foreground; -@@ -2546,10 +2546,10 @@ DECL_HANDLER(send_hardware_message) +@@ -2641,10 +2641,10 @@ DECL_HANDLER(send_hardware_message) switch (req->input.type) { case INPUT_MOUSE: @@ -96,5 +96,5 @@ index fe5a3f2d5be..a4bea986b94 100644 case INPUT_HARDWARE: queue_custom_hardware_message( desktop, req->win, origin, &req->input ); -- -2.33.0 +2.35.1 diff --git a/patches/user32-rawinput-mouse/0006-user32-Set-SEND_HWMSG_RAWINPUT-flags-only-when-RAWIN.patch b/patches/user32-rawinput-mouse/0006-user32-Set-SEND_HWMSG_RAWINPUT-flags-only-when-RAWIN.patch index 68e0c498..2e7f08b3 100644 --- a/patches/user32-rawinput-mouse/0006-user32-Set-SEND_HWMSG_RAWINPUT-flags-only-when-RAWIN.patch +++ b/patches/user32-rawinput-mouse/0006-user32-Set-SEND_HWMSG_RAWINPUT-flags-only-when-RAWIN.patch @@ -1,15 +1,15 @@ -From 1026871222aa0c54a9ebd747c1b4bd7220815a45 Mon Sep 17 00:00:00 2001 +From 9cf21068ed9815699e4317867257154ec76af56d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 24 Mar 2021 23:29:28 +0100 -Subject: [PATCH 6/8] user32: Set SEND_HWMSG_RAWINPUT flags only when RAWINPUT - is set. +Subject: [PATCH] user32: Set SEND_HWMSG_RAWINPUT flags only when RAWINPUT is + set. So we can generate legacy messages only by calling __wine_send_input with NULL rawinput, and generate WM_INPUT messages only by calling __wine_send_input with INPUT_HARDWARE input type and a rawinput. --- - dlls/user32/input.c | 3 ++- - dlls/user32/message.c | 4 ++-- + dlls/win32u/input.c | 3 ++- + dlls/win32u/message.c | 4 ++-- dlls/wineandroid.drv/keyboard.c | 3 ++- dlls/wineandroid.drv/window.c | 5 +++-- dlls/winemac.drv/ime.c | 6 ++++-- @@ -19,11 +19,11 @@ __wine_send_input with INPUT_HARDWARE input type and a rawinput. dlls/winex11.drv/mouse.c | 11 +++++++---- 9 files changed, 26 insertions(+), 15 deletions(-) -diff --git a/dlls/user32/input.c b/dlls/user32/input.c -index b4e3579f5e8..a116c131668 100644 ---- a/dlls/user32/input.c -+++ b/dlls/user32/input.c -@@ -235,6 +235,7 @@ UINT WINAPI SendInput( UINT count, LPINPUT inputs, int size ) +diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c +index 00b9293cdb4..2494a5355e4 100644 +--- a/dlls/win32u/input.c ++++ b/dlls/win32u/input.c +@@ -127,6 +127,7 @@ UINT WINAPI NtUserSendInput( UINT count, INPUT *inputs, int size ) { UINT i; NTSTATUS status = STATUS_SUCCESS; @@ -31,7 +31,7 @@ index b4e3579f5e8..a116c131668 100644 if (size != sizeof(INPUT)) { -@@ -264,7 +265,7 @@ UINT WINAPI SendInput( UINT count, LPINPUT inputs, int size ) +@@ -156,7 +157,7 @@ UINT WINAPI NtUserSendInput( UINT count, INPUT *inputs, int size ) update_mouse_coords( &input ); /* fallthrough */ case INPUT_KEYBOARD: @@ -40,28 +40,28 @@ index b4e3579f5e8..a116c131668 100644 break; case INPUT_HARDWARE: SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); -diff --git a/dlls/user32/message.c b/dlls/user32/message.c -index c14c726273f..05f00704906 100644 ---- a/dlls/user32/message.c -+++ b/dlls/user32/message.c -@@ -3279,7 +3279,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r - req->input.mouse.flags = input->u.mi.dwFlags; - req->input.mouse.time = input->u.mi.time; - req->input.mouse.info = input->u.mi.dwExtraInfo; +diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c +index fbdd09ad806..72b0e77fc6d 100644 +--- a/dlls/win32u/message.c ++++ b/dlls/win32u/message.c +@@ -1912,7 +1912,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r + req->input.mouse.flags = input->mi.dwFlags; + req->input.mouse.time = input->mi.time; + req->input.mouse.info = input->mi.dwExtraInfo; - req->flags |= SEND_HWMSG_RAWINPUT; + if (rawinput) req->flags |= SEND_HWMSG_RAWINPUT; break; case INPUT_KEYBOARD: - req->input.kbd.vkey = input->u.ki.wVk; -@@ -3287,7 +3287,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r - req->input.kbd.flags = input->u.ki.dwFlags; - req->input.kbd.time = input->u.ki.time; - req->input.kbd.info = input->u.ki.dwExtraInfo; + req->input.kbd.vkey = input->ki.wVk; +@@ -1920,7 +1920,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r + req->input.kbd.flags = input->ki.dwFlags; + req->input.kbd.time = input->ki.time; + req->input.kbd.info = input->ki.dwExtraInfo; - req->flags |= SEND_HWMSG_RAWINPUT; + if (rawinput) req->flags |= SEND_HWMSG_RAWINPUT; break; case INPUT_HARDWARE: - req->input.hw.msg = input->u.hi.uMsg; + req->input.hw.msg = input->hi.uMsg; diff --git a/dlls/wineandroid.drv/keyboard.c b/dlls/wineandroid.drv/keyboard.c index 803f13d8f39..a9563161ece 100644 --- a/dlls/wineandroid.drv/keyboard.c @@ -84,10 +84,10 @@ index 803f13d8f39..a9563161ece 100644 /*********************************************************************** diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c -index 997bce15964..d169fb78d78 100644 +index d08ddca0367..338a701bcdd 100644 --- a/dlls/wineandroid.drv/window.c +++ b/dlls/wineandroid.drv/window.c -@@ -428,6 +428,7 @@ static int process_events( DWORD mask ) +@@ -424,6 +424,7 @@ static int process_events( DWORD mask ) DPI_AWARENESS_CONTEXT context; struct java_event *event, *next, *previous; unsigned int count = 0; @@ -95,7 +95,7 @@ index 997bce15964..d169fb78d78 100644 assert( GetCurrentThreadId() == desktop_tid ); -@@ -521,7 +522,7 @@ static int process_events( DWORD mask ) +@@ -517,7 +518,7 @@ static int process_events( DWORD mask ) } SERVER_END_REQ; } @@ -104,7 +104,7 @@ index 997bce15964..d169fb78d78 100644 } break; -@@ -535,7 +536,7 @@ static int process_events( DWORD mask ) +@@ -531,7 +532,7 @@ static int process_events( DWORD mask ) event->data.kbd.input.u.ki.wVk, event->data.kbd.input.u.ki.wVk, event->data.kbd.input.u.ki.wScan ); update_keyboard_lock_state( event->data.kbd.input.u.ki.wVk, event->data.kbd.lock_state ); @@ -168,7 +168,7 @@ index f4b955cd46a..0cdfc96ea0b 100644 diff --git a/dlls/winemac.drv/mouse.c b/dlls/winemac.drv/mouse.c -index d2278ae0e4c..d6598617456 100644 +index bdfedc47a5d..3021d829c2f 100644 --- a/dlls/winemac.drv/mouse.c +++ b/dlls/winemac.drv/mouse.c @@ -136,6 +136,7 @@ static const CFStringRef cocoa_cursor_names[] = @@ -210,10 +210,10 @@ index 1525dac8280..4db0dafb4ee 100644 diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c -index 6905d0827f8..c606f2755ae 100644 +index 4f10f934016..50759335f0e 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c -@@ -797,6 +797,7 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input ) +@@ -745,6 +745,7 @@ static void map_event_coords( HWND hwnd, Window window, Window event_root, int x static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPUT *input ) { struct x11drv_win_data *data; @@ -221,7 +221,7 @@ index 6905d0827f8..c606f2755ae 100644 input->type = INPUT_MOUSE; -@@ -813,7 +814,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU +@@ -761,7 +762,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU sync_window_cursor( window ); last_cursor_change = input->u.mi.time; } @@ -230,7 +230,7 @@ index 6905d0827f8..c606f2755ae 100644 return; } -@@ -853,7 +854,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU +@@ -801,7 +802,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU SERVER_END_REQ; } @@ -239,7 +239,7 @@ index 6905d0827f8..c606f2755ae 100644 } #ifdef SONAME_LIBXCURSOR -@@ -1808,6 +1809,7 @@ void move_resize_window( HWND hwnd, int dir ) +@@ -1756,6 +1757,7 @@ void move_resize_window( HWND hwnd, int dir ) { MSG msg; INPUT input; @@ -247,7 +247,7 @@ index 6905d0827f8..c606f2755ae 100644 int x, y, rootX, rootY; if (!XQueryPointer( display, root_window, &root, &child, &rootX, &rootY, &x, &y, &xstate )) break; -@@ -1823,7 +1825,7 @@ void move_resize_window( HWND hwnd, int dir ) +@@ -1771,7 +1773,7 @@ void move_resize_window( HWND hwnd, int dir ) input.u.mi.dwFlags = button_up_flags[button - 1] | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE; input.u.mi.time = GetTickCount(); input.u.mi.dwExtraInfo = 0; @@ -256,7 +256,7 @@ index 6905d0827f8..c606f2755ae 100644 } while (PeekMessageW( &msg, 0, 0, 0, PM_REMOVE )) -@@ -1982,6 +1984,7 @@ static BOOL X11DRV_DeviceChanged( XGenericEventCookie *xev ) +@@ -1984,6 +1986,7 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input ) static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) { XIRawEvent *event = xev->data; @@ -264,7 +264,7 @@ index 6905d0827f8..c606f2755ae 100644 INPUT input; if (broken_rawevents && is_old_motion_event( xev->serial )) -@@ -1999,7 +2002,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) +@@ -2001,7 +2004,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev ) input.u.mi.dy = 0; if (!map_raw_event_coords( event, &input )) return FALSE; @@ -274,5 +274,5 @@ index 6905d0827f8..c606f2755ae 100644 } -- -2.33.0 +2.35.1 diff --git a/patches/user32-rawinput-mouse/0007-user32-Support-sending-RIM_TYPEMOUSE-through-__wine_.patch b/patches/user32-rawinput-mouse/0007-user32-Support-sending-RIM_TYPEMOUSE-through-__wine_.patch index 4ad8b1cb..4ecc626f 100644 --- a/patches/user32-rawinput-mouse/0007-user32-Support-sending-RIM_TYPEMOUSE-through-__wine_.patch +++ b/patches/user32-rawinput-mouse/0007-user32-Support-sending-RIM_TYPEMOUSE-through-__wine_.patch @@ -1,19 +1,19 @@ -From 73870c715c6f7f8249e021d0b2feb833cb0b2fe9 Mon Sep 17 00:00:00 2001 +From 21c24cc9858431164dadf4882e83831c216defef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 25 Mar 2021 14:26:35 +0100 -Subject: [PATCH 7/8] user32: Support sending RIM_TYPEMOUSE through +Subject: [PATCH] user32: Support sending RIM_TYPEMOUSE through __wine_send_input. --- - dlls/user32/message.c | 6 ++++++ + dlls/win32u/message.c | 6 ++++++ server/queue.c | 3 +++ 2 files changed, 9 insertions(+) -diff --git a/dlls/user32/message.c b/dlls/user32/message.c -index 05f00704906..a81690bc0d3 100644 ---- a/dlls/user32/message.c -+++ b/dlls/user32/message.c -@@ -3299,6 +3299,12 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r +diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c +index 72b0e77fc6d..67926b79d89 100644 +--- a/dlls/win32u/message.c ++++ b/dlls/win32u/message.c +@@ -1932,6 +1932,12 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r req->input.hw.rawinput.type = rawinput->header.dwType; switch (rawinput->header.dwType) { @@ -27,10 +27,10 @@ index 05f00704906..a81690bc0d3 100644 req->input.hw.rawinput.hid.device = HandleToUlong( rawinput->header.hDevice ); req->input.hw.rawinput.hid.param = rawinput->header.wParam; diff --git a/server/queue.c b/server/queue.c -index a4bea986b94..6713b58c468 100644 +index 950a2cdce22..46a7870d7d1 100644 --- a/server/queue.c +++ b/server/queue.c -@@ -2022,6 +2022,9 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_ +@@ -2101,6 +2101,9 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_ msg_data->size = sizeof(*msg_data) + report_size; msg_data->rawinput = input->hw.rawinput; @@ -41,5 +41,5 @@ index a4bea986b94..6713b58c468 100644 if (raw_msg.foreground) release_object( raw_msg.foreground ); -- -2.33.0 +2.35.1 diff --git a/staging/upstream-commit b/staging/upstream-commit index f3ee41a3..30c1dbfb 100644 --- a/staging/upstream-commit +++ b/staging/upstream-commit @@ -1 +1 @@ -3c9d2cbaea2039d8ce5d8180ed231b0be6cfa072 +0de8d01b09b1cc7ca34f7ae3890b4a416ff801fe