Skip to content

Commit

Permalink
Fixed building with --disable-joystick on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed May 27, 2020
1 parent e9f567c commit cf01ee1
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/haptic/linux/SDL_syshaptic.c
Expand Up @@ -512,10 +512,15 @@ SDL_SYS_HapticMouse(void)
int
SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick)
{
#ifdef SDL_JOYSTICK_LINUX
if (joystick->driver != &SDL_LINUX_JoystickDriver) {
return 0;
return SDL_FALSE;
}
if (EV_IsHaptic(joystick->hwdata->fd)) {
return SDL_TRUE;
}
return EV_IsHaptic(joystick->hwdata->fd);
#endif
return SDL_FALSE;
}


Expand All @@ -525,6 +530,7 @@ SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick)
int
SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
{
#ifdef SDL_JOYSTICK_LINUX
if (joystick->driver != &SDL_LINUX_JoystickDriver) {
return 0;
}
Expand All @@ -533,6 +539,7 @@ SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
if (SDL_strcmp(joystick->hwdata->fname, haptic->hwdata->fname) == 0) {
return 1;
}
#endif
return 0;
}

Expand All @@ -543,6 +550,7 @@ SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
int
SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
{
#ifdef SDL_JOYSTICK_LINUX
int device_index = 0;
int fd;
int ret;
Expand Down Expand Up @@ -577,6 +585,9 @@ SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
haptic->hwdata->fname = SDL_strdup( joystick->hwdata->fname );

return 0;
#else
return -1;
#endif
}


Expand Down

0 comments on commit cf01ee1

Please sign in to comment.