Commit 81ce03df authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

windows.gaming.ui.gamebar: Add IGameBarStatics interface.

parent dde251a0
......@@ -24,9 +24,12 @@
WINE_DEFAULT_DEBUG_CHANNEL(gamebar);
static EventRegistrationToken dummy_token = {.value = 0xdeadbeef};
struct gamebar_statics
{
IActivationFactory IActivationFactory_iface;
IGameBarStatics IGameBarStatics_iface;
LONG ref;
};
......@@ -51,6 +54,13 @@ static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID
return S_OK;
}
if (IsEqualGUID( iid, &IID_IGameBarStatics ))
{
*out = &impl->IGameBarStatics_iface;
IInspectable_AddRef( *out );
return S_OK;
}
FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) );
*out = NULL;
return E_NOINTERFACE;
......@@ -109,9 +119,78 @@ static const struct IActivationFactoryVtbl factory_vtbl =
factory_ActivateInstance,
};
DEFINE_IINSPECTABLE( statics, IGameBarStatics, struct gamebar_statics, IActivationFactory_iface )
static HRESULT WINAPI statics_add_VisibilityChanged( IGameBarStatics *iface,
IEventHandler_IInspectable *handler,
EventRegistrationToken *token )
{
FIXME( "iface %p, handler %p, token %p stub.\n", iface, handler, token );
*token = dummy_token;
return S_OK;
}
static HRESULT WINAPI statics_remove_VisibilityChanged( IGameBarStatics *iface, EventRegistrationToken token )
{
FIXME( "iface %p, token %#I64x stub.\n", iface, token.value );
return S_OK;
}
static HRESULT WINAPI statics_add_IsInputRedirectedChanged( IGameBarStatics *iface,
IEventHandler_IInspectable *handler,
EventRegistrationToken *token )
{
FIXME( "iface %p, handler %p, token %p stub.\n", iface, handler, token );
*token = dummy_token;
return S_OK;
}
static HRESULT WINAPI statics_remove_IsInputRedirectedChanged( IGameBarStatics *iface, EventRegistrationToken token )
{
FIXME( "iface %p, token %#I64x stub.\n", iface, token.value );
return S_OK;
}
static HRESULT WINAPI statics_get_Visible( IGameBarStatics *iface, BOOLEAN *value)
{
TRACE( "iface %p, value %p.\n", iface, value );
if (!value) return E_POINTER;
*value = FALSE;
return S_OK;
}
static HRESULT WINAPI statics_get_IsInputRedirected( IGameBarStatics *iface, BOOLEAN *value )
{
TRACE( "iface %p, value %p.\n", iface, value );
if (!value) return E_POINTER;
*value = FALSE;
return S_OK;
}
static const struct IGameBarStaticsVtbl statics_vtbl =
{
statics_QueryInterface,
statics_AddRef,
statics_Release,
/* IInspectable methods */
statics_GetIids,
statics_GetRuntimeClassName,
statics_GetTrustLevel,
/* IGameBarStatics methods */
statics_add_VisibilityChanged,
statics_remove_VisibilityChanged,
statics_add_IsInputRedirectedChanged,
statics_remove_IsInputRedirectedChanged,
statics_get_Visible,
statics_get_IsInputRedirected,
};
static struct gamebar_statics gamebar_statics =
{
{&factory_vtbl},
{&statics_vtbl},
1,
};
......
......@@ -29,3 +29,41 @@
#define WIDL_using_Windows_Gaming_UI
#include "activation.h"
#include "windows.gaming.ui.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 )
......@@ -48,7 +48,9 @@ static void check_interface_( unsigned int line, void *obj, const IID *iid )
static void test_GameBarStatics(void)
{
static const WCHAR *gamebar_statics_name = L"Windows.Gaming.UI.GameBar";
IGameBarStatics *gamebar_statics;
IActivationFactory *factory;
BOOLEAN value;
HSTRING str;
HRESULT hr;
LONG ref;
......@@ -69,6 +71,27 @@ static void test_GameBarStatics(void)
check_interface( factory, &IID_IInspectable );
check_interface( factory, &IID_IAgileObject );
hr = IActivationFactory_QueryInterface( factory, &IID_IGameBarStatics, (void **)&gamebar_statics );
ok( hr == S_OK, "got hr %#lx.\n", hr );
hr = IGameBarStatics_get_Visible( gamebar_statics, NULL );
ok( hr == E_POINTER, "got hr %#lx.\n", hr );
value = TRUE;
hr = IGameBarStatics_get_Visible( gamebar_statics, &value );
ok( hr == S_OK, "got hr %#lx.\n", hr );
ok( !value, "got %d.\n", value );
hr = IGameBarStatics_get_IsInputRedirected( gamebar_statics, NULL );
ok( hr == E_POINTER, "got hr %#lx.\n", hr );
value = TRUE;
hr = IGameBarStatics_get_IsInputRedirected( gamebar_statics, &value );
ok( hr == S_OK, "got hr %#lx.\n", hr );
ok( !value, "got %d.\n", value );
ref = IGameBarStatics_Release( gamebar_statics );
ok( ref == 2, "got ref %ld.\n", ref );
ref = IActivationFactory_Release( factory );
ok( ref == 1, "got ref %ld.\n", ref );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment