Пример #1
0
bool CommonAPI::InitTouch()
{
	// Initialize Interaction Context
	HINTERACTIONCONTEXT hc;
	HRESULT hr = CreateInteractionContext(&hc);
	if (SUCCEEDED(hr))
	{
		hr = SetPropertyInteractionContext(hc, INTERACTION_CONTEXT_PROPERTY_FILTER_POINTERS, TRUE);
	}


	if (SUCCEEDED(hr))
    {
        INTERACTION_CONTEXT_CONFIGURATION cfg[] = 
        {
            {INTERACTION_ID_MANIPULATION,
                INTERACTION_CONFIGURATION_FLAG_MANIPULATION |
                INTERACTION_CONFIGURATION_FLAG_MANIPULATION_TRANSLATION_X |
                INTERACTION_CONFIGURATION_FLAG_MANIPULATION_TRANSLATION_Y |
                INTERACTION_CONFIGURATION_FLAG_MANIPULATION_SCALING |
                INTERACTION_CONFIGURATION_FLAG_MANIPULATION_ROTATION},
            {INTERACTION_ID_TAP, INTERACTION_CONFIGURATION_FLAG_TAP},
            {INTERACTION_ID_SECONDARY_TAP, INTERACTION_CONFIGURATION_FLAG_SECONDARY_TAP},
            {INTERACTION_ID_HOLD, INTERACTION_CONFIGURATION_FLAG_HOLD}
        };
        hr = SetInteractionConfigurationInteractionContext(hc, sizeof(cfg)/sizeof(cfg[0]), cfg);
    }

	if (SUCCEEDED(hr))
    {
		hr = RegisterOutputCallbackInteractionContext(hc,  &InteractionOutputCallback, hc);
	}
	
	/*UINT_PTR uIdSubclass;
    DWORD_PTR dwRefData;*/
	list<UINT32> pointerIds;
	this->pointers.push_back(pointerIds);
	this->interactionContexts.push_back(hc);

	return true;
}
Пример #2
0
Файл: ninput.c Проект: iXit/wine
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);
}