diff src/haptic/win32/SDL_syshaptic.c @ 2587:b4b3beaea5b5 gsoc2008_force_feedback

Need to get cooperative level before acquiring.
author Edgar Simo <bobbens@gmail.com>
date Mon, 04 Aug 2008 17:03:20 +0000
parents 64fa227c01ce
children 57bd3e462138
line wrap: on
line diff
--- 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 );