Commit 055b67ea authored by Tim Clem's avatar Tim Clem Committed by Alexandre Julliard

dinput: Add granularity to object_properties.

Return WHEEL_DELTA for the granularity of the mouse z-axis. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53627
parent 1e6258d2
...@@ -1103,6 +1103,7 @@ static BOOL CALLBACK get_object_property( const DIDEVICEOBJECTINSTANCEW *instanc ...@@ -1103,6 +1103,7 @@ static BOOL CALLBACK get_object_property( const DIDEVICEOBJECTINSTANCEW *instanc
{ {
.range_min = DIPROPRANGE_NOMIN, .range_min = DIPROPRANGE_NOMIN,
.range_max = DIPROPRANGE_NOMAX, .range_max = DIPROPRANGE_NOMAX,
.granularity = 1,
}; };
struct get_object_property_params *params = context; struct get_object_property_params *params = context;
struct dinput_device *impl = impl_from_IDirectInputDevice8W( params->iface ); struct dinput_device *impl = impl_from_IDirectInputDevice8W( params->iface );
...@@ -1155,7 +1156,7 @@ static BOOL CALLBACK get_object_property( const DIDEVICEOBJECTINSTANCEW *instanc ...@@ -1155,7 +1156,7 @@ static BOOL CALLBACK get_object_property( const DIDEVICEOBJECTINSTANCEW *instanc
case (DWORD_PTR)DIPROP_GRANULARITY: case (DWORD_PTR)DIPROP_GRANULARITY:
{ {
DIPROPDWORD *value = (DIPROPDWORD *)params->header; DIPROPDWORD *value = (DIPROPDWORD *)params->header;
value->dwData = 1; value->dwData = properties->granularity;
return DIENUM_STOP; return DIENUM_STOP;
} }
case (DWORD_PTR)DIPROP_KEYNAME: case (DWORD_PTR)DIPROP_KEYNAME:
......
...@@ -67,6 +67,7 @@ struct object_properties ...@@ -67,6 +67,7 @@ struct object_properties
LONG deadzone; LONG deadzone;
LONG saturation; LONG saturation;
DWORD calibration_mode; DWORD calibration_mode;
DWORD granularity;
}; };
enum device_status enum device_status
......
...@@ -1696,6 +1696,7 @@ static BOOL init_object_properties( struct hid_joystick *impl, struct hid_value_ ...@@ -1696,6 +1696,7 @@ static BOOL init_object_properties( struct hid_joystick *impl, struct hid_value_
} }
properties->saturation = 10000; properties->saturation = 10000;
properties->granularity = 1;
return DIENUM_CONTINUE; return DIENUM_CONTINUE;
} }
......
...@@ -99,6 +99,12 @@ static BOOL CALLBACK init_object_properties( const DIDEVICEOBJECTINSTANCEW *inst ...@@ -99,6 +99,12 @@ static BOOL CALLBACK init_object_properties( const DIDEVICEOBJECTINSTANCEW *inst
properties->range_min = DIPROPRANGE_NOMIN; properties->range_min = DIPROPRANGE_NOMIN;
properties->range_max = DIPROPRANGE_NOMAX; 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; return DIENUM_CONTINUE;
} }
......
...@@ -1823,7 +1823,6 @@ static void test_sys_mouse( DWORD version ) ...@@ -1823,7 +1823,6 @@ static void test_sys_mouse( DWORD version )
prop_dword.dwData = 0xdeadbeef; prop_dword.dwData = 0xdeadbeef;
hr = IDirectInputDevice8_GetProperty( device, DIPROP_GRANULARITY, &prop_dword.diph ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_GRANULARITY, &prop_dword.diph );
ok( hr == DI_OK, "GetProperty DIPROP_GRANULARITY returned %#lx\n", hr ); 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 ); ok( prop_dword.dwData == WHEEL_DELTA, "got %ld expected %ld\n", prop_dword.dwData, (DWORD)WHEEL_DELTA );
prop_range.lMin = 0xdeadbeef; prop_range.lMin = 0xdeadbeef;
prop_range.lMax = 0xdeadbeef; prop_range.lMax = 0xdeadbeef;
......
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