Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/device.c | 128 ++++++++++++++++++++++++----------- dlls/dinput/device_private.h | 2 + dlls/dinput/joystick_hid.c | 105 ++++++++-------------------- dlls/dinput/keyboard.c | 58 +++++----------- dlls/dinput/mouse.c | 85 +++++++---------------- dlls/dinput8/tests/device.c | 35 ---------- dlls/dinput8/tests/hid.c | 1 - 7 files changed, 160 insertions(+), 254 deletions(-)
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index 7a8864a45d2..75ca6676bec 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -1186,59 +1186,105 @@ HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects( IDirectInputDevice8W *iface return DI_OK; }
-/****************************************************************************** - * GetProperty - */ +static BOOL CALLBACK find_object( const DIDEVICEOBJECTINSTANCEW *instance, void *context ) +{ + *(DIDEVICEOBJECTINSTANCEW *)context = *instance; + return DIENUM_STOP; +}
-HRESULT WINAPI IDirectInputDevice2WImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPDIPROPHEADER pdiph) +HRESULT WINAPI IDirectInputDevice2WImpl_GetProperty( IDirectInputDevice8W *iface, const GUID *guid, + DIPROPHEADER *header ) { - IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); + IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + DWORD object_mask = DIDFT_AXIS | DIDFT_BUTTON | DIDFT_POV; + DIDEVICEOBJECTINSTANCEW instance; + HRESULT hr;
- TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(rguid), pdiph); - _dump_DIPROPHEADER(pdiph); + TRACE( "iface %p, guid %s, header %p\n", iface, debugstr_guid( guid ), header );
- if (!IS_DIPROP(rguid)) return DI_OK; + if (!header) return DIERR_INVALIDPARAM; + if (header->dwHeaderSize != sizeof(DIPROPHEADER)) return DIERR_INVALIDPARAM; + if (!IS_DIPROP( guid )) return DI_OK;
- switch (LOWORD(rguid)) + switch (LOWORD( guid )) { - case (DWORD_PTR) DIPROP_BUFFERSIZE: - { - LPDIPROPDWORD pd = (LPDIPROPDWORD)pdiph; - - if (pdiph->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM; + case (DWORD_PTR)DIPROP_PRODUCTNAME: + case (DWORD_PTR)DIPROP_INSTANCENAME: + if (header->dwSize != sizeof(DIPROPSTRING)) return DIERR_INVALIDPARAM; + if (header->dwHow != DIPH_DEVICE) return DIERR_UNSUPPORTED; + return impl->vtbl->get_property( iface, LOWORD( guid ), header, NULL ); + + case (DWORD_PTR)DIPROP_VIDPID: + case (DWORD_PTR)DIPROP_JOYSTICKID: + if (header->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM; + if (header->dwHow != DIPH_DEVICE) return DIERR_UNSUPPORTED; + return impl->vtbl->get_property( iface, LOWORD( guid ), header, NULL ); + + case (DWORD_PTR)DIPROP_GUIDANDPATH: + if (header->dwSize != sizeof(DIPROPGUIDANDPATH)) return DIERR_INVALIDPARAM; + if (header->dwHow != DIPH_DEVICE) return DIERR_UNSUPPORTED; + return impl->vtbl->get_property( iface, LOWORD( guid ), header, NULL ); + + case (DWORD_PTR)DIPROP_RANGE: + if (header->dwSize != sizeof(DIPROPRANGE)) return DIERR_INVALIDPARAM; + if (header->dwHow == DIPH_DEVICE) return DIERR_UNSUPPORTED; + hr = impl->vtbl->enum_objects( iface, header, object_mask, find_object, &instance ); + if (FAILED(hr)) return hr; + if (hr == DIENUM_CONTINUE) return DIERR_NOTFOUND; + if (!(instance.dwType & DIDFT_AXIS)) return DIERR_UNSUPPORTED; + return impl->vtbl->get_property( iface, LOWORD( guid ), header, &instance ); + + case (DWORD_PTR)DIPROP_DEADZONE: + case (DWORD_PTR)DIPROP_SATURATION: + case (DWORD_PTR)DIPROP_GRANULARITY: + if (header->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM; + if (header->dwHow == DIPH_DEVICE) return DIERR_UNSUPPORTED; + hr = impl->vtbl->enum_objects( iface, header, object_mask, find_object, &instance ); + if (FAILED(hr)) return hr; + if (hr == DIENUM_CONTINUE) return DIERR_NOTFOUND; + if (!(instance.dwType & DIDFT_AXIS)) return DIERR_UNSUPPORTED; + return impl->vtbl->get_property( iface, LOWORD( guid ), header, &instance );
- pd->dwData = This->buffersize; - TRACE("buffersize = %d\n", pd->dwData); - break; - } - case (DWORD_PTR) DIPROP_USERNAME: - { - LPDIPROPSTRING ps = (LPDIPROPSTRING)pdiph; - struct DevicePlayer *device_player; + case (DWORD_PTR)DIPROP_KEYNAME: + if (header->dwSize != sizeof(DIPROPSTRING)) return DIERR_INVALIDPARAM; + hr = impl->vtbl->enum_objects( iface, header, object_mask, find_object, &instance ); + if (FAILED(hr)) return hr; + if (hr == DIENUM_CONTINUE) return DIERR_NOTFOUND; + if (!(instance.dwType & DIDFT_BUTTON)) return DIERR_UNSUPPORTED; + return impl->vtbl->get_property( iface, LOWORD( guid ), header, &instance );
- if (pdiph->dwSize != sizeof(DIPROPSTRING)) return DIERR_INVALIDPARAM; + case (DWORD_PTR)DIPROP_AUTOCENTER: + if (header->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM; + return DIERR_UNSUPPORTED;
- LIST_FOR_EACH_ENTRY(device_player, &This->dinput->device_players, - struct DevicePlayer, entry) + case (DWORD_PTR)DIPROP_BUFFERSIZE: + { + DIPROPDWORD *value = (DIPROPDWORD *)header; + if (header->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM; + value->dwData = impl->buffersize; + return DI_OK; + } + case (DWORD_PTR)DIPROP_USERNAME: + { + DIPROPSTRING *value = (DIPROPSTRING *)header; + struct DevicePlayer *device_player; + if (header->dwSize != sizeof(DIPROPSTRING)) return DIERR_INVALIDPARAM; + LIST_FOR_EACH_ENTRY( device_player, &impl->dinput->device_players, struct DevicePlayer, entry ) + { + if (IsEqualGUID( &device_player->instance_guid, &impl->guid )) { - if (IsEqualGUID(&device_player->instance_guid, &This->guid)) - { - if (*device_player->username) - { - lstrcpynW(ps->wsz, device_player->username, ARRAY_SIZE(ps->wsz)); - return DI_OK; - } - else break; - } + if (!*device_player->username) break; + lstrcpynW( value->wsz, device_player->username, ARRAY_SIZE(value->wsz) ); + return DI_OK; } - return S_FALSE; } - case (DWORD_PTR) DIPROP_VIDPID: - FIXME("DIPROP_VIDPID not implemented\n"); - return DIERR_UNSUPPORTED; - default: - FIXME("Unknown property %s\n", debugstr_guid(rguid)); - return DIERR_INVALIDPARAM; + return S_FALSE; + } + case (DWORD_PTR)DIPROP_CALIBRATION: + return DIERR_INVALIDPARAM; + default: + FIXME( "Unknown property %s\n", debugstr_guid( guid ) ); + return DIERR_UNSUPPORTED; }
return DI_OK; diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h index 8589eca41e3..e4290e5960b 100644 --- a/dlls/dinput/device_private.h +++ b/dlls/dinput/device_private.h @@ -62,6 +62,8 @@ struct dinput_device_vtbl HRESULT (*unacquire)( IDirectInputDevice8W *iface ); HRESULT (*enum_objects)( IDirectInputDevice8W *iface, const DIPROPHEADER *filter, DWORD flags, LPDIENUMDEVICEOBJECTSCALLBACKW callback, void *context ); + HRESULT (*get_property)( IDirectInputDevice8W *iface, DWORD property, DIPROPHEADER *header, + DIDEVICEOBJECTINSTANCEW *instance ); };
#define DEVICE_STATE_MAX_SIZE 1024 diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 9c1f75ec9ee..8c9218cd4e7 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -661,97 +661,56 @@ static ULONG WINAPI hid_joystick_Release( IDirectInputDevice8W *iface ) return ref; }
-static BOOL get_property_prop_range( struct hid_joystick *impl, struct hid_value_caps *caps, - DIDEVICEOBJECTINSTANCEW *instance, void *data ) -{ - struct extra_caps *extra = impl->input_extra_caps + instance->dwOfs / sizeof(LONG); - DIPROPRANGE *value = data; - value->lMin = extra->range_min; - value->lMax = extra->range_max; - return DIENUM_STOP; -} - -static BOOL get_property_prop_deadzone( struct hid_joystick *impl, struct hid_value_caps *caps, - DIDEVICEOBJECTINSTANCEW *instance, void *data ) -{ - struct extra_caps *extra = impl->input_extra_caps + instance->dwOfs / sizeof(LONG); - DIPROPDWORD *deadzone = data; - deadzone->dwData = extra->deadzone; - return DIENUM_STOP; -} - -static BOOL get_property_prop_saturation( struct hid_joystick *impl, struct hid_value_caps *caps, - DIDEVICEOBJECTINSTANCEW *instance, void *data ) -{ - struct extra_caps *extra = impl->input_extra_caps + instance->dwOfs / sizeof(LONG); - DIPROPDWORD *saturation = data; - saturation->dwData = extra->saturation; - return DIENUM_STOP; -} - -static BOOL get_property_prop_granularity( struct hid_joystick *impl, struct hid_value_caps *caps, - DIDEVICEOBJECTINSTANCEW *instance, void *data ) -{ - DIPROPDWORD *granularity = data; - granularity->dwData = 1; - return DIENUM_STOP; -} - -static HRESULT WINAPI hid_joystick_GetProperty( IDirectInputDevice8W *iface, const GUID *guid, - DIPROPHEADER *header ) +static HRESULT hid_joystick_internal_get_property( IDirectInputDevice8W *iface, DWORD property, DIPROPHEADER *header, + DIDEVICEOBJECTINSTANCEW *instance ) { struct hid_joystick *impl = impl_from_IDirectInputDevice8W( iface ); + struct extra_caps *extra = NULL;
- TRACE( "iface %p, guid %s, header %p\n", iface, debugstr_guid( guid ), header ); + if (instance) extra = impl->input_extra_caps + instance->dwOfs / sizeof(LONG);
- if (!header) return DIERR_INVALIDPARAM; - if (header->dwHeaderSize != sizeof(DIPROPHEADER)) return DIERR_INVALIDPARAM; - if (!IS_DIPROP( guid )) return DI_OK; - - switch (LOWORD( guid )) + switch (property) { case (DWORD_PTR)DIPROP_RANGE: - if (header->dwSize != sizeof(DIPROPRANGE)) return DIERR_INVALIDPARAM; - if (header->dwHow == DIPH_DEVICE) return DIERR_UNSUPPORTED; - if (enum_objects( impl, header, DIDFT_AXIS, get_property_prop_range, header ) == DIENUM_STOP) - return DI_OK; - return DIERR_NOTFOUND; + { + DIPROPRANGE *value = (DIPROPRANGE *)header; + value->lMin = extra->range_min; + value->lMax = extra->range_max; + return DI_OK; + } case (DWORD_PTR)DIPROP_DEADZONE: - if (header->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM; - if (header->dwHow == DIPH_DEVICE) return DIERR_UNSUPPORTED; - if (enum_objects( impl, header, DIDFT_AXIS, get_property_prop_deadzone, header ) == DIENUM_STOP) - return DI_OK; - return DIERR_NOTFOUND; + { + DIPROPDWORD *value = (DIPROPDWORD *)header; + value->dwData = extra->deadzone; + return DI_OK; + } case (DWORD_PTR)DIPROP_SATURATION: - if (header->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM; - if (header->dwHow == DIPH_DEVICE) return DIERR_UNSUPPORTED; - if (enum_objects( impl, header, DIDFT_AXIS, get_property_prop_saturation, header ) == DIENUM_STOP) - return DI_OK; - return DIERR_NOTFOUND; + { + DIPROPDWORD *value = (DIPROPDWORD *)header; + value->dwData = extra->saturation; + return DI_OK; + } case (DWORD_PTR)DIPROP_GRANULARITY: - if (header->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM; - if (header->dwHow == DIPH_DEVICE) return DIERR_UNSUPPORTED; - if (enum_objects( impl, header, DIDFT_AXIS, get_property_prop_granularity, header ) == DIENUM_STOP) - return DI_OK; - return DIERR_NOTFOUND; + { + DIPROPDWORD *value = (DIPROPDWORD *)header; + value->dwData = 1; + return DI_OK; + } case (DWORD_PTR)DIPROP_PRODUCTNAME: { DIPROPSTRING *value = (DIPROPSTRING *)header; - if (header->dwSize != sizeof(DIPROPSTRING)) return DIERR_INVALIDPARAM; lstrcpynW( value->wsz, impl->base.instance.tszProductName, MAX_PATH ); return DI_OK; } case (DWORD_PTR)DIPROP_INSTANCENAME: { DIPROPSTRING *value = (DIPROPSTRING *)header; - if (header->dwSize != sizeof(DIPROPSTRING)) return DIERR_INVALIDPARAM; lstrcpynW( value->wsz, impl->base.instance.tszInstanceName, MAX_PATH ); return DI_OK; } case (DWORD_PTR)DIPROP_VIDPID: { DIPROPDWORD *value = (DIPROPDWORD *)header; - if (header->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM; if (!impl->attrs.VendorID || !impl->attrs.ProductID) return DIERR_UNSUPPORTED; value->dwData = MAKELONG( impl->attrs.VendorID, impl->attrs.ProductID ); return DI_OK; @@ -759,25 +718,18 @@ static HRESULT WINAPI hid_joystick_GetProperty( IDirectInputDevice8W *iface, con case (DWORD_PTR)DIPROP_JOYSTICKID: { DIPROPDWORD *value = (DIPROPDWORD *)header; - if (header->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM; value->dwData = impl->base.instance.guidInstance.Data3; return DI_OK; } case (DWORD_PTR)DIPROP_GUIDANDPATH: { DIPROPGUIDANDPATH *value = (DIPROPGUIDANDPATH *)header; - if (header->dwSize != sizeof(DIPROPGUIDANDPATH)) return DIERR_INVALIDPARAM; lstrcpynW( value->wszPath, impl->device_path, MAX_PATH ); return DI_OK; } - case (DWORD_PTR)DIPROP_AUTOCENTER: - if (header->dwSize != sizeof(DIPROPDWORD)) return DIERR_INVALIDPARAM; - return DIERR_UNSUPPORTED; - default: - return IDirectInputDevice2WImpl_GetProperty( iface, guid, header ); }
- return DI_OK; + return DIERR_UNSUPPORTED; }
static BOOL set_property_prop_range( struct hid_joystick *impl, struct hid_value_caps *caps, @@ -1298,7 +1250,7 @@ static const IDirectInputDevice8WVtbl hid_joystick_vtbl = /*** IDirectInputDevice methods ***/ IDirectInputDevice2WImpl_GetCapabilities, IDirectInputDevice2WImpl_EnumObjects, - hid_joystick_GetProperty, + IDirectInputDevice2WImpl_GetProperty, hid_joystick_SetProperty, IDirectInputDevice2WImpl_Acquire, IDirectInputDevice2WImpl_Unacquire, @@ -1551,6 +1503,7 @@ static const struct dinput_device_vtbl hid_joystick_internal_vtbl = hid_joystick_internal_acquire, hid_joystick_internal_unacquire, hid_joystick_internal_enum_objects, + hid_joystick_internal_get_property, };
static DWORD device_type_for_version( DWORD type, DWORD version ) diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c index 0d1baec3807..bb1102e38eb 100644 --- a/dlls/dinput/keyboard.c +++ b/dlls/dinput/keyboard.c @@ -273,46 +273,6 @@ static HRESULT WINAPI SysKeyboardWImpl_GetDeviceState(LPDIRECTINPUTDEVICE8W ifac return DI_OK; }
-/****************************************************************************** - * GetProperty : Retrieves information about the input device. - */ -static HRESULT WINAPI SysKeyboardWImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, - REFGUID rguid, LPDIPROPHEADER pdiph) -{ - SysKeyboardImpl *This = impl_from_IDirectInputDevice8W(iface); - - TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(rguid), pdiph); - _dump_DIPROPHEADER(pdiph); - - if (!IS_DIPROP(rguid)) return DI_OK; - - switch (LOWORD(rguid)) - { - case (DWORD_PTR)DIPROP_KEYNAME: - { - HRESULT hr; - LPDIPROPSTRING ps = (LPDIPROPSTRING)pdiph; - DIDEVICEOBJECTINSTANCEW didoi; - - if (pdiph->dwSize != sizeof(DIPROPSTRING)) - return DIERR_INVALIDPARAM; - - didoi.dwSize = sizeof(DIDEVICEOBJECTINSTANCEW); - - hr = IDirectInputDevice8_GetObjectInfo( iface, &didoi, ps->diph.dwObj, ps->diph.dwHow ); - if (hr == DI_OK) - memcpy(ps->wsz, didoi.tszName, sizeof(ps->wsz)); - return hr; - } - case (DWORD_PTR) DIPROP_VIDPID: - case (DWORD_PTR) DIPROP_RANGE: - return DIERR_UNSUPPORTED; - default: - return IDirectInputDevice2WImpl_GetProperty( iface, rguid, pdiph ); - } - return DI_OK; -} - static HRESULT keyboard_internal_acquire( IDirectInputDevice8W *iface ) { return DI_OK; @@ -388,12 +348,28 @@ static HRESULT keyboard_internal_enum_objects( IDirectInputDevice8W *iface, cons return DIENUM_CONTINUE; }
+static HRESULT keyboard_internal_get_property( IDirectInputDevice8W *iface, DWORD property, DIPROPHEADER *header, + DIDEVICEOBJECTINSTANCEW *instance ) +{ + switch (property) + { + case (DWORD_PTR)DIPROP_KEYNAME: + { + DIPROPSTRING *value = (DIPROPSTRING *)header; + lstrcpynW( value->wsz, instance->tszName, ARRAY_SIZE(value->wsz) ); + return DI_OK; + } + } + return DIERR_UNSUPPORTED; +} + static const struct dinput_device_vtbl keyboard_internal_vtbl = { NULL, keyboard_internal_acquire, keyboard_internal_unacquire, keyboard_internal_enum_objects, + keyboard_internal_get_property, };
static const IDirectInputDevice8WVtbl SysKeyboardWvt = @@ -403,7 +379,7 @@ static const IDirectInputDevice8WVtbl SysKeyboardWvt = IDirectInputDevice2WImpl_Release, IDirectInputDevice2WImpl_GetCapabilities, IDirectInputDevice2WImpl_EnumObjects, - SysKeyboardWImpl_GetProperty, + IDirectInputDevice2WImpl_GetProperty, IDirectInputDevice2WImpl_SetProperty, IDirectInputDevice2WImpl_Acquire, IDirectInputDevice2WImpl_Unacquire, diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c index 23570e1f906..f6aedda080a 100644 --- a/dlls/dinput/mouse.c +++ b/dlls/dinput/mouse.c @@ -495,65 +495,6 @@ static HRESULT WINAPI SysMouseWImpl_GetDeviceData(LPDIRECTINPUTDEVICE8W iface, return res; }
-/****************************************************************************** - * GetProperty : get input device properties - */ -static HRESULT WINAPI SysMouseWImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REFGUID rguid, LPDIPROPHEADER pdiph) -{ - SysMouseImpl *This = impl_from_IDirectInputDevice8W(iface); - - TRACE("(%p) %s,%p\n", This, debugstr_guid(rguid), pdiph); - _dump_DIPROPHEADER(pdiph); - - if (IS_DIPROP(rguid)) { - switch (LOWORD(rguid)) { - case (DWORD_PTR) DIPROP_GRANULARITY: { - LPDIPROPDWORD pr = (LPDIPROPDWORD) pdiph; - - 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; - } - - case (DWORD_PTR) DIPROP_RANGE: { - LPDIPROPRANGE pr = (LPDIPROPRANGE) pdiph; - - if ((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)))) { - /* Querying the range of either the X or the Y axis. As I do - not know the range, do as if the range were - unrestricted...*/ - pr->lMin = DIPROPRANGE_NOMIN; - pr->lMax = DIPROPRANGE_NOMAX; - } - - break; - } - case (DWORD_PTR) DIPROP_VIDPID: - return DIERR_UNSUPPORTED; - default: - return IDirectInputDevice2WImpl_GetProperty(iface, rguid, pdiph); - } - } - - return DI_OK; -} - static HRESULT mouse_internal_acquire( IDirectInputDevice8W *iface ) { SysMouseImpl *impl = impl_from_IDirectInputDevice8W( iface ); @@ -731,12 +672,36 @@ static HRESULT mouse_internal_enum_objects( IDirectInputDevice8W *iface, const D return DIENUM_CONTINUE; }
+static HRESULT mouse_internal_get_property( IDirectInputDevice8W *iface, DWORD property, DIPROPHEADER *header, + DIDEVICEOBJECTINSTANCEW *instance ) +{ + switch (property) + { + case (DWORD_PTR)DIPROP_RANGE: + { + DIPROPRANGE *range = (DIPROPRANGE *)header; + range->lMin = DIPROPRANGE_NOMIN; + range->lMax = DIPROPRANGE_NOMAX; + return DI_OK; + } + case (DWORD_PTR)DIPROP_GRANULARITY: + { + DIPROPDWORD *value = (DIPROPDWORD *)header; + if (instance->dwType == DIMOFS_Z) value->dwData = WHEEL_DELTA; + else value->dwData = 1; + return DI_OK; + } + } + return DIERR_UNSUPPORTED; +} + static const struct dinput_device_vtbl mouse_internal_vtbl = { NULL, mouse_internal_acquire, mouse_internal_unacquire, mouse_internal_enum_objects, + mouse_internal_get_property, };
static const IDirectInputDevice8WVtbl SysMouseWvt = @@ -746,7 +711,7 @@ static const IDirectInputDevice8WVtbl SysMouseWvt = IDirectInputDevice2WImpl_Release, IDirectInputDevice2WImpl_GetCapabilities, IDirectInputDevice2WImpl_EnumObjects, - SysMouseWImpl_GetProperty, + IDirectInputDevice2WImpl_GetProperty, IDirectInputDevice2WImpl_SetProperty, IDirectInputDevice2WImpl_Acquire, IDirectInputDevice2WImpl_Unacquire, diff --git a/dlls/dinput8/tests/device.c b/dlls/dinput8/tests/device.c index c6cf5867657..9f331c1b84c 100644 --- a/dlls/dinput8/tests/device.c +++ b/dlls/dinput8/tests/device.c @@ -1291,18 +1291,14 @@ static void test_mouse_info(void) prop_dword.diph.dwHow = DIPH_BYOFFSET; prop_dword.diph.dwObj = DIMOFS_X; hr = IDirectInputDevice8_GetProperty( device, DIPROP_GRANULARITY, &prop_dword.diph ); - todo_wine ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_GRANULARITY returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_DEADZONE, &prop_dword.diph ); - todo_wine ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_DEADZONE returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_SATURATION, &prop_dword.diph ); - todo_wine ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_SATURATION returned %#x\n", hr ); prop_range.diph.dwHow = DIPH_BYOFFSET; prop_range.diph.dwObj = DIMOFS_X; hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph ); - todo_wine ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_RANGE returned %#x\n", hr );
prop_dword.diph.dwHow = DIPH_DEVICE; @@ -1340,44 +1336,34 @@ static void test_mouse_info(void) hr = IDirectInputDevice8_GetProperty( device, DIPROP_VIDPID, &prop_dword.diph ); ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_VIDPID returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_GUIDANDPATH, &prop_guid_path.diph ); - todo_wine ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_GUIDANDPATH returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_INSTANCENAME, &prop_string.diph ); - todo_wine ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_INSTANCENAME returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_PRODUCTNAME, &prop_string.diph ); - todo_wine ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_PRODUCTNAME returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_TYPENAME, &prop_string.diph ); - todo_wine ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_TYPENAME returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_USERNAME, &prop_string.diph ); ok( hr == S_FALSE, "GetProperty DIPROP_USERNAME returned %#x\n", hr ); ok( !wcscmp( prop_string.wsz, L"" ), "got user %s\n", debugstr_w(prop_string.wsz) );
hr = IDirectInputDevice8_GetProperty( device, DIPROP_JOYSTICKID, &prop_dword.diph ); - todo_wine ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_VIDPID returned %#x\n", hr );
hr = IDirectInputDevice8_GetProperty( device, DIPROP_CALIBRATION, &prop_dword.diph ); ok( hr == DIERR_INVALIDPARAM, "GetProperty DIPROP_CALIBRATION returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph ); - todo_wine ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_AUTOCENTER returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_DEADZONE, &prop_dword.diph ); - todo_wine ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_DEADZONE returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFLOAD, &prop_dword.diph ); - todo_wine ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_FFLOAD returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_GRANULARITY, &prop_dword.diph ); - todo_wine ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_GRANULARITY returned %#x\n", hr );
prop_dword.diph.dwHow = DIPH_BYUSAGE; prop_dword.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_GRANULARITY, &prop_dword.diph ); - todo_wine ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_GRANULARITY returned %#x\n", hr );
prop_dword.diph.dwHow = DIPH_BYOFFSET; @@ -1387,18 +1373,14 @@ static void test_mouse_info(void) ok( hr == DI_OK, "GetProperty DIPROP_GRANULARITY returned %#x\n", hr ); ok( prop_dword.dwData == 1, "got %d expected 1\n", prop_dword.dwData ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_DEADZONE, &prop_dword.diph ); - todo_wine ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_DEADZONE returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_SATURATION, &prop_dword.diph ); - todo_wine ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_SATURATION returned %#x\n", hr ); prop_range.lMin = 0xdeadbeef; prop_range.lMax = 0xdeadbeef; hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph ); ok( hr == DI_OK, "GetProperty DIPROP_RANGE returned %#x\n", hr ); - todo_wine ok( prop_range.lMin == DIPROPRANGE_NOMIN, "got %d expected %d\n", prop_range.lMin, DIPROPRANGE_NOMIN ); - todo_wine ok( prop_range.lMax == DIPROPRANGE_NOMAX, "got %d expected %d\n", prop_range.lMax, DIPROPRANGE_NOMAX );
res = 0; @@ -1632,18 +1614,14 @@ static void test_keyboard_info(void) prop_dword.diph.dwHow = DIPH_BYOFFSET; prop_dword.diph.dwObj = 1; hr = IDirectInputDevice8_GetProperty( device, DIPROP_GRANULARITY, &prop_dword.diph ); - todo_wine ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_GRANULARITY returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_DEADZONE, &prop_dword.diph ); - todo_wine ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_DEADZONE returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_SATURATION, &prop_dword.diph ); - todo_wine ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_SATURATION returned %#x\n", hr ); prop_range.diph.dwHow = DIPH_BYOFFSET; prop_range.diph.dwObj = 1; hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph ); - todo_wine ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_RANGE returned %#x\n", hr );
prop_dword.diph.dwHow = DIPH_DEVICE; @@ -1681,56 +1659,43 @@ static void test_keyboard_info(void) hr = IDirectInputDevice8_GetProperty( device, DIPROP_VIDPID, &prop_dword.diph ); ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_VIDPID returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_GUIDANDPATH, &prop_guid_path.diph ); - todo_wine ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_GUIDANDPATH returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_INSTANCENAME, &prop_string.diph ); - todo_wine ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_INSTANCENAME returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_PRODUCTNAME, &prop_string.diph ); - todo_wine ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_PRODUCTNAME returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_TYPENAME, &prop_string.diph ); - todo_wine ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_TYPENAME returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_USERNAME, &prop_string.diph ); ok( hr == S_FALSE, "GetProperty DIPROP_USERNAME returned %#x\n", hr ); ok( !wcscmp( prop_string.wsz, L"" ), "got user %s\n", debugstr_w(prop_string.wsz) );
hr = IDirectInputDevice8_GetProperty( device, DIPROP_JOYSTICKID, &prop_dword.diph ); - todo_wine ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_VIDPID returned %#x\n", hr );
hr = IDirectInputDevice8_GetProperty( device, DIPROP_CALIBRATION, &prop_dword.diph ); ok( hr == DIERR_INVALIDPARAM, "GetProperty DIPROP_CALIBRATION returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph ); - todo_wine ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_AUTOCENTER returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_DEADZONE, &prop_dword.diph ); - todo_wine ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_DEADZONE returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFLOAD, &prop_dword.diph ); - todo_wine ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_FFLOAD returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_GRANULARITY, &prop_dword.diph ); - todo_wine ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_GRANULARITY returned %#x\n", hr );
prop_dword.diph.dwHow = DIPH_BYUSAGE; prop_dword.diph.dwObj = MAKELONG( HID_USAGE_KEYBOARD_LCTRL, HID_USAGE_PAGE_KEYBOARD ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_GRANULARITY, &prop_dword.diph ); - todo_wine ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_GRANULARITY returned %#x\n", hr );
prop_dword.diph.dwHow = DIPH_BYOFFSET; prop_dword.diph.dwObj = 1; hr = IDirectInputDevice8_GetProperty( device, DIPROP_GRANULARITY, &prop_dword.diph ); - todo_wine ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_GRANULARITY returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_DEADZONE, &prop_dword.diph ); - todo_wine ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_DEADZONE returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_SATURATION, &prop_dword.diph ); - todo_wine ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_SATURATION returned %#x\n", hr ); prop_range.diph.dwHow = DIPH_BYOFFSET; prop_range.diph.dwObj = 1; diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index 8fda1289843..8bb463b2fd7 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -4004,7 +4004,6 @@ static void test_simple_joystick(void) hr = IDirectInputDevice8_GetProperty( device, DIPROP_DEADZONE, &prop_dword.diph ); ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_DEADZONE returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFLOAD, &prop_dword.diph ); - todo_wine ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_FFLOAD returned %#x\n", hr ); hr = IDirectInputDevice8_GetProperty( device, DIPROP_GRANULARITY, &prop_dword.diph ); ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_GRANULARITY returned %#x\n", hr );