src/joystick/android/SDL_sysjoystick.c
changeset 7956 965b7e09c5a8
parent 7944 f19c0aca56aa
child 8008 5e5819ca19db
     1.1 --- a/src/joystick/android/SDL_sysjoystick.c	Mon Nov 11 03:29:11 2013 -0800
     1.2 +++ b/src/joystick/android/SDL_sysjoystick.c	Mon Nov 11 10:15:35 2013 -0300
     1.3 @@ -308,7 +308,10 @@
     1.4  int
     1.5  Android_OnPadDown(int padId, int keycode)
     1.6  {
     1.7 -    SDL_PrivateJoystickButton(SYS_Joysticks[padId], keycode_to_SDL(keycode), SDL_PRESSED);
     1.8 +    int button = keycode_to_SDL(keycode);
     1.9 +    if (button >= 0) {
    1.10 +        SDL_PrivateJoystickButton(SYS_Joysticks[padId], button , SDL_PRESSED);
    1.11 +    }
    1.12      
    1.13      return 0;
    1.14  }
    1.15 @@ -316,7 +319,10 @@
    1.16  int
    1.17  Android_OnPadUp(int padId, int keycode)
    1.18  {
    1.19 -    SDL_PrivateJoystickButton(SYS_Joysticks[padId], keycode_to_SDL(keycode), SDL_RELEASED);
    1.20 +    int button = keycode_to_SDL(keycode);
    1.21 +    if (button >= 0) {
    1.22 +        SDL_PrivateJoystickButton(SYS_Joysticks[padId], button, SDL_RELEASED);
    1.23 +    }
    1.24      
    1.25      return 0;
    1.26  }