[PATCH] dinput: Initialize js state with sane values when the application acquires the device instead of at allocation.

Loïc Hoguin essen at dev-extend.eu
Thu Dec 31 20:56:40 CST 2009


---
 dlls/dinput/joystick_linuxinput.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c
index 6c3c8cc..9142519 100644
--- a/dlls/dinput/joystick_linuxinput.c
+++ b/dlls/dinput/joystick_linuxinput.c
@@ -491,8 +491,6 @@ static JoystickImpl *alloc_device(REFGUID rguid, const void *jvt, IDirectInputIm
     df->dwNumObjs = idx;
     newDevice->generic.base.data_format.wine_df = df;
 
-    fake_current_js_state(newDevice);
-
     /* Fill the caps */
     newDevice->generic.devcaps.dwSize = sizeof(newDevice->generic.devcaps);
     newDevice->generic.devcaps.dwFlags = DIDC_ATTACHED;
@@ -660,6 +658,12 @@ static HRESULT WINAPI JoystickAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
         }
     }
 
+    /* Get sane state values for the joystick before giving control to the application.
+       Before this call was made in alloc_device, before the application sets the joystick
+       properties, so the values given by fake_current_js_state weren't in the range
+       of values expected by a few applications. */
+    fake_current_js_state(This);
+
     return DI_OK;
 }
 
-- 
1.6.3.3


--------------010103060901020000080307--





More information about the wine-patches mailing list