Skip to content

Commit

Permalink
Fixed building with --disable-joystick on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed May 27, 2020
1 parent af5eb56 commit 03a7abf
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/haptic/darwin/SDL_syshaptic.c
Expand Up @@ -599,12 +599,14 @@ SDL_SYS_HapticMouse(void)
int
SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick)
{
#ifdef SDL_JOYSTICK_IOKIT
if (joystick->driver != &SDL_DARWIN_JoystickDriver) {
return SDL_FALSE;
}
if (joystick->hwdata->ffservice != 0) {
return SDL_TRUE;
}
#endif
return SDL_FALSE;
}

Expand All @@ -615,13 +617,15 @@ SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick)
int
SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
{
#ifdef SDL_JOYSTICK_IOKIT
if (joystick->driver != &SDL_DARWIN_JoystickDriver) {
return 0;
}
if (IOObjectIsEqualTo((io_object_t) ((size_t)haptic->hwdata->device),
joystick->hwdata->ffservice)) {
return 1;
}
#endif
return 0;
}

Expand All @@ -632,6 +636,7 @@ SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick)
int
SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
{
#ifdef SDL_JOYSTICK_IOKIT
int device_index = 0;
SDL_hapticlist_item *item;

Expand All @@ -648,6 +653,9 @@ SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
}

return SDL_SYS_HapticOpenFromService(haptic, joystick->hwdata->ffservice);
#else
return -1;
#endif
}


Expand Down

0 comments on commit 03a7abf

Please sign in to comment.