Commit e57beed8 authored by Rafael Kitover's avatar Rafael Kitover
Browse files

ignore depressed gamepad triggers #88

On joystick event notification, filter out axis values that are equal to
their initial state.

The reason for doing this is explained in 539027ca. Triggers on e.g. the
360 controller are an axis that are the max negative value in the
depressed state, and for some reason a constant stream of events are
generated for them, that's another issue that needs to be addressed.

For the time being, this fixes the other half of the main issue in #88:
users with an old config with the default special key bindings will now
be able to use keyboard hotkeys as these spurious joystick events will
be filtered out and will not block keyboard events.

TODO:

- stop generating events for depressed triggers in the first place

- fix joystick events completely blocking keyboard events
parent 979ef8eb
......@@ -134,6 +134,11 @@ void wxSDLJoy::Notify()
for (int j = 0; j < nax; j++) {
val = SDL_JoystickGetAxis(dev, j);
// trigger axes always return max negative value, we ignore these
int16_t initial_state;
if (SDL_JoystickGetAxisInitialState(dev, j, &initial_state) && val == initial_state)
continue;
if (digital) {
if (val > 0x3fff)
val = 0x7fff;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment