https://bugs.winehq.org/show_bug.cgi?id=49163
Bug ID: 49163 Summary: rawinput_mouse_experimental mishandles xf86_input_joystick axis handling Product: Wine-staging Version: 5.8 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: major Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: skotlex@mailforce.net CC: leslie_alistair@hotmail.com, z.figura12@gmail.com Distribution: ---
Case scenario where the issue occurs: 1. Playing a game like Guild Wars 2, enabling "action camera" (in which the cursor vanishes and moving the mouse causes the camera to move around). 2. Using xf86_input_joystick to use a gamepad axis to handle the pointer.
Results: The camera becomes "stuck" at a specific angle/direction, and no matter the movement of the joystick, the view angle isn't changed. When "action camera" is disabled, the mouse moves appropriately, but whenever reenabled, the view becomes stuck at the same vector.
This doesn't occur on wine-vanilla-5.8, or wine-staging-4.21, it's present in all wine-staging-5.x versions, and I've traced the origin to the patchset "user32_rawinput_mouse_experimental", specifically the patch "user32-rawinput-mouse-experimental/0001-winex11.drv-Add-support-for-absolute-RawMotion-event.patch"
The bug doesn't occur when using the touchpad, only when using a gamepad. The touchpad registers its axes as Relative (checking the runtime code in process_rawinput_message()), however the gamepad does them as Absolute.
Checking the code of xf86_input_joystick I see these two calls that stand out: 1. In jstk.c, function jstkDeviceControlProc, joystick axes are initialized with InitValuatorAxisStruct() with mode Absolute, probably because the joystick itself reports axis data in absolute mode.
2. However, axis handling and parsing of data is done in jstk_axis.c, and when it's time to invoke a movement event, it calls xf86PostMotionEvent (from either the jstkAxisTimer() or jstkHandleAbsoluteAxis()) with the argument "is_absolute=0" in all cases.
If I modify process_rawinput_message() to set the input as MOUSE_MOVE_RELATIVE regardless of msg_data->flags, it works (though the camera is super-sensitive to movement), obviously that isn't the right solution, but confirms the issue is related to the device's mode handling.
I am not completely certain the bug belongs in wine rather than xorg, but considering that it's the first time I have an issue with the gamepad driver, and it's caused by a wine-experimental-patchset, I decided to report here first.