This patch series should fix several spurious mouse movement issues that has been reported in recent Unity Engine versions, but in other games such as Fallout 4 as well.
AFAICS the issue comes from the combination of:
1) The reconciliation that is done between relative mouse movements as received from RawMotion XInput2 events and the absolute mouse position received from MotionNotify and ButtonPress/ButtonRelease events and the order they are received in. 2) The rapid activation and deactivation of XInput2 events that happens every time the cursor clipping rectangle is reset - and several games do that on every frame.
This first implements dinput8 mouse on top of RawInput API instead of low-level mouse hooks. Then, to address 1) it makes XInput2 raw events the only source of information for the mouse RawInput messages; and to address 2) we now always listen to these events, from the desktop window thread.
The first two patches have already been sent as part of the patches implementing WM_INPUT messages for HID devices [1].
Patches 3-6 would also be re-used for the dinput8 keyboard state inconsistency issue while windows are in background - if listening to keyboard events while in background is deemed acceptable.
[1] https://www.winehq.org/pipermail/wine-devel/2019-September/151003.html
Rémi Bernon (9): server: Add send_hardware_message flags for rawinput translation. server: Implement rawinput hardware message broadcast. user32: Add __wine_send_input flags to hint raw input translation. user32: Add support for RIDEV_INPUTSINK flag in RegisterRawInputDevices. user32: Implement GetRegisteredRawInputDevices. dinput8: Add support for dinput devices that use raw input interface. dinput8: Use raw input interface for dinput8 mouse device. winex11.drv: Advertise XInput2 version 2.1 support. winex11.drv: Listen to RawMotion and RawButton* events in the desktop thread.
dlls/dinput/device_private.h | 3 + dlls/dinput/dinput_main.c | 84 +++++++++++++++++++- dlls/dinput/mouse.c | 117 ++++++++++++++++++++++++++- dlls/dinput8/tests/device.c | 23 +----- dlls/user32/input.c | 4 +- dlls/user32/rawinput.c | 64 ++++++++++++++- dlls/user32/tests/rawinput.c | 2 - dlls/user32/user32.spec | 2 +- dlls/wineandroid.drv/keyboard.c | 2 +- dlls/wineandroid.drv/window.c | 4 +- dlls/winemac.drv/ime.c | 4 +- dlls/winemac.drv/keyboard.c | 2 +- dlls/winemac.drv/mouse.c | 2 +- dlls/winex11.drv/event.c | 10 ++- dlls/winex11.drv/keyboard.c | 2 +- dlls/winex11.drv/mouse.c | 128 +++++++++++++++++------------- dlls/winex11.drv/x11drv.h | 6 +- dlls/winex11.drv/x11drv_main.c | 4 + include/winuser.h | 2 +- server/protocol.def | 9 +++ server/queue.c | 135 ++++++++++++++++++++++++++------ 21 files changed, 489 insertions(+), 120 deletions(-)
-- 2.23.0