Commit ca8b8664 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

ninput: Implement SetPropertyInteractionContext().

parent 116ad149
......@@ -72,6 +72,65 @@ HRESULT WINAPI DestroyInteractionContext(HINTERACTIONCONTEXT handle)
return S_OK;
}
HRESULT WINAPI GetPropertyInteractionContext(HINTERACTIONCONTEXT handle,
INTERACTION_CONTEXT_PROPERTY property, UINT32 *value)
{
struct interaction_context *context = context_from_handle(handle);
TRACE("context %p, property %#x, value %p.\n", context, property, value);
if (!context)
return E_HANDLE;
if (!value)
return E_POINTER;
switch (property)
{
case INTERACTION_CONTEXT_PROPERTY_MEASUREMENT_UNITS:
case INTERACTION_CONTEXT_PROPERTY_INTERACTION_UI_FEEDBACK:
FIXME("Unhandled property %#x.\n", property);
*value = 0;
return E_NOTIMPL;
case INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS:
*value = context->filter_pointers;
return S_OK;
default:
WARN("Invalid property %#x.\n", property);
return E_INVALIDARG;
}
}
HRESULT WINAPI SetPropertyInteractionContext(HINTERACTIONCONTEXT handle,
INTERACTION_CONTEXT_PROPERTY property, UINT32 value)
{
struct interaction_context *context = context_from_handle(handle);
TRACE("context %p, property %#x, value %#x.\n", context, property, value);
if (!context)
return E_HANDLE;
switch (property)
{
case INTERACTION_CONTEXT_PROPERTY_MEASUREMENT_UNITS:
case INTERACTION_CONTEXT_PROPERTY_INTERACTION_UI_FEEDBACK:
FIXME("Unhandled property %#x.\n", property);
return E_NOTIMPL;
case INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS:
if (value != FALSE && value != TRUE)
return E_INVALIDARG;
context->filter_pointers = value;
return S_OK;
default:
WARN("Invalid property %#x.\n", property);
return E_INVALIDARG;
}
}
HRESULT WINAPI ProcessInertiaInteractionContext(HINTERACTIONCONTEXT context)
{
FIXME("context %p: stub!\n", context);
......
......@@ -7,7 +7,7 @@
@ stub GetInertiaParameterInteractionContext
@ stub GetInteractionConfigurationInteractionContext
@ stub GetMouseWheelParameterInteractionContext
@ stub GetPropertyInteractionContext
@ stdcall GetPropertyInteractionContext(ptr long ptr)
@ stub GetStateInteractionContext
@ stub ProcessBufferedPacketsInteractionContext
@ stdcall ProcessInertiaInteractionContext(ptr)
......@@ -20,5 +20,5 @@
@ stub SetInteractionConfigurationInteractionContext
@ stub SetMouseWheelParameterInteractionContext
@ stub SetPivotInteractionContext
@ stub SetPropertyInteractionContext
@ stdcall SetPropertyInteractionContext(ptr long long)
@ stub StopInteractionContext
......@@ -35,7 +35,55 @@ static void test_context(void)
ok(hr == E_HANDLE, "Got hr %#x.\n", hr);
}
static void test_properties(void)
{
HINTERACTIONCONTEXT context;
UINT32 value;
HRESULT hr;
hr = CreateInteractionContext(&context);
ok(hr == S_OK, "Failed to create context, hr %#x.\n", hr);
hr = GetPropertyInteractionContext(context, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, &value);
ok(hr == S_OK, "Failed to get property, hr %#x.\n", hr);
ok(value == TRUE, "Got unexpected value %#x.\n", value);
hr = SetPropertyInteractionContext(context, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, TRUE);
ok(hr == S_OK, "Failed to set property, hr %#x.\n", hr);
hr = GetPropertyInteractionContext(context, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, &value);
ok(hr == S_OK, "Failed to get property, hr %#x.\n", hr);
ok(value == TRUE, "Got unexpected value %#x.\n", value);
hr = SetPropertyInteractionContext(context, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, FALSE);
ok(hr == S_OK, "Failed to set property, hr %#x.\n", hr);
hr = GetPropertyInteractionContext(context, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, &value);
ok(hr == S_OK, "Failed to get property, hr %#x.\n", hr);
ok(value == FALSE, "Got unexpected value %#x.\n", value);
hr = SetPropertyInteractionContext(context, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, 2);
ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
hr = SetPropertyInteractionContext(context, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, 3);
ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
hr = SetPropertyInteractionContext(context, 0xdeadbeef, 0);
ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
hr = GetPropertyInteractionContext(context, 0xdeadbeef, &value);
ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
hr = GetPropertyInteractionContext(context, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, NULL);
ok(hr == E_POINTER, "Got hr %#x.\n", hr);
hr = SetPropertyInteractionContext(NULL, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, FALSE);
ok(hr == E_HANDLE, "Got hr %#x.\n", hr);
hr = GetPropertyInteractionContext(NULL, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, &value);
ok(hr == E_HANDLE, "Got hr %#x.\n", hr);
hr = DestroyInteractionContext(context);
ok(hr == S_OK, "Failed to destroy context, hr %#x.\n", hr);
}
START_TEST(ninput)
{
test_context();
test_properties();
}
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