Only check SDL_SYS_JoystickNeedsPolling() if we know we don't need to poll for other reasons. This avoids a select() syscall on Linux if it isn't necessary.

This commit is contained in:
Sam Lantinga 2012-12-14 09:22:13 -08:00
parent 6b4cb17219
commit 80493dfae0
2 changed files with 8 additions and 13 deletions

View file

@ -70,9 +70,9 @@ static __inline__ SDL_bool
SDL_ShouldPollJoystick()
{
#if !SDL_JOYSTICK_DISABLED
if (SDL_PrivateJoystickNeedsPolling() &&
(!SDL_disabled_events[SDL_JOYAXISMOTION >> 8] ||
SDL_JoystickEventState(SDL_QUERY))) {
if ((!SDL_disabled_events[SDL_JOYAXISMOTION >> 8] ||
SDL_JoystickEventState(SDL_QUERY)) &&
SDL_PrivateJoystickNeedsPolling()) {
return SDL_TRUE;
}
#endif