dinput: Explicitly define ASCII and Unicode methods in keyboard.

This commit is contained in:
Vitaliy Margolen 2011-01-09 15:43:58 -07:00 committed by Alexandre Julliard
parent 0f24b9e86f
commit 9f9e376239
1 changed files with 74 additions and 57 deletions

View File

@ -58,6 +58,14 @@ static inline SysKeyboardImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice
{ {
return (SysKeyboardImpl *) iface; return (SysKeyboardImpl *) iface;
} }
static inline IDirectInputDevice8A *IDirectInputDevice8A_from_impl(SysKeyboardImpl *This)
{
return (IDirectInputDevice8A *)This;
}
static inline IDirectInputDevice8W *IDirectInputDevice8W_from_impl(SysKeyboardImpl *This)
{
return (IDirectInputDevice8W *)This;
}
static BYTE map_dik_code(DWORD scanCode, DWORD vkCode) static BYTE map_dik_code(DWORD scanCode, DWORD vkCode)
{ {
@ -302,11 +310,9 @@ const struct dinput_device keyboard_device = {
keyboarddev_create_deviceW keyboarddev_create_deviceW
}; };
static HRESULT WINAPI SysKeyboardAImpl_GetDeviceState( static HRESULT WINAPI SysKeyboardWImpl_GetDeviceState(LPDIRECTINPUTDEVICE8W iface, DWORD len, LPVOID ptr)
LPDIRECTINPUTDEVICE8A iface,DWORD len,LPVOID ptr
)
{ {
SysKeyboardImpl *This = impl_from_IDirectInputDevice8A(iface); SysKeyboardImpl *This = impl_from_IDirectInputDevice8W(iface);
TRACE("(%p)->(%d,%p)\n", This, len, ptr); TRACE("(%p)->(%d,%p)\n", This, len, ptr);
if (!This->base.acquired) return DIERR_NOTACQUIRED; if (!This->base.acquired) return DIERR_NOTACQUIRED;
@ -330,14 +336,18 @@ static HRESULT WINAPI SysKeyboardAImpl_GetDeviceState(
return DI_OK; return DI_OK;
} }
static HRESULT WINAPI SysKeyboardAImpl_GetDeviceState(LPDIRECTINPUTDEVICE8A iface, DWORD len, LPVOID ptr)
{
SysKeyboardImpl *This = impl_from_IDirectInputDevice8A(iface);
return SysKeyboardWImpl_GetDeviceState(IDirectInputDevice8W_from_impl(This), len, ptr);
}
/****************************************************************************** /******************************************************************************
* GetCapabilities : get the device capabilities * GetCapabilities : get the device capabilities
*/ */
static HRESULT WINAPI SysKeyboardAImpl_GetCapabilities( static HRESULT WINAPI SysKeyboardWImpl_GetCapabilities(LPDIRECTINPUTDEVICE8W iface, LPDIDEVCAPS lpDIDevCaps)
LPDIRECTINPUTDEVICE8A iface,
LPDIDEVCAPS lpDIDevCaps)
{ {
SysKeyboardImpl *This = impl_from_IDirectInputDevice8A(iface); SysKeyboardImpl *This = impl_from_IDirectInputDevice8W(iface);
DIDEVCAPS devcaps; DIDEVCAPS devcaps;
TRACE("(this=%p,%p)\n",This,lpDIDevCaps); TRACE("(this=%p,%p)\n",This,lpDIDevCaps);
@ -367,6 +377,12 @@ static HRESULT WINAPI SysKeyboardAImpl_GetCapabilities(
return DI_OK; return DI_OK;
} }
static HRESULT WINAPI SysKeyboardAImpl_GetCapabilities(LPDIRECTINPUTDEVICE8A iface, LPDIDEVCAPS lpDIDevCaps)
{
SysKeyboardImpl *This = impl_from_IDirectInputDevice8A(iface);
return SysKeyboardWImpl_GetCapabilities(IDirectInputDevice8W_from_impl(This), lpDIDevCaps);
}
/****************************************************************************** /******************************************************************************
* GetObjectInfo : get information about a device object such as a button * GetObjectInfo : get information about a device object such as a button
* or axis * or axis
@ -450,9 +466,11 @@ static HRESULT WINAPI SysKeyboardWImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8W iface
/****************************************************************************** /******************************************************************************
* GetProperty : Retrieves information about the input device. * GetProperty : Retrieves information about the input device.
*/ */
static HRESULT WINAPI SysKeyboardAImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface, static HRESULT WINAPI SysKeyboardWImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface,
REFGUID rguid, LPDIPROPHEADER pdiph) REFGUID rguid, LPDIPROPHEADER pdiph)
{ {
SysKeyboardImpl *This = impl_from_IDirectInputDevice8W(iface);
TRACE("(%p) %s,%p\n", iface, debugstr_guid(rguid), pdiph); TRACE("(%p) %s,%p\n", iface, debugstr_guid(rguid), pdiph);
_dump_DIPROPHEADER(pdiph); _dump_DIPROPHEADER(pdiph);
@ -471,18 +489,24 @@ static HRESULT WINAPI SysKeyboardAImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface,
didoi.dwSize = sizeof(DIDEVICEOBJECTINSTANCEW); didoi.dwSize = sizeof(DIDEVICEOBJECTINSTANCEW);
hr = SysKeyboardWImpl_GetObjectInfo((LPDIRECTINPUTDEVICE8W)iface , &didoi, hr = SysKeyboardWImpl_GetObjectInfo(iface, &didoi, ps->diph.dwObj, ps->diph.dwHow);
ps->diph.dwObj, ps->diph.dwHow);
if (hr == DI_OK) if (hr == DI_OK)
memcpy(ps->wsz, didoi.tszName, sizeof(ps->wsz)); memcpy(ps->wsz, didoi.tszName, sizeof(ps->wsz));
return hr; return hr;
} }
default: default:
return IDirectInputDevice2AImpl_GetProperty( iface, rguid, pdiph ); return IDirectInputDevice2AImpl_GetProperty( IDirectInputDevice8A_from_impl(This), rguid, pdiph );
} }
return DI_OK; return DI_OK;
} }
static HRESULT WINAPI SysKeyboardAImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface,
REFGUID rguid, LPDIPROPHEADER pdiph)
{
SysKeyboardImpl *This = impl_from_IDirectInputDevice8A(iface);
return SysKeyboardWImpl_GetProperty(IDirectInputDevice8W_from_impl(This), rguid, pdiph);
}
static const IDirectInputDevice8AVtbl SysKeyboardAvt = static const IDirectInputDevice8AVtbl SysKeyboardAvt =
{ {
IDirectInputDevice2AImpl_QueryInterface, IDirectInputDevice2AImpl_QueryInterface,
@ -519,24 +543,18 @@ static const IDirectInputDevice8AVtbl SysKeyboardAvt =
IDirectInputDevice8AImpl_GetImageInfo IDirectInputDevice8AImpl_GetImageInfo
}; };
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
# define XCAST(fun) (typeof(SysKeyboardWvt.fun))
#else
# define XCAST(fun) (void*)
#endif
static const IDirectInputDevice8WVtbl SysKeyboardWvt = static const IDirectInputDevice8WVtbl SysKeyboardWvt =
{ {
IDirectInputDevice2WImpl_QueryInterface, IDirectInputDevice2WImpl_QueryInterface,
IDirectInputDevice2WImpl_AddRef, IDirectInputDevice2WImpl_AddRef,
IDirectInputDevice2WImpl_Release, IDirectInputDevice2WImpl_Release,
XCAST(GetCapabilities)SysKeyboardAImpl_GetCapabilities, SysKeyboardWImpl_GetCapabilities,
IDirectInputDevice2WImpl_EnumObjects, IDirectInputDevice2WImpl_EnumObjects,
XCAST(GetProperty)SysKeyboardAImpl_GetProperty, SysKeyboardWImpl_GetProperty,
IDirectInputDevice2WImpl_SetProperty, IDirectInputDevice2WImpl_SetProperty,
IDirectInputDevice2WImpl_Acquire, IDirectInputDevice2WImpl_Acquire,
IDirectInputDevice2WImpl_Unacquire, IDirectInputDevice2WImpl_Unacquire,
XCAST(GetDeviceState)SysKeyboardAImpl_GetDeviceState, SysKeyboardWImpl_GetDeviceState,
IDirectInputDevice2WImpl_GetDeviceData, IDirectInputDevice2WImpl_GetDeviceData,
IDirectInputDevice2WImpl_SetDataFormat, IDirectInputDevice2WImpl_SetDataFormat,
IDirectInputDevice2WImpl_SetEventNotification, IDirectInputDevice2WImpl_SetEventNotification,
@ -560,4 +578,3 @@ static const IDirectInputDevice8WVtbl SysKeyboardWvt =
IDirectInputDevice8WImpl_SetActionMap, IDirectInputDevice8WImpl_SetActionMap,
IDirectInputDevice8WImpl_GetImageInfo IDirectInputDevice8WImpl_GetImageInfo
}; };
#undef XCAST