From ff18b9b26e636ff5a626257ec172168ba7dbbb95 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 9 Feb 2024 15:28:59 +1100 Subject: [PATCH] Rebase against 8cb68e43dec6e6bb32fcdf82e03a6d4263dd2354. --- ...server-ntdll-Implement-message-waits.patch | 34 +++++++++---------- ...-MOUSEEVENTF_-ABSOLUTE-VIRTUALDESK-f.patch | 24 ++++++------- ...rcing-relative-rawinput-mouse-positi.patch | 30 ++++++++-------- .../definition | 1 + ...ending-RIM_TYPEMOUSE-through-__wine_.patch | 30 ++++++++-------- patches/user32-rawinput-mouse/definition | 2 +- staging/upstream-commit | 2 +- 7 files changed, 62 insertions(+), 61 deletions(-) diff --git a/patches/eventfd_synchronization/0021-server-ntdll-Implement-message-waits.patch b/patches/eventfd_synchronization/0021-server-ntdll-Implement-message-waits.patch index f88a31d4..4a0fdd9a 100644 --- a/patches/eventfd_synchronization/0021-server-ntdll-Implement-message-waits.patch +++ b/patches/eventfd_synchronization/0021-server-ntdll-Implement-message-waits.patch @@ -1,4 +1,4 @@ -From ca6a89f3bfb6aa5d7ac05bb0c469b527ae1a9d9d Mon Sep 17 00:00:00 2001 +From 1cf7540fcddc9fbaa7411f3293f115555a6dd0ab Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 6 Jul 2020 16:11:23 -0500 Subject: [PATCH] server, ntdll: Implement message waits. @@ -10,10 +10,10 @@ Subject: [PATCH] server, ntdll: Implement message waits. 3 files changed, 75 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c -index 2ae334d8417..608c318c1c7 100644 +index 399930c444b..06d7d8babc6 100644 --- a/dlls/ntdll/unix/esync.c +++ b/dlls/ntdll/unix/esync.c -@@ -475,12 +475,13 @@ static void update_grabbed_object( struct esync *obj ) +@@ -474,12 +474,13 @@ static void update_grabbed_object( struct esync *obj ) /* A value of STATUS_NOT_IMPLEMENTED returned from this function means that we * need to delegate to server_select(). */ @@ -28,7 +28,7 @@ index 2ae334d8417..608c318c1c7 100644 LONGLONG timeleft; LARGE_INTEGER now; ULONGLONG end; -@@ -508,6 +509,9 @@ NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an +@@ -507,6 +508,9 @@ NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an return ret; } @@ -38,7 +38,7 @@ index 2ae334d8417..608c318c1c7 100644 if (has_esync && has_server) FIXME("Can't wait on esync and server objects at the same time!\n"); else if (has_server) -@@ -519,6 +523,9 @@ NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an +@@ -518,6 +522,9 @@ NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an for (i = 0; i < count; i++) TRACE(" %p", handles[i]); @@ -48,7 +48,7 @@ index 2ae334d8417..608c318c1c7 100644 if (!timeout) TRACE(", timeout = INFINITE.\n"); else -@@ -558,7 +565,9 @@ NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an +@@ -557,7 +564,9 @@ NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an int64_t value; ssize_t size; @@ -59,7 +59,7 @@ index 2ae334d8417..608c318c1c7 100644 { /* Don't grab the object, just check if it's signaled. */ if (fds[i].revents & POLLIN) -@@ -603,6 +612,44 @@ NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an +@@ -602,6 +611,44 @@ NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an } } @@ -105,10 +105,10 @@ index 2ae334d8417..608c318c1c7 100644 { struct stat st; diff --git a/server/protocol.def b/server/protocol.def -index 5cf63cbac21..f837944574e 100644 +index 915332ece6f..dd5e996cbc7 100644 --- a/server/protocol.def +++ b/server/protocol.def -@@ -3797,3 +3797,8 @@ enum esync_type +@@ -3921,3 +3921,8 @@ enum esync_type int type; unsigned int shm_idx; @END @@ -118,10 +118,10 @@ index 5cf63cbac21..f837944574e 100644 + int in_msgwait; /* are we in a message wait? */ +@END diff --git a/server/queue.c b/server/queue.c -index 1702acb8480..9593ae532d4 100644 +index 3d5da326400..80731383401 100644 --- a/server/queue.c +++ b/server/queue.c -@@ -144,6 +144,7 @@ struct msg_queue +@@ -146,6 +146,7 @@ struct msg_queue int keystate_lock; /* owns an input keystate lock */ unsigned int ignore_post_msg; /* ignore post messages newer than this unique id */ int esync_fd; /* esync file descriptor (signalled on message) */ @@ -129,7 +129,7 @@ index 1702acb8480..9593ae532d4 100644 }; struct hotkey -@@ -317,6 +318,7 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_ +@@ -319,6 +320,7 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_ queue->keystate_lock = 0; queue->ignore_post_msg = 0; queue->esync_fd = -1; @@ -137,7 +137,7 @@ index 1702acb8480..9593ae532d4 100644 list_init( &queue->send_result ); list_init( &queue->callback_result ); list_init( &queue->pending_timers ); -@@ -1001,6 +1003,10 @@ static int is_queue_hung( struct msg_queue *queue ) +@@ -1106,6 +1108,10 @@ static int is_queue_hung( struct msg_queue *queue ) if (get_wait_queue_thread(entry)->queue == queue) return 0; /* thread is waiting on queue -> not hung */ } @@ -148,9 +148,9 @@ index 1702acb8480..9593ae532d4 100644 return 1; } -@@ -3456,3 +3462,18 @@ DECL_HANDLER(update_rawinput_devices) - process->rawinput_mouse = find_rawinput_device( process, 1, 2 ); - process->rawinput_kbd = find_rawinput_device( process, 1, 6 ); +@@ -3568,3 +3574,18 @@ DECL_HANDLER(update_rawinput_devices) + process->rawinput_mouse = find_rawinput_device( process, MAKELONG(HID_USAGE_GENERIC_MOUSE, HID_USAGE_PAGE_GENERIC) ); + process->rawinput_kbd = find_rawinput_device( process, MAKELONG(HID_USAGE_GENERIC_KEYBOARD, HID_USAGE_PAGE_GENERIC) ); } + +DECL_HANDLER(esync_msgwait) @@ -168,5 +168,5 @@ index 1702acb8480..9593ae532d4 100644 + set_fd_events( queue->fd, req->in_msgwait ? POLLIN : 0 ); +} -- -2.35.1 +2.43.0 diff --git a/patches/user32-rawinput-mouse-experimental/0001-server-Clear-the-MOUSEEVENTF_-ABSOLUTE-VIRTUALDESK-f.patch b/patches/user32-rawinput-mouse-experimental/0001-server-Clear-the-MOUSEEVENTF_-ABSOLUTE-VIRTUALDESK-f.patch index 2eb634f9..22ca512b 100644 --- a/patches/user32-rawinput-mouse-experimental/0001-server-Clear-the-MOUSEEVENTF_-ABSOLUTE-VIRTUALDESK-f.patch +++ b/patches/user32-rawinput-mouse-experimental/0001-server-Clear-the-MOUSEEVENTF_-ABSOLUTE-VIRTUALDESK-f.patch @@ -1,4 +1,4 @@ -From a2742b14c1f5e0749a24e105131345428840a12f Mon Sep 17 00:00:00 2001 +From 021af6dcf439d70df46b9fc839c2cc0877b8e43c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 28 Oct 2021 09:11:02 +0200 Subject: [PATCH] server: Clear the MOUSEEVENTF_(ABSOLUTE|VIRTUALDESK) flags. @@ -10,18 +10,18 @@ motion. 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/queue.c b/server/queue.c -index 6713b58c468..d580f9acf1f 100644 +index 1aedda1ca71..87b25820cfe 100644 --- a/server/queue.c +++ b/server/queue.c -@@ -1803,7 +1803,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons - msg_data = &raw_msg.data; - msg_data->info = input->mouse.info; - msg_data->size = sizeof(*msg_data); -- msg_data->flags = flags; -+ msg_data->flags = flags & ~(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_VIRTUALDESK); - msg_data->rawinput.type = RIM_TYPEMOUSE; - msg_data->rawinput.mouse.x = x - desktop->cursor.x; - msg_data->rawinput.mouse.y = y - desktop->cursor.y; +@@ -1967,7 +1967,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons + raw_msg.message = WM_INPUT; + + raw_msg.info = input->mouse.info; +- raw_msg.flags = flags; ++ raw_msg.flags = flags & ~(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_VIRTUALDESK); + raw_msg.rawinput.type = RIM_TYPEMOUSE; + raw_msg.rawinput.mouse.x = x - desktop->cursor.x; + raw_msg.rawinput.mouse.y = y - desktop->cursor.y; -- -2.33.0 +2.43.0 diff --git a/patches/user32-rawinput-mouse-experimental/0003-server-Stop-enforcing-relative-rawinput-mouse-positi.patch b/patches/user32-rawinput-mouse-experimental/0003-server-Stop-enforcing-relative-rawinput-mouse-positi.patch index 341d712a..1e69b82a 100644 --- a/patches/user32-rawinput-mouse-experimental/0003-server-Stop-enforcing-relative-rawinput-mouse-positi.patch +++ b/patches/user32-rawinput-mouse-experimental/0003-server-Stop-enforcing-relative-rawinput-mouse-positi.patch @@ -1,4 +1,4 @@ -From a28f1031effa8319f580dab6392709e5a9944d07 Mon Sep 17 00:00:00 2001 +From 7ab586e1da370ab17f5cc64dc97449a436f2fa5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 25 Oct 2021 11:22:04 +0200 Subject: [PATCH] server: Stop enforcing relative rawinput mouse positions. @@ -8,23 +8,23 @@ Subject: [PATCH] server: Stop enforcing relative rawinput mouse positions. 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/queue.c b/server/queue.c -index d580f9acf1f..c4c97c04f2e 100644 +index 87b25820cfe..a94bdf53939 100644 --- a/server/queue.c +++ b/server/queue.c -@@ -1803,10 +1803,10 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons - msg_data = &raw_msg.data; - msg_data->info = input->mouse.info; - msg_data->size = sizeof(*msg_data); -- msg_data->flags = flags & ~(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_VIRTUALDESK); -+ msg_data->flags = flags; - msg_data->rawinput.type = RIM_TYPEMOUSE; -- msg_data->rawinput.mouse.x = x - desktop->cursor.x; -- msg_data->rawinput.mouse.y = y - desktop->cursor.y; -+ msg_data->rawinput.mouse.x = (flags & MOUSEEVENTF_MOVE) ? input->mouse.x : 0; -+ msg_data->rawinput.mouse.y = (flags & MOUSEEVENTF_MOVE) ? input->mouse.y : 0; - msg_data->rawinput.mouse.data = input->mouse.data; +@@ -1967,10 +1967,10 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons + raw_msg.message = WM_INPUT; + + raw_msg.info = input->mouse.info; +- raw_msg.flags = flags & ~(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_VIRTUALDESK); ++ raw_msg.flags = flags; + raw_msg.rawinput.type = RIM_TYPEMOUSE; +- raw_msg.rawinput.mouse.x = x - desktop->cursor.x; +- raw_msg.rawinput.mouse.y = y - desktop->cursor.y; ++ raw_msg.rawinput.mouse.x = (flags & MOUSEEVENTF_MOVE) ? input->mouse.x : 0; ++ raw_msg.rawinput.mouse.y = (flags & MOUSEEVENTF_MOVE) ? input->mouse.y : 0; + raw_msg.rawinput.mouse.data = input->mouse.data; enum_processes( queue_rawinput_message, &raw_msg ); -- -2.33.0 +2.43.0 diff --git a/patches/user32-rawinput-mouse-experimental/definition b/patches/user32-rawinput-mouse-experimental/definition index fe2d8d5e..279f41d0 100644 --- a/patches/user32-rawinput-mouse-experimental/definition +++ b/patches/user32-rawinput-mouse-experimental/definition @@ -1,2 +1,3 @@ Fixes: [45882] - Raw Input should use untransformed mouse values (affects Overwatch, several Source games). Depends: user32-rawinput-mouse +Disabled: True 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 70c27c5d..ddacbc43 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,4 +1,4 @@ -From 72c71236311247110b966356e35501da26eeab52 Mon Sep 17 00:00:00 2001 +From 84e2d01ee1a616724d5a61ca95db13b309b752f5 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] user32: Support sending RIM_TYPEMOUSE through @@ -10,36 +10,36 @@ Subject: [PATCH] user32: Support sending RIM_TYPEMOUSE through 2 files changed, 9 insertions(+) diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c -index b60afaad475..d622ae8aea8 100644 +index 99bae5280f6..ff8f5bd6d87 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c -@@ -3488,6 +3488,12 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r - req->input.hw.rawinput.type = rawinput->header.dwType; +@@ -3553,6 +3553,12 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r + case WM_INPUT_DEVICE_CHANGE: switch (rawinput->header.dwType) { + case RIM_TYPEMOUSE: -+ req->input.hw.rawinput.mouse.x = rawinput->data.mouse.lLastX; -+ req->input.hw.rawinput.mouse.y = rawinput->data.mouse.lLastY; -+ req->input.hw.rawinput.mouse.data = rawinput->data.mouse.ulRawButtons; ++ req->input.hw.mouse.x = rawinput->data.mouse.lLastX; ++ req->input.hw.mouse.y = rawinput->data.mouse.lLastY; ++ req->input.hw.mouse.data = rawinput->data.mouse.ulRawButtons; + req->input.hw.lparam = rawinput->data.mouse.usFlags; + break; case RIM_TYPEHID: - req->input.hw.rawinput.hid.device = HandleToUlong( rawinput->header.hDevice ); - req->input.hw.rawinput.hid.param = rawinput->header.wParam; + req->input.hw.wparam = rawinput->header.wParam; + req->input.hw.hid.device = HandleToUlong( rawinput->header.hDevice ); diff --git a/server/queue.c b/server/queue.c -index f62593b096a..cdd02d1534d 100644 +index e234b5e8af9..1aedda1ca71 100644 --- a/server/queue.c +++ b/server/queue.c -@@ -2132,6 +2132,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; +@@ -2109,6 +2109,9 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c + raw_msg.rawinput.kbd.vkey = vkey; + raw_msg.rawinput.kbd.scan = input->kbd.scan; + if (input->hw.msg == WM_INPUT && input->hw.rawinput.type == RIM_TYPEMOUSE) + msg_data->flags = input->hw.lparam; + enum_processes( queue_rawinput_message, &raw_msg ); - return; + release_object( foreground ); } -- -2.40.1 +2.43.0 diff --git a/patches/user32-rawinput-mouse/definition b/patches/user32-rawinput-mouse/definition index 4b047660..baadf8ee 100644 --- a/patches/user32-rawinput-mouse/definition +++ b/patches/user32-rawinput-mouse/definition @@ -1,3 +1,3 @@ Fixes: [42631] Mouse drift, jump or don't react to small slow movements in Unity-engine games and Fallout 4 (partly fixed in Unity games, have walkaround in Fallout4 ) Fixes: [42675] Overwatch: Phantom mouse input / view pulled up to ceiling - +Disabled: True diff --git a/staging/upstream-commit b/staging/upstream-commit index ecd208ec..72a710de 100644 --- a/staging/upstream-commit +++ b/staging/upstream-commit @@ -1 +1 @@ -23f98e9663a1737c94f6bd6c7612baa8b4a47bc5 +8cb68e43dec6e6bb32fcdf82e03a6d4263dd2354