src/joystick/linux/SDL_sysjoystick.c
changeset 7860 2b0bcdea3a79
parent 7802 d239ba573818
child 7909 4434ab25abf3
equal deleted inserted replaced
7859:af63b63e7aac 7860:2b0bcdea3a79
   615 SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
   615 SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick)
   616 {
   616 {
   617     return !joystick->closed && (joystick->hwdata->item != NULL);
   617     return !joystick->closed && (joystick->hwdata->item != NULL);
   618 }
   618 }
   619 
   619 
   620 static __inline__ void
   620 static SDL_INLINE void
   621 HandleHat(SDL_Joystick * stick, Uint8 hat, int axis, int value)
   621 HandleHat(SDL_Joystick * stick, Uint8 hat, int axis, int value)
   622 {
   622 {
   623     struct hwdata_hat *the_hat;
   623     struct hwdata_hat *the_hat;
   624     const Uint8 position_map[3][3] = {
   624     const Uint8 position_map[3][3] = {
   625         {SDL_HAT_LEFTUP, SDL_HAT_UP, SDL_HAT_RIGHTUP},
   625         {SDL_HAT_LEFTUP, SDL_HAT_UP, SDL_HAT_RIGHTUP},
   641                                position_map[the_hat->
   641                                position_map[the_hat->
   642                                             axis[1]][the_hat->axis[0]]);
   642                                             axis[1]][the_hat->axis[0]]);
   643     }
   643     }
   644 }
   644 }
   645 
   645 
   646 static __inline__ void
   646 static SDL_INLINE void
   647 HandleBall(SDL_Joystick * stick, Uint8 ball, int axis, int value)
   647 HandleBall(SDL_Joystick * stick, Uint8 ball, int axis, int value)
   648 {
   648 {
   649     stick->hwdata->balls[ball].axis[axis] += value;
   649     stick->hwdata->balls[ball].axis[axis] += value;
   650 }
   650 }
   651 
   651 
   652 
   652 
   653 static __inline__ int
   653 static SDL_INLINE int
   654 AxisCorrect(SDL_Joystick * joystick, int which, int value)
   654 AxisCorrect(SDL_Joystick * joystick, int which, int value)
   655 {
   655 {
   656     struct axis_correct *correct;
   656     struct axis_correct *correct;
   657 
   657 
   658     correct = &joystick->hwdata->abs_correct[which];
   658     correct = &joystick->hwdata->abs_correct[which];
   677         return 32767;
   677         return 32767;
   678 
   678 
   679     return value;
   679     return value;
   680 }
   680 }
   681 
   681 
   682 static __inline__ void
   682 static SDL_INLINE void
   683 PollAllValues(SDL_Joystick * joystick)
   683 PollAllValues(SDL_Joystick * joystick)
   684 {
   684 {
   685     struct input_absinfo absinfo;
   685     struct input_absinfo absinfo;
   686     int a, b = 0;
   686     int a, b = 0;
   687 
   687 
   715             b++;
   715             b++;
   716         }
   716         }
   717     }
   717     }
   718 }
   718 }
   719 
   719 
   720 static __inline__ void
   720 static SDL_INLINE void
   721 HandleInputEvents(SDL_Joystick * joystick)
   721 HandleInputEvents(SDL_Joystick * joystick)
   722 {
   722 {
   723     struct input_event events[32];
   723     struct input_event events[32];
   724     int i, len;
   724     int i, len;
   725     int code;
   725     int code;