From cf01ee1694ae59c5cb242df8e7a303da38d46a9a Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 27 May 2020 10:27:04 -0700 Subject: [PATCH] Fixed building with --disable-joystick on Linux --- src/haptic/linux/SDL_syshaptic.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/haptic/linux/SDL_syshaptic.c b/src/haptic/linux/SDL_syshaptic.c index 3a2fbf695..81ea0bf62 100644 --- a/src/haptic/linux/SDL_syshaptic.c +++ b/src/haptic/linux/SDL_syshaptic.c @@ -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; } - return EV_IsHaptic(joystick->hwdata->fd); + if (EV_IsHaptic(joystick->hwdata->fd)) { + return SDL_TRUE; + } +#endif + return SDL_FALSE; } @@ -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; } @@ -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; } @@ -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; @@ -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 }