=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: ninput: Implement SetPropertyInteractionContext().
Alexandre Julliard
julliard at winehq.org
Fri Jun 22 18:32:38 CDT 2018
Module: wine
Branch: master
Commit: ca8b8664a27772fe0fa5b7eacd0db7ad81e6cb4a
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ca8b8664a27772fe0fa5b7eacd0db7ad81e6cb4a
Author: Józef Kucia <jkucia at codeweavers.com>
Date: Thu Jun 21 16:19:44 2018 +0200
ninput: Implement SetPropertyInteractionContext().
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ninput/main.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++
dlls/ninput/ninput.spec | 4 ++--
dlls/ninput/tests/ninput.c | 48 +++++++++++++++++++++++++++++++++++++
3 files changed, 109 insertions(+), 2 deletions(-)
diff --git a/dlls/ninput/main.c b/dlls/ninput/main.c
index 932d159..90f9e7e 100644
--- a/dlls/ninput/main.c
+++ b/dlls/ninput/main.c
@@ -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);
diff --git a/dlls/ninput/ninput.spec b/dlls/ninput/ninput.spec
index fe7c6b3..166e3d1 100644
--- a/dlls/ninput/ninput.spec
+++ b/dlls/ninput/ninput.spec
@@ -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
diff --git a/dlls/ninput/tests/ninput.c b/dlls/ninput/tests/ninput.c
index d894ab8..156e3e8 100644
--- a/dlls/ninput/tests/ninput.c
+++ b/dlls/ninput/tests/ninput.c
@@ -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();
}
More information about the wine-cvs
mailing list