Commit d939367a authored by Vitaliy Margolen's avatar Vitaliy Margolen Committed by Alexandre Julliard

dinput: Implement DIPROP_KEYNAME property for keyboard device.

Based on patch from Sergey Khodych.
parent 5085d4cd
......@@ -430,6 +430,42 @@ static HRESULT WINAPI SysKeyboardWImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8W iface
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 =
{
IDirectInputDevice2AImpl_QueryInterface,
......@@ -437,7 +473,7 @@ static const IDirectInputDevice8AVtbl SysKeyboardAvt =
IDirectInputDevice2AImpl_Release,
SysKeyboardAImpl_GetCapabilities,
IDirectInputDevice2AImpl_EnumObjects,
IDirectInputDevice2AImpl_GetProperty,
SysKeyboardAImpl_GetProperty,
IDirectInputDevice2AImpl_SetProperty,
IDirectInputDevice2AImpl_Acquire,
IDirectInputDevice2AImpl_Unacquire,
......@@ -479,7 +515,7 @@ static const IDirectInputDevice8WVtbl SysKeyboardWvt =
XCAST(Release)IDirectInputDevice2AImpl_Release,
XCAST(GetCapabilities)SysKeyboardAImpl_GetCapabilities,
IDirectInputDevice2WImpl_EnumObjects,
XCAST(GetProperty)IDirectInputDevice2AImpl_GetProperty,
XCAST(GetProperty)SysKeyboardAImpl_GetProperty,
XCAST(SetProperty)IDirectInputDevice2AImpl_SetProperty,
XCAST(Acquire)IDirectInputDevice2AImpl_Acquire,
XCAST(Unacquire)IDirectInputDevice2AImpl_Unacquire,
......
......@@ -725,6 +725,12 @@ typedef struct DIPROPGUIDANDPATH {
} DIPROPGUIDANDPATH, *LPDIPROPGUIDANDPATH;
typedef const DIPROPGUIDANDPATH *LPCDIPROPGUIDANDPATH;
typedef struct DIPROPSTRING {
DIPROPHEADER diph;
WCHAR wsz[MAX_PATH];
} DIPROPSTRING, *LPDIPROPSTRING;
typedef const DIPROPSTRING *LPCDIPROPSTRING;
/* special property GUIDs */
#ifdef __cplusplus
#define MAKEDIPROP(prop) (*(const GUID *)(prop))
......@@ -755,6 +761,7 @@ typedef const DIPROPGUIDANDPATH *LPCDIPROPGUIDANDPATH;
#define DIPROP_CALIBRATION MAKEDIPROP(11)
#define DIPROP_GUIDANDPATH MAKEDIPROP(12)
#define DIPROP_KEYNAME MAKEDIPROP(20)
typedef struct DIDEVCAPS_DX3 {
DWORD dwSize;
......
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