Skip to content

Commit

Permalink
Avoid duplicate joystick axis events
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Sep 22, 2017
1 parent d74c00e commit 5ab5c9b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/joystick/SDL_joystick.c
Expand Up @@ -672,6 +672,9 @@ SDL_PrivateJoystickAxis(SDL_Joystick * joystick, Uint8 axis, Sint16 value)
joystick->axes[axis].zero = value;
joystick->axes[axis].has_initial_value = SDL_TRUE;
}
if (value == joystick->axes[axis].value) {
return 0;
}
if (!joystick->axes[axis].sent_initial_value) {
/* Make sure we don't send motion until there's real activity on this axis */
const int MAX_ALLOWED_JITTER = SDL_JOYSTICK_AXIS_MAX / 80; /* ShanWan PS3 controller needed 96 */
Expand Down

0 comments on commit 5ab5c9b

Please sign in to comment.