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 2587 b4b3beaea5b5
parent 2586 d84c99f5401e
child 2588 57bd3e462138
Need to get cooperative level before acquiring.
src/haptic/win32/SDL_syshaptic.c
--- a/src/haptic/win32/SDL_syshaptic.c	Mon Aug 04 15:58:01 2008 +0000
+++ b/src/haptic/win32/SDL_syshaptic.c	Mon Aug 04 17:03:20 2008 +0000
@@ -228,6 +228,7 @@
  *       - Open temporary DirectInputDevice interface.
  *       - Create DirectInputDevice2 interface.
  *       - Release DirectInputDevice interface.
+ *       - Set cooperative level.
  *       - Acquire exclusiveness.
  *       - Reset actuators.
  *       - Get supported featuers.
@@ -267,13 +268,6 @@
       goto creat_err;
    }
 
-   /* Acquire the device. */
-   ret = IDirectInputDevice2_Acquire(haptic->hwdata->device);
-   if (FAILED(ret)) {
-      DI_SetError("Acquiring DirectInput device",ret);
-      goto query_err;
-   }
-
    /* Grab it exclusively to use force feedback stuff. */
    ret =IDirectInputDevice2_SetCooperativeLevel( haptic->hwdata->device,
                                                  SDL_HelperWindow,
@@ -283,6 +277,13 @@
       goto acquire_err;
    }
 
+   /* Acquire the device. */
+   ret = IDirectInputDevice2_Acquire(haptic->hwdata->device);
+   if (FAILED(ret)) {
+      DI_SetError("Acquiring DirectInput device",ret);
+      goto query_err;
+   }
+
    /* Reset all actuators - just in case. */
    ret = IDirectInputDevice2_SendForceFeedbackCommand( haptic->hwdata->device,
                                                        DISFFC_RESET );