virtualx-engine/platform/x11
Connor Lirot 1e01963d29
Fix for linux joypad D-pad zeroing
Some controllers (notably those made by 8bitdo) do not always emit an event to zero out a D-pad axis before flipping direction. For example, when rolling around aggressively the D-pad of an 8bitdo SN30 Pro/Pro+, the following may be observed:

```
ABS_HAT0X : -1
ABS_HAT0Y : -1
ABS_HAT0Y : 0
ABS_HAT0Y : 1
ABS_HAT0X : 1
```

Notable here is that no event for `ABS_HAT0X: 0` is emitted between the events for `ABS_HAT0X: -1` and `ABS_HAT0X: 1`. Consequently, the game engine believes that both the negative _and_ positive x-axis directions of the D-pad are activated simultaneously (i.e `is_joy_button_pressed()` returns `true` for both `JOY_BUTTON_DPAD_LEFT` and `JOY_BUTTON_DPAD_RIGHT`), which should be impossible.

This issue is _not_ reproducible on all controllers. The Xbox One controller in particular will not exhibit this problem (it always emits zeroing out events for an axis before flipping direction).

The fix is to always zero out the opposite direction on the D-pad axis in question when processing an event with a nonzero value. This unfortunately wastes a small number of CPU cycles on controllers that behave nicely.

**I have verified this issue is also reproducible in the stable 3.2 branch**

(cherry picked from commit dd021099ff)
2020-11-17 12:07:01 +01:00
..
export Adding missing include guards to header files identified by LGTM. 2020-03-25 11:38:54 +01:00
context_gl_x11.cpp Implement no-window mode for X11 and MacOS 2020-11-09 20:56:12 +01:00
context_gl_x11.h Add get_native_handle to OS 2020-10-20 20:23:37 +11:00
crash_handler_x11.cpp Fix warning in Linux crash handler on 32-bit 2020-01-10 14:28:21 +01:00
crash_handler_x11.h Update copyright statements to 2020 2020-01-01 11:16:22 +01:00
detect.py Remove debug_symbols=full in favor of debug_symbols=yes 2020-11-11 15:12:01 +01:00
detect_prime.cpp Remove unused classes and stray headers 2020-03-25 11:38:54 +01:00
detect_prime.h Update copyright statements to 2020 2020-01-01 11:16:22 +01:00
godot_x11.cpp Update copyright statements to 2020 2020-01-01 11:16:22 +01:00
joypad_linux.cpp Fix for linux joypad D-pad zeroing 2020-11-17 12:07:01 +01:00
joypad_linux.h Update copyright statements to 2020 2020-01-01 11:16:22 +01:00
key_mapping_x11.cpp Update copyright statements to 2020 2020-01-01 11:16:22 +01:00
key_mapping_x11.h Update copyright statements to 2020 2020-01-01 11:16:22 +01:00
logo.png Optimize images losslessly using oxipng -o6 --strip all --zopfli 2018-06-28 19:17:41 +02:00
os_x11.cpp Implement no-window mode for X11 and MacOS 2020-11-09 20:56:12 +01:00
os_x11.h Add get_native_handle to OS 2020-10-20 20:23:37 +11:00
pck_embed.ld Fix error exporting to X11 with embedded PCK 2020-01-16 17:47:37 +01:00
pck_embed.legacy.ld Fix error exporting to X11 with embedded PCK 2020-01-16 17:47:37 +01:00
platform_config.h Linux/BSD: Fix support for NetBSD 2020-09-18 10:29:52 +02:00
platform_x11_builders.py SCons: Format buildsystem files with psf/black 2020-06-10 15:30:52 +02:00
power_x11.cpp Update copyright statements to 2020 2020-01-01 11:16:22 +01:00
power_x11.h Update copyright statements to 2020 2020-01-01 11:16:22 +01:00
SCsub Remove debug_symbols=full in favor of debug_symbols=yes 2020-11-11 15:12:01 +01:00