# HG changeset patch
# User Edgar Simo <bobbens@gmail.com>
# Date 1217869400 0
# Node ID b4b3beaea5b5fb10fce6f90f64dfa0abd2dd8144
# Parent  d84c99f5401edb364e85f5e9917469fecd19ff42
Need to get cooperative level before acquiring.

diff -r d84c99f5401e -r b4b3beaea5b5 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 );