[SVN] r4025 - branches/gsoc2008_force_feedback/src/haptic/linux

svn-owner at libsdl.org svn-owner at libsdl.org
Sun Aug 24 10:41:22 PDT 2008


Author: bobbens
Date: 2008-08-24 10:41:22 -0700 (Sun, 24 Aug 2008)
New Revision: 4025

Modified:
   branches/gsoc2008_force_feedback/src/haptic/linux/SDL_syshaptic.c
Log:
Fixed linux implementation of SDL_HapticStopAll.


Modified: branches/gsoc2008_force_feedback/src/haptic/linux/SDL_syshaptic.c
===================================================================
--- branches/gsoc2008_force_feedback/src/haptic/linux/SDL_syshaptic.c	2008-08-24 17:32:50 UTC (rev 4024)
+++ branches/gsoc2008_force_feedback/src/haptic/linux/SDL_syshaptic.c	2008-08-24 17:41:22 UTC (rev 4025)
@@ -916,16 +916,18 @@
 int
 SDL_SYS_HapticStopAll(SDL_Haptic * haptic)
 {
-   int i, ret;;
+   int i, ret;
 
+   /* Linux does not support this natively so we have to loop. */
    for (i=0; i<haptic->neffects; i++) {
-      ret = SDL_SYS_HapticStopEffect(haptic, &haptic->effects[i]);
-      if (ret < 0) {
-         SDL_SetError("Haptic: Error while trying to stop all playing effects.");
-         return -1;
+      if (haptic->effects[i].hweffect != NULL) {
+         ret = SDL_SYS_HapticStopEffect(haptic, &haptic->effects[i]);
+         if (ret < 0) {
+            SDL_SetError("Haptic: Error while trying to stop all playing effects.");
+            return -1;
+         }
       }
    }
-
    return 0;
 }
 




More information about the commits mailing list