[PATCH 2/5] windows.gaming.input: Use the helpers to define IInspectable interfaces.

Rémi Bernon rbernon at codeweavers.com
Tue Mar 1 02:17:06 CST 2022


Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/windows.gaming.input/controller.c | 41 +-------------------------
 dlls/windows.gaming.input/gamepad.c    | 41 +-------------------------
 2 files changed, 2 insertions(+), 80 deletions(-)

diff --git a/dlls/windows.gaming.input/controller.c b/dlls/windows.gaming.input/controller.c
index 00ab9c5d91c..654d0795eac 100644
--- a/dlls/windows.gaming.input/controller.c
+++ b/dlls/windows.gaming.input/controller.c
@@ -35,11 +35,6 @@ static inline struct controller_statics *impl_from_IActivationFactory( IActivati
     return CONTAINING_RECORD( iface, struct controller_statics, IActivationFactory_iface );
 }
 
-static inline struct controller_statics *impl_from_IRawGameControllerStatics( IRawGameControllerStatics *iface )
-{
-    return CONTAINING_RECORD( iface, struct controller_statics, IRawGameControllerStatics_iface );
-}
-
 static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID iid, void **out )
 {
     struct controller_statics *impl = impl_from_IActivationFactory( iface );
@@ -121,41 +116,7 @@ static const struct IActivationFactoryVtbl factory_vtbl =
     factory_ActivateInstance,
 };
 
-static HRESULT WINAPI statics_QueryInterface( IRawGameControllerStatics *iface, REFIID iid, void **out )
-{
-    struct controller_statics *impl = impl_from_IRawGameControllerStatics( iface );
-    return IActivationFactory_QueryInterface( &impl->IActivationFactory_iface, iid, out );
-}
-
-static ULONG WINAPI statics_AddRef( IRawGameControllerStatics *iface )
-{
-    struct controller_statics *impl = impl_from_IRawGameControllerStatics( iface );
-    return IActivationFactory_AddRef( &impl->IActivationFactory_iface );
-}
-
-static ULONG WINAPI statics_Release( IRawGameControllerStatics *iface )
-{
-    struct controller_statics *impl = impl_from_IRawGameControllerStatics( iface );
-    return IActivationFactory_Release( &impl->IActivationFactory_iface );
-}
-
-static HRESULT WINAPI statics_GetIids( IRawGameControllerStatics *iface, ULONG *iid_count, IID **iids )
-{
-    struct controller_statics *impl = impl_from_IRawGameControllerStatics( iface );
-    return IActivationFactory_Release( &impl->IActivationFactory_iface );
-}
-
-static HRESULT WINAPI statics_GetRuntimeClassName( IRawGameControllerStatics *iface, HSTRING *class_name )
-{
-    struct controller_statics *impl = impl_from_IRawGameControllerStatics( iface );
-    return IActivationFactory_Release( &impl->IActivationFactory_iface );
-}
-
-static HRESULT WINAPI statics_GetTrustLevel( IRawGameControllerStatics *iface, TrustLevel *trust_level )
-{
-    struct controller_statics *impl = impl_from_IRawGameControllerStatics( iface );
-    return IActivationFactory_Release( &impl->IActivationFactory_iface );
-}
+DEFINE_IINSPECTABLE( statics, IRawGameControllerStatics, struct controller_statics, IActivationFactory_iface )
 
 static HRESULT WINAPI statics_add_RawGameControllerAdded( IRawGameControllerStatics *iface, IEventHandler_RawGameController *value,
                                                           EventRegistrationToken *token )
diff --git a/dlls/windows.gaming.input/gamepad.c b/dlls/windows.gaming.input/gamepad.c
index e69568e2fb1..231e923b5e8 100644
--- a/dlls/windows.gaming.input/gamepad.c
+++ b/dlls/windows.gaming.input/gamepad.c
@@ -35,11 +35,6 @@ static inline struct gamepad_statics *impl_from_IActivationFactory( IActivationF
     return CONTAINING_RECORD( iface, struct gamepad_statics, IActivationFactory_iface );
 }
 
-static inline struct gamepad_statics *impl_from_IGamepadStatics( IGamepadStatics *iface )
-{
-    return CONTAINING_RECORD( iface, struct gamepad_statics, IGamepadStatics_iface );
-}
-
 static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID iid, void **out )
 {
     struct gamepad_statics *impl = impl_from_IActivationFactory( iface );
@@ -121,41 +116,7 @@ static const struct IActivationFactoryVtbl factory_vtbl =
     factory_ActivateInstance,
 };
 
-static HRESULT WINAPI statics_QueryInterface( IGamepadStatics *iface, REFIID iid, void **out )
-{
-    struct gamepad_statics *impl = impl_from_IGamepadStatics( iface );
-    return IActivationFactory_QueryInterface( &impl->IActivationFactory_iface, iid, out );
-}
-
-static ULONG WINAPI statics_AddRef( IGamepadStatics *iface )
-{
-    struct gamepad_statics *impl = impl_from_IGamepadStatics( iface );
-    return IActivationFactory_AddRef( &impl->IActivationFactory_iface );
-}
-
-static ULONG WINAPI statics_Release( IGamepadStatics *iface )
-{
-    struct gamepad_statics *impl = impl_from_IGamepadStatics( iface );
-    return IActivationFactory_Release( &impl->IActivationFactory_iface );
-}
-
-static HRESULT WINAPI statics_GetIids( IGamepadStatics *iface, ULONG *iid_count, IID **iids )
-{
-    struct gamepad_statics *impl = impl_from_IGamepadStatics( iface );
-    return IActivationFactory_Release( &impl->IActivationFactory_iface );
-}
-
-static HRESULT WINAPI statics_GetRuntimeClassName( IGamepadStatics *iface, HSTRING *class_name )
-{
-    struct gamepad_statics *impl = impl_from_IGamepadStatics( iface );
-    return IActivationFactory_Release( &impl->IActivationFactory_iface );
-}
-
-static HRESULT WINAPI statics_GetTrustLevel( IGamepadStatics *iface, TrustLevel *trust_level )
-{
-    struct gamepad_statics *impl = impl_from_IGamepadStatics( iface );
-    return IActivationFactory_Release( &impl->IActivationFactory_iface );
-}
+DEFINE_IINSPECTABLE( statics, IGamepadStatics, struct gamepad_statics, IActivationFactory_iface )
 
 static HRESULT WINAPI statics_add_GamepadAdded( IGamepadStatics *iface, IEventHandler_Gamepad *value,
                                                 EventRegistrationToken *token )
-- 
2.34.1




More information about the wine-devel mailing list