Fixed building with --disable-joystick on Linux
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
diff --git a/src/haptic/linux/SDL_syshaptic.c b/src/haptic/linux/SDL_syshaptic.c
index 3a2fbf6..81ea0bf 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;
+ }
+ if (EV_IsHaptic(joystick->hwdata->fd)) {
+ return SDL_TRUE;
}
- return EV_IsHaptic(joystick->hwdata->fd);
+#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
}