dinput: Improve returned flags in Mouse GetObjectInfo.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alistair Leslie-Hughes 2019-05-17 02:25:31 +00:00 committed by Alexandre Julliard
parent 099b05ce6f
commit c4debff5db
2 changed files with 34 additions and 0 deletions

View File

@ -730,6 +730,9 @@ static HRESULT WINAPI SysMouseWImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface,
else if (pdidoi->dwType & DIDFT_BUTTON) else if (pdidoi->dwType & DIDFT_BUTTON)
wsprintfW(pdidoi->tszName, buttonW, DIDFT_GETINSTANCE(pdidoi->dwType) - 3); wsprintfW(pdidoi->tszName, buttonW, DIDFT_GETINSTANCE(pdidoi->dwType) - 3);
if(pdidoi->dwType & DIDFT_AXIS)
pdidoi->dwFlags |= DIDOI_ASPECTPOSITION;
_dump_OBJECTINSTANCEW(pdidoi); _dump_OBJECTINSTANCEW(pdidoi);
return res; return res;
} }

View File

@ -227,6 +227,36 @@ static void test_GetDeviceInfo(IDirectInputA *pDI)
if (pMouse) IUnknown_Release(pMouse); 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) static void mouse_tests(void)
{ {
HRESULT hr; HRESULT hr;
@ -254,6 +284,7 @@ static void mouse_tests(void)
test_set_coop(pDI, hwnd); test_set_coop(pDI, hwnd);
test_acquire(pDI, hwnd); test_acquire(pDI, hwnd);
test_GetDeviceInfo(pDI); test_GetDeviceInfo(pDI);
test_mouse_EnumObjects(pDI);
DestroyWindow(hwnd); DestroyWindow(hwnd);
} }