Rémi Bernon : dinput: Factor out IDirectInputDevice_GetCapabilities WtoA conversions.

Alexandre Julliard julliard at winehq.org
Thu May 27 16:02:09 CDT 2021


Module: wine
Branch: master
Commit: 5eb5f94fc0c5d5ace256e75122f675722d0527f8
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=5eb5f94fc0c5d5ace256e75122f675722d0527f8

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Thu May 27 10:50:01 2021 +0200

dinput: Factor out IDirectInputDevice_GetCapabilities WtoA conversions.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dinput/ansi.c                | 7 +++++++
 dlls/dinput/device_private.h      | 1 +
 dlls/dinput/joystick.c            | 6 ------
 dlls/dinput/joystick_linux.c      | 2 +-
 dlls/dinput/joystick_linuxinput.c | 2 +-
 dlls/dinput/joystick_osx.c        | 2 +-
 dlls/dinput/joystick_private.h    | 1 -
 dlls/dinput/keyboard.c            | 8 +-------
 dlls/dinput/mouse.c               | 8 +-------
 9 files changed, 13 insertions(+), 24 deletions(-)

diff --git a/dlls/dinput/ansi.c b/dlls/dinput/ansi.c
index 4e9a9af7a83..d61fdb07e4f 100644
--- a/dlls/dinput/ansi.c
+++ b/dlls/dinput/ansi.c
@@ -130,6 +130,13 @@ ULONG WINAPI IDirectInputDevice2AImpl_Release( IDirectInputDevice8A *iface_a )
     return IDirectInputDevice8_Release( iface_w );
 }
 
