src/haptic/linux/SDL_syshaptic.c
branchgsoc2008_force_feedback
changeset 2647 e871cff1e3d2
parent 2646 9408be170bff
equal deleted inserted replaced
2646:9408be170bff 2647:e871cff1e3d2
   914  * Stops all the currently playing effects.
   914  * Stops all the currently playing effects.
   915  */
   915  */
   916 int
   916 int
   917 SDL_SYS_HapticStopAll(SDL_Haptic * haptic)
   917 SDL_SYS_HapticStopAll(SDL_Haptic * haptic)
   918 {
   918 {
   919    int i, ret;;
   919    int i, ret;
   920 
   920 
       
   921    /* Linux does not support this natively so we have to loop. */
   921    for (i=0; i<haptic->neffects; i++) {
   922    for (i=0; i<haptic->neffects; i++) {
   922       ret = SDL_SYS_HapticStopEffect(haptic, &haptic->effects[i]);
   923       if (haptic->effects[i].hweffect != NULL) {
   923       if (ret < 0) {
   924          ret = SDL_SYS_HapticStopEffect(haptic, &haptic->effects[i]);
   924          SDL_SetError("Haptic: Error while trying to stop all playing effects.");
   925          if (ret < 0) {
   925          return -1;
   926             SDL_SetError("Haptic: Error while trying to stop all playing effects.");
       
   927             return -1;
       
   928          }
   926       }
   929       }
   927    }
   930    }
   928 
       
   929    return 0;
   931    return 0;
   930 }
   932 }
   931 
   933 
   932 
   934 
   933 #endif /* SDL_HAPTIC_LINUX */
   935 #endif /* SDL_HAPTIC_LINUX */