Commit 4bc1e172 authored by Johann Frei's avatar Johann Frei Committed by Alexandre Julliard

dinput: Implement X/Y axis granularity and add test.

parent 0c58f0ed
......@@ -616,8 +616,21 @@ static HRESULT WINAPI SysMouseWImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REF
case (DWORD_PTR) DIPROP_GRANULARITY: {
LPDIPROPDWORD pr = (LPDIPROPDWORD) pdiph;
/* We'll just assume that the app asks about the Z axis */
pr->dwData = WHEEL_DELTA;
if (
((pdiph->dwHow == DIPH_BYOFFSET) &&
((pdiph->dwObj == DIMOFS_X) ||
(pdiph->dwObj == DIMOFS_Y)))
||
((pdiph->dwHow == DIPH_BYID) &&
((pdiph->dwObj == (DIDFT_MAKEINSTANCE(WINE_MOUSE_X_AXIS_INSTANCE) | DIDFT_RELAXIS)) ||
(pdiph->dwObj == (DIDFT_MAKEINSTANCE(WINE_MOUSE_Y_AXIS_INSTANCE) | DIDFT_RELAXIS))))
){
/* Set granularity of X/Y Axis to 1. See MSDN on DIPROP_GRANULARITY */
pr->dwData = 1;
} else {
/* We'll just assume that the app asks about the Z axis */
pr->dwData = WHEEL_DELTA;
}
break;
}
......
......@@ -161,7 +161,7 @@ static void test_acquire(IDirectInputA *pDI, HWND hwnd)
hr = IDirectInputDevice_GetDeviceData(pMouse, sizeof(mouse_state), &mouse_state, &cnt, 0);
ok(hr == S_OK && cnt > 0, "GetDeviceData() failed: %08x cnt:%d\n", hr, cnt);
/* Check for buffer owerflow */
/* Check for buffer overflow */
for (i = 0; i < 6; i++)
mouse_event(MOUSEEVENTF_MOVE, 10 + i, 10 + i, 0, 0);
......@@ -172,6 +172,27 @@ static void test_acquire(IDirectInputA *pDI, HWND hwnd)
hr = IDirectInputDevice_GetDeviceData(pMouse, sizeof(mouse_state), &mouse_state, &cnt, 0);
ok(hr == DI_OK && cnt == 1, "GetDeviceData() failed: %08x cnt:%d\n", hr, cnt);
/* Check for granularity property using BYOFFSET */
memset(&di_op, 0, sizeof(di_op));
di_op.diph.dwHow = DIPH_BYOFFSET;
di_op.diph.dwObj = DIMOFS_Y;
di_op.diph.dwSize = sizeof(DIPROPDWORD);
di_op.diph.dwHeaderSize = sizeof(DIPROPHEADER);
hr = IDirectInputDevice_GetProperty(pMouse, DIPROP_GRANULARITY, &di_op.diph);
/* Granularity of Y axis should be 1! */
ok(hr == S_OK && di_op.dwData == 1, "GetProperty(): %08x, dwData: %i but should be 1.\n", hr, di_op.dwData);
/* Check for granularity property using BYID */
memset(&di_op, 0, sizeof(di_op));
di_op.diph.dwHow = DIPH_BYID;
/* WINE_MOUSE_Y_AXIS_INSTANCE := 1 */
di_op.diph.dwObj = (DIDFT_MAKEINSTANCE(1) | DIDFT_RELAXIS);
di_op.diph.dwSize = sizeof(DIPROPDWORD);
di_op.diph.dwHeaderSize = sizeof(DIPROPHEADER);
hr = IDirectInputDevice_GetProperty(pMouse, DIPROP_GRANULARITY, &di_op.diph);
/* Granularity of Y axis should be 1! */
ok(hr == S_OK && di_op.dwData == 1, "GetProperty(): %08x, dwData: %i but should be 1.\n", hr, di_op.dwData);
if (pMouse) IUnknown_Release(pMouse);
DestroyWindow( hwnd2 );
......
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