From: Tim Clem tclem@codeweavers.com
Return WHEEL_DELTA for the granularity of the mouse z-axis.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53627 --- dlls/dinput/device.c | 3 ++- dlls/dinput/device_private.h | 1 + dlls/dinput/joystick_hid.c | 1 + dlls/dinput/mouse.c | 6 ++++++ dlls/dinput/tests/device8.c | 1 - 5 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index d0a5fd0ea1c..590151483c9 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -1103,6 +1103,7 @@ static BOOL CALLBACK get_object_property( const DIDEVICEOBJECTINSTANCEW *instanc { .range_min = DIPROPRANGE_NOMIN, .range_max = DIPROPRANGE_NOMAX, + .granularity = 1, }; struct get_object_property_params *params = context; struct dinput_device *impl = impl_from_IDirectInputDevice8W( params->iface ); @@ -1155,7 +1156,7 @@ static BOOL CALLBACK get_object_property( const DIDEVICEOBJECTINSTANCEW *instanc case (DWORD_PTR)DIPROP_GRANULARITY: { DIPROPDWORD *value = (DIPROPDWORD *)params->header; - value->dwData = 1; + value->dwData = properties->granularity; return DIENUM_STOP; } case (DWORD_PTR)DIPROP_KEYNAME: diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h index 31696f00536..be5d7861fd1 100644 --- a/dlls/dinput/device_private.h +++ b/dlls/dinput/device_private.h @@ -67,6 +67,7 @@ struct object_properties LONG deadzone; LONG saturation; DWORD calibration_mode; + DWORD granularity; };
enum device_status diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 311e5903878..41fd0e24963 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -1696,6 +1696,7 @@ static BOOL init_object_properties( struct hid_joystick *impl, struct hid_value_ }
properties->saturation = 10000; + properties->granularity = 1; return DIENUM_CONTINUE; }
diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c index 1af69f34f5b..ee172547a30 100644 --- a/dlls/dinput/mouse.c +++ b/dlls/dinput/mouse.c @@ -99,6 +99,12 @@ static BOOL CALLBACK init_object_properties( const DIDEVICEOBJECTINSTANCEW *inst properties->range_min = DIPROPRANGE_NOMIN; properties->range_max = DIPROPRANGE_NOMAX;
+ /* The z-axis (wheel) has a different granularity */ + if (instance->dwOfs == DIMOFS_Z) + properties->granularity = WHEEL_DELTA; + else + properties->granularity = 1; + return DIENUM_CONTINUE; }
diff --git a/dlls/dinput/tests/device8.c b/dlls/dinput/tests/device8.c index 6542baa88f0..86f0360c0f1 100644 --- a/dlls/dinput/tests/device8.c +++ b/dlls/dinput/tests/device8.c @@ -1823,7 +1823,6 @@ static void test_sys_mouse( DWORD version ) prop_dword.dwData = 0xdeadbeef; hr = IDirectInputDevice8_GetProperty( device, DIPROP_GRANULARITY, &prop_dword.diph ); ok( hr == DI_OK, "GetProperty DIPROP_GRANULARITY returned %#lx\n", hr ); - todo_wine ok( prop_dword.dwData == WHEEL_DELTA, "got %ld expected %ld\n", prop_dword.dwData, (DWORD)WHEEL_DELTA ); prop_range.lMin = 0xdeadbeef; prop_range.lMax = 0xdeadbeef;