Need to get cooperative level before acquiring. gsoc2008_force_feedback
authorEdgar Simo <bobbens@gmail.com>
Mon, 04 Aug 2008 17:03:20 +0000
branchgsoc2008_force_feedback
changeset 2587b4b3beaea5b5
parent 2586 d84c99f5401e
child 2588 57bd3e462138
Need to get cooperative level before acquiring.
src/haptic/win32/SDL_syshaptic.c
     1.1 --- a/src/haptic/win32/SDL_syshaptic.c	Mon Aug 04 15:58:01 2008 +0000
     1.2 +++ b/src/haptic/win32/SDL_syshaptic.c	Mon Aug 04 17:03:20 2008 +0000
     1.3 @@ -228,6 +228,7 @@
     1.4   *       - Open temporary DirectInputDevice interface.
     1.5   *       - Create DirectInputDevice2 interface.
     1.6   *       - Release DirectInputDevice interface.
     1.7 + *       - Set cooperative level.
     1.8   *       - Acquire exclusiveness.
     1.9   *       - Reset actuators.
    1.10   *       - Get supported featuers.
    1.11 @@ -267,13 +268,6 @@
    1.12        goto creat_err;
    1.13     }
    1.14  
    1.15 -   /* Acquire the device. */
    1.16 -   ret = IDirectInputDevice2_Acquire(haptic->hwdata->device);
    1.17 -   if (FAILED(ret)) {
    1.18 -      DI_SetError("Acquiring DirectInput device",ret);
    1.19 -      goto query_err;
    1.20 -   }
    1.21 -
    1.22     /* Grab it exclusively to use force feedback stuff. */
    1.23     ret =IDirectInputDevice2_SetCooperativeLevel( haptic->hwdata->device,
    1.24                                                   SDL_HelperWindow,
    1.25 @@ -283,6 +277,13 @@
    1.26        goto acquire_err;
    1.27     }
    1.28  
    1.29 +   /* Acquire the device. */
    1.30 +   ret = IDirectInputDevice2_Acquire(haptic->hwdata->device);
    1.31 +   if (FAILED(ret)) {
    1.32 +      DI_SetError("Acquiring DirectInput device",ret);
    1.33 +      goto query_err;
    1.34 +   }
    1.35 +
    1.36     /* Reset all actuators - just in case. */
    1.37     ret = IDirectInputDevice2_SendForceFeedbackCommand( haptic->hwdata->device,
    1.38                                                         DISFFC_RESET );