+HRESULT WINAPI IDirectInputDevice2AImpl_GetCapabilities( IDirectInputDevice8A *iface_a, DIDEVCAPS *caps )
+{
+    IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a );
+    IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl );
+    return IDirectInputDevice8_GetCapabilities( iface_w, caps );
+}
+
 struct enum_objects_wtoa_params
 {
     LPDIENUMDEVICEOBJECTSCALLBACKA callback;
diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h
index 56718790040..f8cfd98f9b3 100644
--- a/dlls/dinput/device_private.h
+++ b/dlls/dinput/device_private.h
@@ -144,6 +144,7 @@ extern HRESULT WINAPI IDirectInputDevice2AImpl_SetEventNotification(LPDIRECTINPU
 extern HRESULT WINAPI IDirectInputDevice2WImpl_SetEventNotification(LPDIRECTINPUTDEVICE8W iface, HANDLE hnd) DECLSPEC_HIDDEN;
 extern ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE8A iface)  DECLSPEC_HIDDEN;
 extern ULONG WINAPI IDirectInputDevice2WImpl_Release(LPDIRECTINPUTDEVICE8W iface) DECLSPEC_HIDDEN;
+extern HRESULT WINAPI IDirectInputDevice2AImpl_GetCapabilities(LPDIRECTINPUTDEVICE8A iface, DIDEVCAPS *caps) DECLSPEC_HIDDEN;
 extern HRESULT WINAPI IDirectInputDevice2AImpl_QueryInterface(LPDIRECTINPUTDEVICE8A iface, REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN;
 extern HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface(LPDIRECTINPUTDEVICE8W iface, REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN;
 extern ULONG WINAPI IDirectInputDevice2AImpl_AddRef(LPDIRECTINPUTDEVICE8A iface) DECLSPEC_HIDDEN;
diff --git a/dlls/dinput/joystick.c b/dlls/dinput/joystick.c
index b79935ede7c..60a61d1ea6b 100644
--- a/dlls/dinput/joystick.c
+++ b/dlls/dinput/joystick.c
@@ -542,12 +542,6 @@ HRESULT WINAPI JoystickWGenericImpl_GetCapabilities(LPDIRECTINPUTDEVICE8W iface,
     return DI_OK;
 }
 
-HRESULT WINAPI JoystickAGenericImpl_GetCapabilities(LPDIRECTINPUTDEVICE8A iface, LPDIDEVCAPS lpDIDevCaps)
-{
-    JoystickGenericImpl *This = impl_from_IDirectInputDevice8A(iface);
-    return JoystickWGenericImpl_GetCapabilities(IDirectInputDevice8W_from_impl(This), lpDIDevCaps);
-}
-
 /******************************************************************************
   *     GetObjectInfo : get object info
   */
diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c
index 091e1f2152e..8196102f9bb 100644
--- a/dlls/dinput/joystick_linux.c
+++ b/dlls/dinput/joystick_linux.c
@@ -907,7 +907,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt =
 	IDirectInputDevice2AImpl_QueryInterface,
 	IDirectInputDevice2AImpl_AddRef,
         IDirectInputDevice2AImpl_Release,
-	JoystickAGenericImpl_GetCapabilities,
+	IDirectInputDevice2AImpl_GetCapabilities,
         IDirectInputDevice2AImpl_EnumObjects,
 	IDirectInputDevice2AImpl_GetProperty,
 	IDirectInputDevice2AImpl_SetProperty,
diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c
index 307b447d237..9a41e798642 100644
--- a/dlls/dinput/joystick_linuxinput.c
+++ b/dlls/dinput/joystick_linuxinput.c
@@ -1338,7 +1338,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt =
 	IDirectInputDevice2AImpl_QueryInterface,
 	IDirectInputDevice2AImpl_AddRef,
         IDirectInputDevice2AImpl_Release,
-        JoystickAGenericImpl_GetCapabilities,
+        IDirectInputDevice2AImpl_GetCapabilities,
         IDirectInputDevice2AImpl_EnumObjects,
 	IDirectInputDevice2AImpl_GetProperty,
 	IDirectInputDevice2AImpl_SetProperty,
diff --git a/dlls/dinput/joystick_osx.c b/dlls/dinput/joystick_osx.c
index 78e041daf92..a663c438c35 100644
--- a/dlls/dinput/joystick_osx.c
+++ b/dlls/dinput/joystick_osx.c
@@ -1579,7 +1579,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt =
     IDirectInputDevice2AImpl_QueryInterface,
     IDirectInputDevice2AImpl_AddRef,
     IDirectInputDevice2AImpl_Release,
-    JoystickAGenericImpl_GetCapabilities,
+    IDirectInputDevice2AImpl_GetCapabilities,
     IDirectInputDevice2AImpl_EnumObjects,
     IDirectInputDevice2AImpl_GetProperty,
     IDirectInputDevice2AImpl_SetProperty,
diff --git a/dlls/dinput/joystick_private.h b/dlls/dinput/joystick_private.h
index 2a25bf4eb23..60cea6197c6 100644
--- a/dlls/dinput/joystick_private.h
+++ b/dlls/dinput/joystick_private.h
@@ -64,7 +64,6 @@ HRESULT WINAPI JoystickWGenericImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface,
 
 HRESULT WINAPI JoystickWGenericImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPDIPROPHEADER pdiph) DECLSPEC_HIDDEN;
 
-HRESULT WINAPI JoystickAGenericImpl_GetCapabilities(LPDIRECTINPUTDEVICE8A iface, LPDIDEVCAPS lpDIDevCaps) DECLSPEC_HIDDEN;
 HRESULT WINAPI JoystickWGenericImpl_GetCapabilities(LPDIRECTINPUTDEVICE8W iface, LPDIDEVCAPS lpDIDevCaps) DECLSPEC_HIDDEN;
 
 void _dump_DIDEVCAPS(const DIDEVCAPS *lpDIDevCaps) DECLSPEC_HIDDEN;
diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c
index b1914d057bd..3a81b7e58fb 100644
--- a/dlls/dinput/keyboard.c
+++ b/dlls/dinput/keyboard.c
@@ -419,12 +419,6 @@ static HRESULT WINAPI SysKeyboardWImpl_GetCapabilities(LPDIRECTINPUTDEVICE8W ifa
     return DI_OK;
 }
 
-static HRESULT WINAPI SysKeyboardAImpl_GetCapabilities(LPDIRECTINPUTDEVICE8A iface, LPDIDEVCAPS lpDIDevCaps)
-{
-    SysKeyboardImpl *This = impl_from_IDirectInputDevice8A(iface);
-    return SysKeyboardWImpl_GetCapabilities(IDirectInputDevice8W_from_impl(This), lpDIDevCaps);
-}
-
 static DWORD map_dik_to_scan(DWORD dik_code, DWORD subtype)
 {
     if (dik_code == DIK_PAUSE || dik_code == DIK_NUMLOCK) dik_code ^= 0x80;
@@ -657,7 +651,7 @@ static const IDirectInputDevice8AVtbl SysKeyboardAvt =
     IDirectInputDevice2AImpl_QueryInterface,
     IDirectInputDevice2AImpl_AddRef,
     IDirectInputDevice2AImpl_Release,
-    SysKeyboardAImpl_GetCapabilities,
+    IDirectInputDevice2AImpl_GetCapabilities,
     IDirectInputDevice2AImpl_EnumObjects,
     IDirectInputDevice2AImpl_GetProperty,
     IDirectInputDevice2AImpl_SetProperty,
diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c
index 9267d92d6e9..68cc5059ec8 100644
--- a/dlls/dinput/mouse.c
+++ b/dlls/dinput/mouse.c
@@ -761,12 +761,6 @@ static HRESULT WINAPI SysMouseWImpl_GetCapabilities(LPDIRECTINPUTDEVICE8W iface,
     return DI_OK;
 }
 
-static HRESULT WINAPI SysMouseAImpl_GetCapabilities(LPDIRECTINPUTDEVICE8A iface, LPDIDEVCAPS lpDIDevCaps)
-{
-    SysMouseImpl *This = impl_from_IDirectInputDevice8A(iface);
-    return SysMouseWImpl_GetCapabilities(IDirectInputDevice8W_from_impl(This), lpDIDevCaps);
-}
-
 /******************************************************************************
   *     GetObjectInfo : get information about a device object such as a button
   *                     or axis
@@ -911,7 +905,7 @@ static const IDirectInputDevice8AVtbl SysMouseAvt =
     IDirectInputDevice2AImpl_QueryInterface,
     IDirectInputDevice2AImpl_AddRef,
     IDirectInputDevice2AImpl_Release,
-    SysMouseAImpl_GetCapabilities,
+    IDirectInputDevice2AImpl_GetCapabilities,
     IDirectInputDevice2AImpl_EnumObjects,
     IDirectInputDevice2AImpl_GetProperty,
     IDirectInputDevice2AImpl_SetProperty,




More information about the wine-cvs mailing list