From: Zhiyi Zhang <zzhang@codeweavers.com> --- dlls/windows.graphics/main.c | 63 ++++++++++++++++++++++++++ dlls/windows.graphics/private.h | 40 ++++++++++++++++ dlls/windows.graphics/tests/graphics.c | 1 - 3 files changed, 103 insertions(+), 1 deletion(-) diff --git a/dlls/windows.graphics/main.c b/dlls/windows.graphics/main.c index 0d85af5d71b..25a571975e5 100644 --- a/dlls/windows.graphics/main.c +++ b/dlls/windows.graphics/main.c @@ -25,6 +25,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(display); struct display_info_statics { IActivationFactory IActivationFactory_iface; + IDisplayInformationStatics IDisplayInformationStatics_iface; LONG ref; }; @@ -47,6 +48,12 @@ static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID IActivationFactory_AddRef( *out ); return S_OK; } + else if (IsEqualGUID( iid, &IID_IDisplayInformationStatics )) + { + *out = &impl->IDisplayInformationStatics_iface; + IDisplayInformationStatics_AddRef( *out ); + return S_OK; + } FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); *out = NULL; @@ -106,9 +113,65 @@ static const struct IActivationFactoryVtbl factory_vtbl = factory_ActivateInstance, }; +DEFINE_IINSPECTABLE( display_info_statics, IDisplayInformationStatics, struct display_info_statics, + IActivationFactory_iface ) + +static HRESULT WINAPI display_info_statics_GetForCurrentView( IDisplayInformationStatics *iface, + IDisplayInformation **current ) +{ + FIXME( "iface %p, current %p stub!\n", iface, current ); + return E_NOTIMPL; +} + +static HRESULT WINAPI display_info_statics_get_AutoRotationPreferences( IDisplayInformationStatics *iface, + DisplayOrientations *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI display_info_statics_put_AutoRotationPreferences( IDisplayInformationStatics *iface, + DisplayOrientations value ) +{ + FIXME( "iface %p, value %#x stub!\n", iface, value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI display_info_statics_add_DisplayContentsInvalidated( IDisplayInformationStatics *iface, + ITypedEventHandler_DisplayInformation_IInspectable *handler, EventRegistrationToken *token ) +{ + FIXME( "iface %p, handler %p, token %p stub!\n", iface, handler, token ); + return E_NOTIMPL; +} + +static HRESULT WINAPI display_info_statics_remove_DisplayContentsInvalidated( IDisplayInformationStatics *iface, + EventRegistrationToken token ) +{ + FIXME( "iface %p, token %I64x stub!\n", iface, token.value ); + return E_NOTIMPL; +} + +static const struct IDisplayInformationStaticsVtbl display_info_statics_vtbl = +{ + display_info_statics_QueryInterface, + display_info_statics_AddRef, + display_info_statics_Release, + /* IInspectable methods */ + display_info_statics_GetIids, + display_info_statics_GetRuntimeClassName, + display_info_statics_GetTrustLevel, + /* IDisplayInformationStatics methods */ + display_info_statics_GetForCurrentView, + display_info_statics_get_AutoRotationPreferences, + display_info_statics_put_AutoRotationPreferences, + display_info_statics_add_DisplayContentsInvalidated, + display_info_statics_remove_DisplayContentsInvalidated +}; + static struct display_info_statics display_info_statics = { {&factory_vtbl}, + {&display_info_statics_vtbl}, 1, }; diff --git a/dlls/windows.graphics/private.h b/dlls/windows.graphics/private.h index 05a2a4f6d5e..64e2920bb40 100644 --- a/dlls/windows.graphics/private.h +++ b/dlls/windows.graphics/private.h @@ -27,5 +27,45 @@ #include "activation.h" #include "wine/debug.h" +#define WIDL_using_Windows_Foundation #define WIDL_using_Windows_Graphics_Display #include "windows.graphics.display.h" + +#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \ + static inline impl_type *impl_from( iface_type *iface ) \ + { \ + return CONTAINING_RECORD( iface, impl_type, iface_mem ); \ + } \ + static HRESULT WINAPI pfx##_QueryInterface( iface_type *iface, REFIID iid, void **out ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_QueryInterface( (IInspectable *)(expr), iid, out ); \ + } \ + static ULONG WINAPI pfx##_AddRef( iface_type *iface ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_AddRef( (IInspectable *)(expr) ); \ + } \ + static ULONG WINAPI pfx##_Release( iface_type *iface ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_Release( (IInspectable *)(expr) ); \ + } \ + static HRESULT WINAPI pfx##_GetIids( iface_type *iface, ULONG *iid_count, IID **iids ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_GetIids( (IInspectable *)(expr), iid_count, iids ); \ + } \ + static HRESULT WINAPI pfx##_GetRuntimeClassName( iface_type *iface, HSTRING *class_name ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_GetRuntimeClassName( (IInspectable *)(expr), class_name ); \ + } \ + static HRESULT WINAPI pfx##_GetTrustLevel( iface_type *iface, TrustLevel *trust_level ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_GetTrustLevel( (IInspectable *)(expr), trust_level ); \ + } + +#define DEFINE_IINSPECTABLE( pfx, iface_type, impl_type, base_iface ) \ + DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, &impl->base_iface ) diff --git a/dlls/windows.graphics/tests/graphics.c b/dlls/windows.graphics/tests/graphics.c index e4332826eb7..031bddbdcf3 100644 --- a/dlls/windows.graphics/tests/graphics.c +++ b/dlls/windows.graphics/tests/graphics.c @@ -62,7 +62,6 @@ static void test_DisplayInformationStatics(void) check_interface( factory, &IID_IUnknown, TRUE ); check_interface( factory, &IID_IInspectable, TRUE ); check_interface( factory, &IID_IActivationFactory, TRUE ); - todo_wine check_interface( factory, &IID_IDisplayInformationStatics, TRUE ); check_interface( factory, &IID_IAgileObject, FALSE ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10234