src/haptic/darwin/SDL_syshaptic.c
branchgsoc2008_force_feedback
changeset 2554 2681a04c2d3d
parent 2553 3f853f075bc0
child 2555 f5bcc926bac4
     1.1 --- a/src/haptic/darwin/SDL_syshaptic.c	Wed Jul 30 14:09:10 2008 +0000
     1.2 +++ b/src/haptic/darwin/SDL_syshaptic.c	Wed Jul 30 14:48:34 2008 +0000
     1.3 @@ -309,8 +309,8 @@
     1.4     FF_TEST(FFCAP_ET_CUSTOMFORCE,   SDL_HAPTIC_CUSTOM);
     1.5  
     1.6     /* Check if supports gain. */
     1.7 -   ret = FFDeviceGetForceFeedbackProperty(device, FFPROP_FFGAIN,
     1.8 -                                          &val, sizeof(val));
     1.9 +   ret = FFDeviceGetForceFeedbackProperty( device, FFPROP_FFGAIN,
    1.10 +                                           &val, sizeof(val));
    1.11     if (ret == FF_OK) supported |= SDL_HAPTIC_GAIN;
    1.12     else if (ret != FFERR_UNSUPPORTED) {
    1.13        SDL_SetError("Haptic: Unable to get if device supports gain: %s.",
    1.14 @@ -514,6 +514,23 @@
    1.15  
    1.16  
    1.17  /*
    1.18 + * Converts an SDL trigger button to an FFEFFECT trigger button.
    1.19 + */
    1.20 +static DWORD
    1.21 +FFGetTriggerButton( Uint16 button )
    1.22 +{
    1.23 +   DWORD dwTriggerButton;
    1.24 +
    1.25 +   dwTriggerButton = FFEB_NOTRIGGER;
    1.26 +
    1.27 +   if (hap_constant->button != 0)
    1.28 +      dwTriggerButton = FFJOFS_BUTTON(hap_constant->button);
    1.29 +
    1.30 +   return dwTriggerButton;
    1.31 +}
    1.32 +
    1.33 +
    1.34 +/*
    1.35   * Sets the direction.
    1.36   */
    1.37  static int
    1.38 @@ -634,7 +651,7 @@
    1.39  
    1.40           /* Generics */
    1.41           dest->dwDuration = hap_constant->length * 1000; /* In microseconds. */
    1.42 -         dest->dwTriggerButton = FFJOFS_BUTTON(hap_constant->button);
    1.43 +         dest->dwTriggerButton = FFGetTriggerButton(hap_constant->button);
    1.44           dest->dwTriggerRepeatInterval = hap_constant->interval;
    1.45           dest->dwStartDelay = hap_constant->delay * 1000; /* In microseconds. */
    1.46  
    1.47 @@ -674,7 +691,7 @@
    1.48  
    1.49           /* Generics */
    1.50           dest->dwDuration = hap_periodic->length * 1000; /* In microseconds. */
    1.51 -         dest->dwTriggerButton = FFJOFS_BUTTON(hap_periodic->button);
    1.52 +         dest->dwTriggerButton = FFGetTriggerButton(hap_periodic->button);
    1.53           dest->dwTriggerRepeatInterval = hap_periodic->interval;
    1.54           dest->dwStartDelay = hap_periodic->delay * 1000; /* In microseconds. */
    1.55           
    1.56 @@ -717,7 +734,7 @@
    1.57  
    1.58           /* Generics */
    1.59           dest->dwDuration = hap_condition->length * 1000; /* In microseconds. */
    1.60 -         dest->dwTriggerButton = FFJOFS_BUTTON(hap_condition->button);
    1.61 +         dest->dwTriggerButton = FFGetTriggerButton(hap_condition->button);
    1.62           dest->dwTriggerRepeatInterval = hap_condition->interval;
    1.63           dest->dwStartDelay = hap_condition->delay * 1000; /* In microseconds. */
    1.64  
    1.65 @@ -753,7 +770,7 @@
    1.66  
    1.67           /* Generics */
    1.68           dest->dwDuration = hap_ramp->length * 1000; /* In microseconds. */
    1.69 -         dest->dwTriggerButton = FFJOFS_BUTTON(hap_ramp->button);
    1.70 +         dest->dwTriggerButton = FFGetTriggerButton(hap_ramp->button);
    1.71           dest->dwTriggerRepeatInterval = hap_ramp->interval;
    1.72           dest->dwStartDelay = hap_ramp->delay * 1000; /* In microseconds. */
    1.73  
    1.74 @@ -792,7 +809,7 @@
    1.75  
    1.76           /* Generics */
    1.77           dest->dwDuration = hap_custom->length * 1000; /* In microseconds. */
    1.78 -         dest->dwTriggerButton = FFJOFS_BUTTON(hap_custom->button);
    1.79 +         dest->dwTriggerButton = FFGetTriggerButton(hap_custom->button);
    1.80           dest->dwTriggerRepeatInterval = hap_custom->interval;
    1.81           dest->dwStartDelay = hap_custom->delay * 1000; /* In microseconds. */
    1.82