From c4debff5db617fc7c66d0e536caf0178560f99c6 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 17 May 2019 02:25:31 +0000 Subject: [PATCH] dinput: Improve returned flags in Mouse GetObjectInfo. Signed-off-by: Alistair Leslie-Hughes Signed-off-by: Alexandre Julliard --- dlls/dinput/mouse.c | 3 +++ dlls/dinput/tests/mouse.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c index 199ed03c138..52a766b2a1a 100644 --- a/dlls/dinput/mouse.c +++ b/dlls/dinput/mouse.c @@ -730,6 +730,9 @@ static HRESULT WINAPI SysMouseWImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface, else if (pdidoi->dwType & DIDFT_BUTTON) wsprintfW(pdidoi->tszName, buttonW, DIDFT_GETINSTANCE(pdidoi->dwType) - 3); + if(pdidoi->dwType & DIDFT_AXIS) + pdidoi->dwFlags |= DIDOI_ASPECTPOSITION; + _dump_OBJECTINSTANCEW(pdidoi); return res; } diff --git a/dlls/dinput/tests/mouse.c b/dlls/dinput/tests/mouse.c index c1a7ff7decf..c5cb6844809 100644 --- a/dlls/dinput/tests/mouse.c +++ b/dlls/dinput/tests/mouse.c @@ -227,6 +227,36 @@ static void test_GetDeviceInfo(IDirectInputA *pDI) if (pMouse) IUnknown_Release(pMouse); } +static BOOL CALLBACK EnumAxes(const DIDEVICEOBJECTINSTANCEA *pdidoi, void *pContext) +{ + if (IsEqualIID(&pdidoi->guidType, &GUID_XAxis) || + IsEqualIID(&pdidoi->guidType, &GUID_YAxis) || + IsEqualIID(&pdidoi->guidType, &GUID_ZAxis)) + { + ok(pdidoi->dwFlags & DIDOI_ASPECTPOSITION, "Missing DIDOI_ASPECTPOSITION, flags are 0x%x\n", + pdidoi->dwFlags); + } + else + ok(pdidoi->dwFlags == 0, "Flags are 0x%x\n", pdidoi->dwFlags); + + return DIENUM_CONTINUE; +} + +static void test_mouse_EnumObjects(IDirectInputA *pDI) +{ + HRESULT hr; + IDirectInputDeviceA *pMouse = NULL; + + hr = IDirectInput_CreateDevice(pDI, &GUID_SysMouse, &pMouse, NULL); + ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %08x\n", hr); + if (FAILED(hr)) return; + + hr = IDirectInputDevice_EnumObjects(pMouse, EnumAxes, NULL, DIDFT_ALL); + ok(hr==DI_OK,"IDirectInputDevice_EnumObjects() failed: %08x\n", hr); + + if (pMouse) IUnknown_Release(pMouse); +} + static void mouse_tests(void) { HRESULT hr; @@ -254,6 +284,7 @@ static void mouse_tests(void) test_set_coop(pDI, hwnd); test_acquire(pDI, hwnd); test_GetDeviceInfo(pDI); + test_mouse_EnumObjects(pDI); DestroyWindow(hwnd); }