Cleanups in the joystick code.

Removed some redundant state and other confusions.

Fixes Bugzilla #2738.

--HG--
extra : rebase_source : 35dd561553379e00eb8d169ce12ecc99393b2f84
This commit is contained in:
Ryan C. Gordon 2015-03-24 13:52:01 -04:00
parent e03d7a79a9
commit 3ff618a9c7
15 changed files with 24 additions and 59 deletions

View file

@ -206,10 +206,6 @@ SDL_PrivateJoystickValid(SDL_Joystick * joystick)
valid = 1;
}
if (joystick && joystick->closed) {
valid = 0;
}
return valid;
}
@ -412,6 +408,7 @@ SDL_JoystickClose(SDL_Joystick * joystick)
}
SDL_SYS_JoystickClose(joystick);
joystick->hwdata = NULL;
joysticklist = SDL_joysticks;
joysticklistprev = NULL;
@ -668,7 +665,7 @@ SDL_JoystickUpdate(void)
SDL_SYS_JoystickUpdate(joystick);
if (joystick->closed && joystick->uncentered) {
if (joystick->force_recentering) {
int i;
/* Tell the app that everything is centered/unpressed... */
@ -681,7 +678,7 @@ SDL_JoystickUpdate(void)
for (i = 0; i < joystick->nhats; i++)
SDL_PrivateJoystickHat(joystick, i, SDL_HAT_CENTERED);
joystick->uncentered = SDL_FALSE;
joystick->force_recentering = SDL_FALSE;
}
SDL_updating_joystick = NULL;