dinput: Implement DIPROP_KEYNAME property for keyboard device.

Based on patch from Sergey Khodych.
This commit is contained in:
Vitaliy Margolen 2008-09-14 12:51:23 -06:00 committed by Alexandre Julliard
parent 5085d4cd35
commit d939367ac8
2 changed files with 45 additions and 2 deletions

View File

@ -430,6 +430,42 @@ static HRESULT WINAPI SysKeyboardWImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8W iface
return DI_OK; return DI_OK;
} }
/******************************************************************************
* GetProperty : Retrieves information about the input device.
*/
static HRESULT WINAPI SysKeyboardAImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface,
REFGUID rguid, LPDIPROPHEADER pdiph)
{
TRACE("(%p) %s,%p\n", iface, debugstr_guid(rguid), pdiph);
_dump_DIPROPHEADER(pdiph);
if (HIWORD(rguid)) return DI_OK;
switch (LOWORD(rguid))
{
case (DWORD)DIPROP_KEYNAME:
{
HRESULT hr;
LPDIPROPSTRING ps = (LPDIPROPSTRING)pdiph;
DIDEVICEOBJECTINSTANCEW didoi;
if (pdiph->dwSize != sizeof(DIPROPSTRING))
return DIERR_INVALIDPARAM;
didoi.dwSize = sizeof(DIDEVICEOBJECTINSTANCEW);
hr = SysKeyboardWImpl_GetObjectInfo((LPDIRECTINPUTDEVICE8W)iface , &didoi,
ps->diph.dwObj, ps->diph.dwHow);
if (hr == DI_OK)
memcpy(ps->wsz, didoi.tszName, sizeof(ps->wsz));
return hr;
}
default:
return IDirectInputDevice2AImpl_GetProperty( iface, rguid, pdiph );
}
return DI_OK;
}
static const IDirectInputDevice8AVtbl SysKeyboardAvt = static const IDirectInputDevice8AVtbl SysKeyboardAvt =
{ {
IDirectInputDevice2AImpl_QueryInterface, IDirectInputDevice2AImpl_QueryInterface,
@ -437,7 +473,7 @@ static const IDirectInputDevice8AVtbl SysKeyboardAvt =
IDirectInputDevice2AImpl_Release, IDirectInputDevice2AImpl_Release,
SysKeyboardAImpl_GetCapabilities, SysKeyboardAImpl_GetCapabilities,
IDirectInputDevice2AImpl_EnumObjects, IDirectInputDevice2AImpl_EnumObjects,
IDirectInputDevice2AImpl_GetProperty, SysKeyboardAImpl_GetProperty,
IDirectInputDevice2AImpl_SetProperty, IDirectInputDevice2AImpl_SetProperty,
IDirectInputDevice2AImpl_Acquire, IDirectInputDevice2AImpl_Acquire,
IDirectInputDevice2AImpl_Unacquire, IDirectInputDevice2AImpl_Unacquire,
@ -479,7 +515,7 @@ static const IDirectInputDevice8WVtbl SysKeyboardWvt =
XCAST(Release)IDirectInputDevice2AImpl_Release, XCAST(Release)IDirectInputDevice2AImpl_Release,
XCAST(GetCapabilities)SysKeyboardAImpl_GetCapabilities, XCAST(GetCapabilities)SysKeyboardAImpl_GetCapabilities,
IDirectInputDevice2WImpl_EnumObjects, IDirectInputDevice2WImpl_EnumObjects,
XCAST(GetProperty)IDirectInputDevice2AImpl_GetProperty, XCAST(GetProperty)SysKeyboardAImpl_GetProperty,
XCAST(SetProperty)IDirectInputDevice2AImpl_SetProperty, XCAST(SetProperty)IDirectInputDevice2AImpl_SetProperty,
XCAST(Acquire)IDirectInputDevice2AImpl_Acquire, XCAST(Acquire)IDirectInputDevice2AImpl_Acquire,
XCAST(Unacquire)IDirectInputDevice2AImpl_Unacquire, XCAST(Unacquire)IDirectInputDevice2AImpl_Unacquire,

View File

@ -725,6 +725,12 @@ typedef struct DIPROPGUIDANDPATH {
} DIPROPGUIDANDPATH, *LPDIPROPGUIDANDPATH; } DIPROPGUIDANDPATH, *LPDIPROPGUIDANDPATH;
typedef const DIPROPGUIDANDPATH *LPCDIPROPGUIDANDPATH; typedef const DIPROPGUIDANDPATH *LPCDIPROPGUIDANDPATH;
typedef struct DIPROPSTRING {
DIPROPHEADER diph;
WCHAR wsz[MAX_PATH];
} DIPROPSTRING, *LPDIPROPSTRING;
typedef const DIPROPSTRING *LPCDIPROPSTRING;
/* special property GUIDs */ /* special property GUIDs */
#ifdef __cplusplus #ifdef __cplusplus
#define MAKEDIPROP(prop) (*(const GUID *)(prop)) #define MAKEDIPROP(prop) (*(const GUID *)(prop))
@ -755,6 +761,7 @@ typedef const DIPROPGUIDANDPATH *LPCDIPROPGUIDANDPATH;
#define DIPROP_CALIBRATION MAKEDIPROP(11) #define DIPROP_CALIBRATION MAKEDIPROP(11)
#define DIPROP_GUIDANDPATH MAKEDIPROP(12) #define DIPROP_GUIDANDPATH MAKEDIPROP(12)
#define DIPROP_KEYNAME MAKEDIPROP(20)
typedef struct DIDEVCAPS_DX3 { typedef struct DIDEVCAPS_DX3 {
DWORD dwSize; DWORD dwSize;