Implemented EnumObjects for the keyboard device.

This commit is contained in:
Lionel Ulmer 2003-02-12 21:27:00 +00:00 committed by Alexandre Julliard
parent dff968b5f3
commit d14ad4ff8a
3 changed files with 40 additions and 5 deletions

View File

@ -102,8 +102,8 @@ void _dump_DIPROPHEADER(DIPROPHEADER *diph) {
void _dump_OBJECTINSTANCEA(DIDEVICEOBJECTINSTANCEA *ddoi) { void _dump_OBJECTINSTANCEA(DIDEVICEOBJECTINSTANCEA *ddoi) {
if (TRACE_ON(dinput)) { if (TRACE_ON(dinput)) {
DPRINTF(" - enumerating : 0x%08lx - %2ld - 0x%08lx - %s\n", DPRINTF(" - enumerating : %s - %2ld - 0x%08lx - %s\n",
ddoi->guidType.Data1, ddoi->dwOfs, ddoi->dwType, ddoi->tszName); debugstr_guid(&ddoi->guidType), ddoi->dwOfs, ddoi->dwType, ddoi->tszName);
} }
} }

View File

@ -166,7 +166,7 @@ static SysKeyboardAImpl *alloc_device(REFGUID rguid, LPVOID kvt, IDirectInputAIm
EnterCriticalSection(&keyboard_crit); EnterCriticalSection(&keyboard_crit);
if (!keyboard_users++) if (!keyboard_users++)
keyboard_hook = SetWindowsHookExW( WH_KEYBOARD_LL, KeyboardCallback, DINPUT_instance, 0 ); keyboard_hook = SetWindowsHookExW( WH_KEYBOARD_LL, KeyboardCallback, DINPUT_instance, 0 );
LeaveCriticalSection(&keyboard_crit); LeaveCriticalSection(&keyboard_crit);
return newDevice; return newDevice;
@ -326,6 +326,40 @@ static HRESULT WINAPI SysKeyboardAImpl_GetDeviceData(
return ret; return ret;
} }
static HRESULT WINAPI SysKeyboardAImpl_EnumObjects(
LPDIRECTINPUTDEVICE8A iface,
LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback,
LPVOID lpvRef,
DWORD dwFlags)
{
ICOM_THIS(SysKeyboardAImpl,iface);
DIDEVICEOBJECTINSTANCEA ddoi;
int i;
TRACE("(this=%p,%p,%p,%08lx)\n", This, lpCallback, lpvRef, dwFlags);
if (TRACE_ON(dinput)) {
DPRINTF(" - flags = ");
_dump_EnumObjects_flags(dwFlags);
DPRINTF("\n");
}
/* Only the fields till dwFFMaxForce are relevant */
memset(&ddoi, 0, sizeof(ddoi));
ddoi.dwSize = FIELD_OFFSET(DIDEVICEOBJECTINSTANCEA, dwFFMaxForce);
for (i = 0; i < 256; i++) {
/* Report 255 keys :-) */
ddoi.guidType = GUID_Key;
ddoi.dwOfs = i;
ddoi.dwType = DIDFT_MAKEINSTANCE(i) | DIDFT_BUTTON;
strcpy(ddoi.tszName, "a"); /* This should be better handled :-/ */
_dump_OBJECTINSTANCEA(&ddoi);
if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK;
}
return DI_OK;
}
static HRESULT WINAPI SysKeyboardAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface); static HRESULT WINAPI SysKeyboardAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface);
static HRESULT WINAPI SysKeyboardAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface) static HRESULT WINAPI SysKeyboardAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
@ -412,7 +446,7 @@ static HRESULT WINAPI SysKeyboardAImpl_GetCapabilities(
lpDIDevCaps->dwFlags = DIDC_ATTACHED; lpDIDevCaps->dwFlags = DIDC_ATTACHED;
lpDIDevCaps->dwDevType = DIDEVTYPE_KEYBOARD; lpDIDevCaps->dwDevType = DIDEVTYPE_KEYBOARD;
lpDIDevCaps->dwAxes = 0; lpDIDevCaps->dwAxes = 0;
lpDIDevCaps->dwButtons = 0; lpDIDevCaps->dwButtons = 256;
lpDIDevCaps->dwPOVs = 0; lpDIDevCaps->dwPOVs = 0;
lpDIDevCaps->dwFFSamplePeriod = 0; lpDIDevCaps->dwFFSamplePeriod = 0;
lpDIDevCaps->dwFFMinTimeResolution = 0; lpDIDevCaps->dwFFMinTimeResolution = 0;
@ -434,7 +468,7 @@ static ICOM_VTABLE(IDirectInputDevice8A) SysKeyboardAvt =
IDirectInputDevice2AImpl_AddRef, IDirectInputDevice2AImpl_AddRef,
SysKeyboardAImpl_Release, SysKeyboardAImpl_Release,
SysKeyboardAImpl_GetCapabilities, SysKeyboardAImpl_GetCapabilities,
IDirectInputDevice2AImpl_EnumObjects, SysKeyboardAImpl_EnumObjects,
IDirectInputDevice2AImpl_GetProperty, IDirectInputDevice2AImpl_GetProperty,
SysKeyboardAImpl_SetProperty, SysKeyboardAImpl_SetProperty,
SysKeyboardAImpl_Acquire, SysKeyboardAImpl_Acquire,

View File

@ -874,6 +874,7 @@ static HRESULT WINAPI SysMouseAImpl_EnumObjects(
} }
/* Only the fields till dwFFMaxForce are relevant */ /* Only the fields till dwFFMaxForce are relevant */
memset(&ddoi, 0, sizeof(ddoi));
ddoi.dwSize = FIELD_OFFSET(DIDEVICEOBJECTINSTANCEA, dwFFMaxForce); ddoi.dwSize = FIELD_OFFSET(DIDEVICEOBJECTINSTANCEA, dwFFMaxForce);
/* In a mouse, we have : two relative axis and three buttons */ /* In a mouse, we have : two relative axis and three buttons */