Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/device.c | 150 ++++++++++++++++++++----------------------- 1 file changed, 69 insertions(+), 81 deletions(-)
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index 705aec2baca..679f907f2de 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -929,17 +929,18 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire( IDirectInputDevice8W * * IDirectInputDeviceA */
-static HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat( IDirectInputDevice8W *iface, LPCDIDATAFORMAT df ) +static HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat( IDirectInputDevice8W *iface, const DIDATAFORMAT *format ) { IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); HRESULT res = DI_OK;
- if (!df) return E_POINTER; - TRACE("(%p) %p\n", This, df); - _dump_DIDATAFORMAT(df); + TRACE( "iface %p, format %p.\n", iface, format );
- if (df->dwSize != sizeof(DIDATAFORMAT)) return DIERR_INVALIDPARAM; - if (df->dwObjSize != sizeof(DIOBJECTDATAFORMAT)) return DIERR_INVALIDPARAM; + if (!format) return E_POINTER; + _dump_DIDATAFORMAT( format ); + + if (format->dwSize != sizeof(DIDATAFORMAT)) return DIERR_INVALIDPARAM; + if (format->dwObjSize != sizeof(DIOBJECTDATAFORMAT)) return DIERR_INVALIDPARAM; if (This->acquired) return DIERR_ACQUIRED;
EnterCriticalSection(&This->crit); @@ -949,7 +950,7 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat( IDirectInputDevice This->num_actions = 0;
release_DataFormat(&This->data_format); - res = create_DataFormat(df, &This->data_format); + res = create_DataFormat( format, &This->data_format );
LeaveCriticalSection(&This->crit); return res; @@ -961,32 +962,31 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat( IDirectInputDevice * Set cooperative level and the source window for the events. */ static HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel( IDirectInputDevice8W *iface, - HWND hwnd, DWORD dwflags ) + HWND hwnd, DWORD flags ) { IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); HRESULT hr;
- TRACE("(%p) %p,0x%08x\n", This, hwnd, dwflags); - _dump_cooperativelevel_DI(dwflags); + TRACE( "iface %p, hwnd %p, flags %#x.\n", iface, hwnd, flags ); + + _dump_cooperativelevel_DI( flags );
- if ((dwflags & (DISCL_EXCLUSIVE | DISCL_NONEXCLUSIVE)) == 0 || - (dwflags & (DISCL_EXCLUSIVE | DISCL_NONEXCLUSIVE)) == (DISCL_EXCLUSIVE | DISCL_NONEXCLUSIVE) || - (dwflags & (DISCL_FOREGROUND | DISCL_BACKGROUND)) == 0 || - (dwflags & (DISCL_FOREGROUND | DISCL_BACKGROUND)) == (DISCL_FOREGROUND | DISCL_BACKGROUND)) + if ((flags & (DISCL_EXCLUSIVE | DISCL_NONEXCLUSIVE)) == 0 || + (flags & (DISCL_EXCLUSIVE | DISCL_NONEXCLUSIVE)) == (DISCL_EXCLUSIVE | DISCL_NONEXCLUSIVE) || + (flags & (DISCL_FOREGROUND | DISCL_BACKGROUND)) == 0 || + (flags & (DISCL_FOREGROUND | DISCL_BACKGROUND)) == (DISCL_FOREGROUND | DISCL_BACKGROUND)) return DIERR_INVALIDPARAM;
if (hwnd && GetWindowLongW(hwnd, GWL_STYLE) & WS_CHILD) return E_HANDLE;
- if (!hwnd && dwflags == (DISCL_NONEXCLUSIVE | DISCL_BACKGROUND)) - hwnd = GetDesktopWindow(); + if (!hwnd && flags == (DISCL_NONEXCLUSIVE | DISCL_BACKGROUND)) hwnd = GetDesktopWindow();
if (!IsWindow(hwnd)) return E_HANDLE;
/* For security reasons native does not allow exclusive background level for mouse and keyboard only */ - if (dwflags & DISCL_EXCLUSIVE && dwflags & DISCL_BACKGROUND && - (IsEqualGUID(&This->guid, &GUID_SysMouse) || - IsEqualGUID(&This->guid, &GUID_SysKeyboard))) + if (flags & DISCL_EXCLUSIVE && flags & DISCL_BACKGROUND && + (IsEqualGUID( &This->guid, &GUID_SysMouse ) || IsEqualGUID( &This->guid, &GUID_SysKeyboard ))) return DIERR_UNSUPPORTED;
/* Store the window which asks for the mouse */ @@ -995,7 +995,7 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel( IDirectInput else { This->win = hwnd; - This->dwCoopLevel = dwflags; + This->dwCoopLevel = flags; hr = DI_OK; } LeaveCriticalSection(&This->crit); @@ -1029,7 +1029,7 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_SetEventNotification( IDirectInpu { IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
- TRACE("(%p) %p\n", This, event); + TRACE( "iface %p, event %p.\n", iface, event );
EnterCriticalSection(&This->crit); This->hEvent = event; @@ -1100,34 +1100,34 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_GetCapabilities( IDirectInputDevi }
static HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface( IDirectInputDevice8W *iface, - REFIID riid, LPVOID *ppobj ) + const GUID *iid, void **out ) { IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
- TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppobj); + TRACE( "iface %p, iid %s, out %p.\n", iface, debugstr_guid( iid ), out );
- if (IsEqualGUID(&IID_IDirectInputDeviceA, riid) || - IsEqualGUID(&IID_IDirectInputDevice2A, riid) || - IsEqualGUID(&IID_IDirectInputDevice7A, riid) || - IsEqualGUID(&IID_IDirectInputDevice8A, riid)) + if (IsEqualGUID( &IID_IDirectInputDeviceA, iid ) || + IsEqualGUID( &IID_IDirectInputDevice2A, iid ) || + IsEqualGUID( &IID_IDirectInputDevice7A, iid ) || + IsEqualGUID( &IID_IDirectInputDevice8A, iid )) { IDirectInputDevice2_AddRef(iface); - *ppobj = IDirectInputDevice8A_from_impl(This); + *out = IDirectInputDevice8A_from_impl( This ); return DI_OK; }
- if (IsEqualGUID(&IID_IUnknown, riid) || - IsEqualGUID(&IID_IDirectInputDeviceW, riid) || - IsEqualGUID(&IID_IDirectInputDevice2W, riid) || - IsEqualGUID(&IID_IDirectInputDevice7W, riid) || - IsEqualGUID(&IID_IDirectInputDevice8W, riid)) + if (IsEqualGUID( &IID_IUnknown, iid ) || + IsEqualGUID( &IID_IDirectInputDeviceW, iid ) || + IsEqualGUID( &IID_IDirectInputDevice2W, iid ) || + IsEqualGUID( &IID_IDirectInputDevice7W, iid ) || + IsEqualGUID( &IID_IDirectInputDevice8W, iid )) { IDirectInputDevice2_AddRef(iface); - *ppobj = IDirectInputDevice8W_from_impl(This); + *out = IDirectInputDevice8W_from_impl( This ); return DI_OK; }
- WARN("Unsupported interface!\n"); + WARN( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); return E_NOINTERFACE; }
@@ -1564,18 +1564,16 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceState( IDirectInputDevic return hr; }
-static HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData( IDirectInputDevice8W *iface, - DWORD dodsize, LPDIDEVICEOBJECTDATA dod, - LPDWORD entries, DWORD flags ) +static HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData( IDirectInputDevice8W *iface, DWORD size, + DIDEVICEOBJECTDATA *data, DWORD *count, DWORD flags ) { IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); HRESULT ret = DI_OK; int len;
- TRACE("(%p) %p -> %p(%d) x%d, 0x%08x\n", - This, dod, entries, entries ? *entries : 0, dodsize, flags); + TRACE( "iface %p, size %u, data %p, count %p, flags %#x.\n", iface, size, data, count, flags );
- if (This->dinput->dwVersion == 0x0800 || dodsize == sizeof(DIDEVICEOBJECTDATA_DX3)) + if (This->dinput->dwVersion == 0x0800 || size == sizeof(DIDEVICEOBJECTDATA_DX3)) { if (!This->queue_len) return DIERR_NOTBUFFERED; if (!This->acquired) return DIERR_NOTACQUIRED; @@ -1583,8 +1581,7 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData( IDirectInputDevice
if (!This->queue_len) return DI_OK; - if (dodsize < sizeof(DIDEVICEOBJECTDATA_DX3)) - return DIERR_INVALIDPARAM; + if (size < sizeof(DIDEVICEOBJECTDATA_DX3)) return DIERR_INVALIDPARAM;
IDirectInputDevice2_Poll(iface); EnterCriticalSection(&This->crit); @@ -1592,18 +1589,18 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData( IDirectInputDevice len = This->queue_head - This->queue_tail; if (len < 0) len += This->queue_len;
- if ((*entries != INFINITE) && (len > *entries)) len = *entries; + if ((*count != INFINITE) && (len > *count)) len = *count;
- if (dod) + if (data) { int i; for (i = 0; i < len; i++) { int n = (This->queue_tail + i) % This->queue_len; - memcpy((char *)dod + dodsize * i, This->data_queue + n, dodsize); + memcpy( (char *)data + size * i, This->data_queue + n, size ); } } - *entries = len; + *count = len;
if (This->overflow && This->dinput->dwVersion == 0x0800) ret = DI_BUFFEROVERFLOW; @@ -1617,24 +1614,21 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData( IDirectInputDevice
LeaveCriticalSection(&This->crit);
- TRACE("Returning %d events queued\n", *entries); + TRACE( "Returning %d events queued\n", *count ); return ret; }
-static HRESULT WINAPI IDirectInputDevice2WImpl_RunControlPanel( IDirectInputDevice8W *iface, - HWND hwndOwner, DWORD dwFlags ) +static HRESULT WINAPI IDirectInputDevice2WImpl_RunControlPanel( IDirectInputDevice8W *iface, HWND hwnd, DWORD flags ) { - IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); - FIXME("%p)->(%p,0x%08x): stub!\n", This, hwndOwner, dwFlags); - + FIXME( "iface %p, hwnd %p, flags %#x stub!\n", iface, hwnd, flags ); return DI_OK; }
-static HRESULT WINAPI IDirectInputDevice2WImpl_Initialize( IDirectInputDevice8W *iface, HINSTANCE hinst, - DWORD dwVersion, REFGUID rguid ) +static HRESULT WINAPI IDirectInputDevice2WImpl_Initialize( IDirectInputDevice8W *iface, HINSTANCE instance, + DWORD version, const GUID *guid ) { - IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); - FIXME("(%p)->(%p,%d,%s): stub!\n", This, hinst, dwVersion, debugstr_guid(rguid)); + FIXME( "iface %p, instance %p, version %#x, guid %s stub!\n", iface, instance, version, + debugstr_guid( guid ) ); return DI_OK; }
@@ -1809,10 +1803,9 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_EnumCreatedEffectObjects( IDirect return impl->vtbl->enum_created_effect_objects( iface, callback, context, flags ); }
-static HRESULT WINAPI IDirectInputDevice2WImpl_Escape( IDirectInputDevice8W *iface, LPDIEFFESCAPE lpDIEEsc ) +static HRESULT WINAPI IDirectInputDevice2WImpl_Escape( IDirectInputDevice8W *iface, DIEFFESCAPE *escape ) { - IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); - FIXME("(%p)->(%p): stub!\n", This, lpDIEEsc); + FIXME( "iface %p, escape %p stub!\n", iface, escape ); return DI_OK; }
@@ -1830,33 +1823,30 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_Poll( IDirectInputDevice8W *iface return DI_OK; }
-static HRESULT WINAPI IDirectInputDevice2WImpl_SendDeviceData( IDirectInputDevice8W *iface, DWORD cbObjectData, - LPCDIDEVICEOBJECTDATA rgdod, - LPDWORD pdwInOut, DWORD dwFlags ) +static HRESULT WINAPI IDirectInputDevice2WImpl_SendDeviceData( IDirectInputDevice8W *iface, DWORD size, + const DIDEVICEOBJECTDATA *data, + DWORD *count, DWORD flags ) { - IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); - FIXME("(%p)->(0x%08x,%p,%p,0x%08x): stub!\n", This, cbObjectData, rgdod, pdwInOut, dwFlags); - + FIXME( "iface %p, size %u, data %p, count %p, flags %#x stub!\n", iface, size, data, count, flags ); return DI_OK; }
-static HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile( IDirectInputDevice8W *iface, LPCWSTR lpszFileName, - LPDIENUMEFFECTSINFILECALLBACK pec, - LPVOID pvRef, DWORD dwFlags ) +static HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile( IDirectInputDevice8W *iface, + const WCHAR *filename, + LPDIENUMEFFECTSINFILECALLBACK callback, + void *context, DWORD flags ) { - IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); - FIXME("(%p)->(%s,%p,%p,%08x): stub !\n", This, debugstr_w(lpszFileName), pec, pvRef, dwFlags); - + FIXME( "iface %p, filename %s, callback %p, context %p, flags %#x stub!\n", iface, + debugstr_w(filename), callback, context, flags ); return DI_OK; }
static HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile( IDirectInputDevice8W *iface, - LPCWSTR lpszFileName, DWORD dwEntries, - LPDIFILEEFFECT rgDiFileEft, DWORD dwFlags ) + const WCHAR *filename, DWORD count, + DIFILEEFFECT *effects, DWORD flags ) { - IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); - FIXME("(%p)->(%s,%08x,%p,%08x): stub !\n", This, debugstr_w(lpszFileName), dwEntries, rgDiFileEft, dwFlags); - + FIXME( "iface %p, filename %s, count %u, effects %p, flags %#x stub!\n", iface, + debugstr_w(filename), count, effects, flags ); return DI_OK; }
@@ -2072,11 +2062,9 @@ static HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap( IDirectInputDevice8 }
static HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo( IDirectInputDevice8W *iface, - LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader ) + DIDEVICEIMAGEINFOHEADERW *header ) { - IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); - FIXME("(%p)->(%p): stub !\n", This, lpdiDevImageInfoHeader); - + FIXME( "iface %p, header %p stub!\n", iface, header ); return DI_OK; }
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/ansi.c | 72 +++++----- dlls/dinput/device.c | 258 +++++++++++++++++------------------ dlls/dinput/device_private.h | 11 +- dlls/dinput/dinput_main.c | 124 ++++++++--------- dlls/dinput/dinput_private.h | 6 +- dlls/dinput/joystick_hid.c | 12 +- dlls/dinput/keyboard.c | 10 +- dlls/dinput/mouse.c | 9 +- 8 files changed, 244 insertions(+), 258 deletions(-)
diff --git a/dlls/dinput/ansi.c b/dlls/dinput/ansi.c index 3d2d82b0f36..3c7b6ced169 100644 --- a/dlls/dinput/ansi.c +++ b/dlls/dinput/ansi.c @@ -33,12 +33,12 @@
#include "wine/debug.h"
-static IDirectInputDeviceImpl *impl_from_IDirectInputDevice8A( IDirectInputDevice8A *iface ) +static struct dinput_device *impl_from_IDirectInputDevice8A( IDirectInputDevice8A *iface ) { - return CONTAINING_RECORD( iface, IDirectInputDeviceImpl, IDirectInputDevice8A_iface ); + return CONTAINING_RECORD( iface, struct dinput_device, IDirectInputDevice8A_iface ); }
-static IDirectInputDevice8W *IDirectInputDevice8W_from_impl( IDirectInputDeviceImpl *impl ) +static IDirectInputDevice8W *IDirectInputDevice8W_from_impl( struct dinput_device *impl ) { return &impl->IDirectInputDevice8W_iface; } @@ -46,7 +46,7 @@ static IDirectInputDevice8W *IDirectInputDevice8W_from_impl( IDirectInputDeviceI static inline IDirectInputDevice8A *IDirectInputDevice8A_from_IDirectInputDevice8W( IDirectInputDevice8W *iface ) { if (!iface) return NULL; - return &CONTAINING_RECORD( iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface )->IDirectInputDevice8A_iface; + return &CONTAINING_RECORD( iface, struct dinput_device, IDirectInputDevice8W_iface )->IDirectInputDevice8A_iface; }
static inline IDirectInputDeviceA *IDirectInputDeviceA_from_IDirectInputDeviceW( IDirectInputDeviceW *iface ) @@ -269,28 +269,28 @@ static HRESULT diconfiguredevicesparams_atow( const DICONFIGUREDEVICESPARAMSA *i
static HRESULT WINAPI dinput_device_a_QueryInterface( IDirectInputDevice8A *iface_a, REFIID iid, void **out ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_QueryInterface( iface_w, iid, out ); }
static ULONG WINAPI dinput_device_a_AddRef( IDirectInputDevice8A *iface_a ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_AddRef( iface_w ); }
static ULONG WINAPI dinput_device_a_Release( IDirectInputDevice8A *iface_a ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_Release( iface_w ); }
static HRESULT WINAPI dinput_device_a_GetCapabilities( IDirectInputDevice8A *iface_a, DIDEVCAPS *caps ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_GetCapabilities( iface_w, caps ); } @@ -314,7 +314,7 @@ static HRESULT WINAPI dinput_device_a_EnumObjects( IDirectInputDevice8A *iface_a void *ref, DWORD flags ) { struct enum_objects_wtoa_params params = {callback, ref}; - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl );
if (!callback) return DIERR_INVALIDPARAM; @@ -324,35 +324,35 @@ static HRESULT WINAPI dinput_device_a_EnumObjects( IDirectInputDevice8A *iface_a
static HRESULT WINAPI dinput_device_a_GetProperty( IDirectInputDevice8A *iface_a, REFGUID guid, DIPROPHEADER *header ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_GetProperty( iface_w, guid, header ); }
static HRESULT WINAPI dinput_device_a_SetProperty( IDirectInputDevice8A *iface_a, REFGUID guid, const DIPROPHEADER *header ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_SetProperty( iface_w, guid, header ); }
static HRESULT WINAPI dinput_device_a_Acquire( IDirectInputDevice8A *iface_a ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_Acquire( iface_w ); }
static HRESULT WINAPI dinput_device_a_Unacquire( IDirectInputDevice8A *iface_a ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_Unacquire( iface_w ); }
static HRESULT WINAPI dinput_device_a_GetDeviceState( IDirectInputDevice8A *iface_a, DWORD count, void *data ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_GetDeviceState( iface_w, count, data ); } @@ -360,28 +360,28 @@ static HRESULT WINAPI dinput_device_a_GetDeviceState( IDirectInputDevice8A *ifac static HRESULT WINAPI dinput_device_a_GetDeviceData( IDirectInputDevice8A *iface_a, DWORD data_size, DIDEVICEOBJECTDATA *data, DWORD *entries, DWORD flags ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_GetDeviceData( iface_w, data_size, data, entries, flags ); }
static HRESULT WINAPI dinput_device_a_SetDataFormat( IDirectInputDevice8A *iface_a, const DIDATAFORMAT *format ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_SetDataFormat( iface_w, format ); }
static HRESULT WINAPI dinput_device_a_SetEventNotification( IDirectInputDevice8A *iface_a, HANDLE event ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_SetEventNotification( iface_w, event ); }
static HRESULT WINAPI dinput_device_a_SetCooperativeLevel( IDirectInputDevice8A *iface_a, HWND window, DWORD flags ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_SetCooperativeLevel( iface_w, window, flags ); } @@ -389,7 +389,7 @@ static HRESULT WINAPI dinput_device_a_SetCooperativeLevel( IDirectInputDevice8A static HRESULT WINAPI dinput_device_a_GetObjectInfo( IDirectInputDevice8A *iface_a, DIDEVICEOBJECTINSTANCEA *instance_a, DWORD obj, DWORD how ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); DIDEVICEOBJECTINSTANCEW instance_w = {sizeof(instance_w)}; HRESULT hr; @@ -407,7 +407,7 @@ static HRESULT WINAPI dinput_device_a_GetObjectInfo( IDirectInputDevice8A *iface
static HRESULT WINAPI dinput_device_a_GetDeviceInfo( IDirectInputDevice8A *iface_a, DIDEVICEINSTANCEA *instance_a ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); DIDEVICEINSTANCEW instance_w = {sizeof(instance_w)}; HRESULT hr; @@ -424,14 +424,14 @@ static HRESULT WINAPI dinput_device_a_GetDeviceInfo( IDirectInputDevice8A *iface
static HRESULT WINAPI dinput_device_a_RunControlPanel( IDirectInputDevice8A *iface_a, HWND owner, DWORD flags ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_RunControlPanel( iface_w, owner, flags ); }
static HRESULT WINAPI dinput_device_a_Initialize( IDirectInputDevice8A *iface_a, HINSTANCE instance, DWORD version, REFGUID guid ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_Initialize( iface_w, instance, version, guid ); } @@ -439,7 +439,7 @@ static HRESULT WINAPI dinput_device_a_Initialize( IDirectInputDevice8A *iface_a, static HRESULT WINAPI dinput_device_a_CreateEffect( IDirectInputDevice8A *iface_a, REFGUID guid, const DIEFFECT *effect, IDirectInputEffect **out, IUnknown *outer ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_CreateEffect( iface_w, guid, effect, out, outer ); } @@ -463,7 +463,7 @@ static HRESULT WINAPI dinput_device_a_EnumEffects( IDirectInputDevice8A *iface_a void *ref, DWORD type ) { struct enum_effects_wtoa_params params = {callback, ref}; - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl );
if (!callback) return DIERR_INVALIDPARAM; @@ -473,7 +473,7 @@ static HRESULT WINAPI dinput_device_a_EnumEffects( IDirectInputDevice8A *iface_a
static HRESULT WINAPI dinput_device_a_GetEffectInfo( IDirectInputDevice8A *iface_a, DIEFFECTINFOA *info_a, REFGUID guid ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); DIEFFECTINFOW info_w = {sizeof(info_w)}; HRESULT hr; @@ -489,14 +489,14 @@ static HRESULT WINAPI dinput_device_a_GetEffectInfo( IDirectInputDevice8A *iface
static HRESULT WINAPI dinput_device_a_GetForceFeedbackState( IDirectInputDevice8A *iface_a, DWORD *state ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_GetForceFeedbackState( iface_w, state ); }
static HRESULT WINAPI dinput_device_a_SendForceFeedbackCommand( IDirectInputDevice8A *iface_a, DWORD flags ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_SendForceFeedbackCommand( iface_w, flags ); } @@ -504,21 +504,21 @@ static HRESULT WINAPI dinput_device_a_SendForceFeedbackCommand( IDirectInputDevi static HRESULT WINAPI dinput_device_a_EnumCreatedEffectObjects( IDirectInputDevice8A *iface_a, LPDIENUMCREATEDEFFECTOBJECTSCALLBACK callback, void *ref, DWORD flags ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_EnumCreatedEffectObjects( iface_w, callback, ref, flags ); }
static HRESULT WINAPI dinput_device_a_Escape( IDirectInputDevice8A *iface_a, DIEFFESCAPE *escape ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_Escape( iface_w, escape ); }
static HRESULT WINAPI dinput_device_a_Poll( IDirectInputDevice8A *iface_a ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_Poll( iface_w ); } @@ -526,7 +526,7 @@ static HRESULT WINAPI dinput_device_a_Poll( IDirectInputDevice8A *iface_a ) static HRESULT WINAPI dinput_device_a_SendDeviceData( IDirectInputDevice8A *iface_a, DWORD count, const DIDEVICEOBJECTDATA *data, DWORD *inout, DWORD flags ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); return IDirectInputDevice8_SendDeviceData( iface_w, count, data, inout, flags ); } @@ -534,7 +534,7 @@ static HRESULT WINAPI dinput_device_a_SendDeviceData( IDirectInputDevice8A *ifac static HRESULT WINAPI dinput_device_a_EnumEffectsInFile( IDirectInputDevice8A *iface_a, const char *filename_a, LPDIENUMEFFECTSINFILECALLBACK callback, void *ref, DWORD flags ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); WCHAR buffer[MAX_PATH], *filename_w = buffer;
@@ -547,7 +547,7 @@ static HRESULT WINAPI dinput_device_a_EnumEffectsInFile( IDirectInputDevice8A *i static HRESULT WINAPI dinput_device_a_WriteEffectToFile( IDirectInputDevice8A *iface_a, const char *filename_a, DWORD entries, DIFILEEFFECT *file_effect, DWORD flags ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); WCHAR buffer[MAX_PATH], *filename_w = buffer;
@@ -560,7 +560,7 @@ static HRESULT WINAPI dinput_device_a_WriteEffectToFile( IDirectInputDevice8A *i static HRESULT WINAPI dinput_device_a_BuildActionMap( IDirectInputDevice8A *iface_a, DIACTIONFORMATA *format_a, const char *username_a, DWORD flags ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); DIACTIONFORMATW format_w = {sizeof(format_w), sizeof(DIACTIONW)}; HRESULT hr; @@ -589,7 +589,7 @@ static HRESULT WINAPI dinput_device_a_BuildActionMap( IDirectInputDevice8A *ifac static HRESULT WINAPI dinput_device_a_SetActionMap( IDirectInputDevice8A *iface_a, DIACTIONFORMATA *format_a, const char *username_a, DWORD flags ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); DIACTIONFORMATW format_w = {sizeof(format_w), sizeof(DIACTIONW)}; HRESULT hr; @@ -617,7 +617,7 @@ static HRESULT WINAPI dinput_device_a_SetActionMap( IDirectInputDevice8A *iface_
static HRESULT WINAPI dinput_device_a_GetImageInfo( IDirectInputDevice8A *iface_a, DIDEVICEIMAGEINFOHEADERA *header_a ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8A( iface_a ); + struct dinput_device *impl = impl_from_IDirectInputDevice8A( iface_a ); IDirectInputDevice8W *iface_w = IDirectInputDevice8W_from_impl( impl ); DIDEVICEIMAGEINFOHEADERW header_w = {sizeof(header_w), sizeof(DIDEVICEIMAGEINFOW)}; HRESULT hr; diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c index 679f907f2de..040a97eb06b 100644 --- a/dlls/dinput/device.c +++ b/dlls/dinput/device.c @@ -53,16 +53,16 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput); */ DEFINE_GUID( dinput_pidvid_guid, 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 'P', 'I', 'D', 'V', 'I', 'D' );
-static inline IDirectInputDeviceImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface) +static inline struct dinput_device *impl_from_IDirectInputDevice8W( IDirectInputDevice8W *iface ) { - return CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface); + return CONTAINING_RECORD( iface, struct dinput_device, IDirectInputDevice8W_iface ); }
-static inline IDirectInputDevice8A *IDirectInputDevice8A_from_impl(IDirectInputDeviceImpl *This) +static inline IDirectInputDevice8A *IDirectInputDevice8A_from_impl( struct dinput_device *This ) { return &This->IDirectInputDevice8A_iface; } -static inline IDirectInputDevice8W *IDirectInputDevice8W_from_impl(IDirectInputDeviceImpl *This) +static inline IDirectInputDevice8W *IDirectInputDevice8W_from_impl( struct dinput_device *This ) { return &This->IDirectInputDevice8W_iface; } @@ -636,7 +636,7 @@ static int id_to_offset(const DataFormat *df, int id) return obj >= 0 && df->offsets ? df->offsets[obj] : -1; }
-static DWORD semantic_to_obj_id(IDirectInputDeviceImpl* This, DWORD dwSemantic) +static DWORD semantic_to_obj_id( struct dinput_device *This, DWORD dwSemantic ) { DWORD type = (0x0000ff00 & dwSemantic) >> 8; BOOL byofs = (dwSemantic & 0x80000000) != 0; @@ -730,7 +730,7 @@ static HRESULT save_mapping_settings(IDirectInputDevice8W *iface, LPDIACTIONFORM return DI_OK; }
-static BOOL load_mapping_settings(IDirectInputDeviceImpl *This, LPDIACTIONFORMATW lpdiaf, const WCHAR *username) +static BOOL load_mapping_settings( struct dinput_device *This, LPDIACTIONFORMATW lpdiaf, const WCHAR *username ) { HKEY hkey; WCHAR *guid_str; @@ -774,7 +774,7 @@ static BOOL load_mapping_settings(IDirectInputDeviceImpl *This, LPDIACTIONFORMAT return mapped > 0; }
-static BOOL set_app_data(IDirectInputDeviceImpl *dev, int offset, UINT_PTR app_data) +static BOOL set_app_data( struct dinput_device *dev, int offset, UINT_PTR app_data ) { int num_actions = dev->num_actions; ActionMap *action_map = dev->action_map, *target_map = NULL; @@ -821,7 +821,7 @@ static BOOL set_app_data(IDirectInputDeviceImpl *dev, int offset, UINT_PTR app_d void queue_event( IDirectInputDevice8W *iface, int inst_id, DWORD data, DWORD time, DWORD seq ) { static ULONGLONG notify_ms = 0; - IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *This = impl_from_IDirectInputDevice8W( iface ); int next_pos, ofs = id_to_offset(&This->data_format, inst_id); ULONGLONG time_ms = GetTickCount64();
@@ -873,9 +873,9 @@ void queue_event( IDirectInputDevice8W *iface, int inst_id, DWORD data, DWORD ti * Acquire */
-static HRESULT WINAPI IDirectInputDevice2WImpl_Acquire( IDirectInputDevice8W *iface ) +static HRESULT WINAPI dinput_device_Acquire( IDirectInputDevice8W *iface ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); HRESULT hr = DI_OK;
TRACE( "iface %p.\n", iface ); @@ -905,9 +905,9 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_Acquire( IDirectInputDevice8W *if * Unacquire */
-static HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire( IDirectInputDevice8W *iface ) +static HRESULT WINAPI dinput_device_Unacquire( IDirectInputDevice8W *iface ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); HRESULT hr = DI_OK;
TRACE( "iface %p.\n", iface ); @@ -929,9 +929,9 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_Unacquire( IDirectInputDevice8W * * IDirectInputDeviceA */
-static HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat( IDirectInputDevice8W *iface, const DIDATAFORMAT *format ) +static HRESULT WINAPI dinput_device_SetDataFormat( IDirectInputDevice8W *iface, const DIDATAFORMAT *format ) { - IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); + struct dinput_device *This = impl_from_IDirectInputDevice8W( iface ); HRESULT res = DI_OK;
TRACE( "iface %p, format %p.\n", iface, format ); @@ -961,10 +961,9 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat( IDirectInputDevice * * Set cooperative level and the source window for the events. */ -static HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel( IDirectInputDevice8W *iface, - HWND hwnd, DWORD flags ) +static HRESULT WINAPI dinput_device_SetCooperativeLevel( IDirectInputDevice8W *iface, HWND hwnd, DWORD flags ) { - IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); + struct dinput_device *This = impl_from_IDirectInputDevice8W( iface ); HRESULT hr;
TRACE( "iface %p, hwnd %p, flags %#x.\n", iface, hwnd, flags ); @@ -1003,9 +1002,9 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel( IDirectInput return hr; }
-static HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceInfo( IDirectInputDevice8W *iface, DIDEVICEINSTANCEW *instance ) +static HRESULT WINAPI dinput_device_GetDeviceInfo( IDirectInputDevice8W *iface, DIDEVICEINSTANCEW *instance ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); DWORD size;
TRACE( "iface %p, instance %p.\n", iface, instance ); @@ -1025,9 +1024,9 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceInfo( IDirectInputDevice /****************************************************************************** * SetEventNotification : specifies event to be sent on state change */ -static HRESULT WINAPI IDirectInputDevice2WImpl_SetEventNotification( IDirectInputDevice8W *iface, HANDLE event ) +static HRESULT WINAPI dinput_device_SetEventNotification( IDirectInputDevice8W *iface, HANDLE event ) { - IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); + struct dinput_device *This = impl_from_IDirectInputDevice8W( iface );
TRACE( "iface %p, event %p.\n", iface, event );
@@ -1037,9 +1036,9 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_SetEventNotification( IDirectInpu return DI_OK; }
-void direct_input_device_destroy( IDirectInputDevice8W *iface ) +void dinput_device_destroy( IDirectInputDevice8W *iface ) { - IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); + struct dinput_device *This = impl_from_IDirectInputDevice8W( iface );
TRACE( "iface %p.\n", iface );
@@ -1064,9 +1063,9 @@ void direct_input_device_destroy( IDirectInputDevice8W *iface ) free( This ); }
-static ULONG WINAPI IDirectInputDevice2WImpl_Release( IDirectInputDevice8W *iface ) +static ULONG WINAPI dinput_device_Release( IDirectInputDevice8W *iface ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); ULONG ref = InterlockedDecrement( &impl->ref );
TRACE( "iface %p, ref %u.\n", iface, ref ); @@ -1074,15 +1073,15 @@ static ULONG WINAPI IDirectInputDevice2WImpl_Release( IDirectInputDevice8W *ifac if (!ref) { if (impl->vtbl->release) impl->vtbl->release( iface ); - else direct_input_device_destroy( iface ); + else dinput_device_destroy( iface ); }
return ref; }
-static HRESULT WINAPI IDirectInputDevice2WImpl_GetCapabilities( IDirectInputDevice8W *iface, DIDEVCAPS *caps ) +static HRESULT WINAPI dinput_device_GetCapabilities( IDirectInputDevice8W *iface, DIDEVCAPS *caps ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); DWORD size;
TRACE( "iface %p, caps %p.\n", iface, caps ); @@ -1099,10 +1098,9 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_GetCapabilities( IDirectInputDevi return DI_OK; }
-static HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface( IDirectInputDevice8W *iface, - const GUID *iid, void **out ) +static HRESULT WINAPI dinput_device_QueryInterface( IDirectInputDevice8W *iface, const GUID *iid, void **out ) { - IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); + struct dinput_device *This = impl_from_IDirectInputDevice8W( iface );
TRACE( "iface %p, iid %s, out %p.\n", iface, debugstr_guid( iid ), out );
@@ -1131,17 +1129,17 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_QueryInterface( IDirectInputDevic return E_NOINTERFACE; }
-static ULONG WINAPI IDirectInputDevice2WImpl_AddRef( IDirectInputDevice8W *iface ) +static ULONG WINAPI dinput_device_AddRef( IDirectInputDevice8W *iface ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); ULONG ref = InterlockedIncrement( &impl->ref ); TRACE( "iface %p, ref %u.\n", iface, ref ); return ref; }
-static HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects( IDirectInputDevice8W *iface, - LPDIENUMDEVICEOBJECTSCALLBACKW callback, - void *context, DWORD flags ) +static HRESULT WINAPI dinput_device_EnumObjects( IDirectInputDevice8W *iface, + LPDIENUMDEVICEOBJECTSCALLBACKW callback, + void *context, DWORD flags ) { static const DIPROPHEADER filter = { @@ -1149,7 +1147,7 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects( IDirectInputDevice8W .dwHeaderSize = sizeof(filter), .dwHow = DIPH_DEVICE, }; - struct IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); HRESULT hr;
TRACE( "iface %p, callback %p, context %p, flags %#x.\n", iface, callback, context, flags ); @@ -1186,7 +1184,7 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_EnumObjects( IDirectInputDevice8W return DI_OK; }
-static HRESULT enum_object_filter_init( IDirectInputDeviceImpl *impl, DIPROPHEADER *filter ) +static HRESULT enum_object_filter_init( struct dinput_device *impl, DIPROPHEADER *filter ) { DIDATAFORMAT *format = impl->data_format.wine_df; int i, *offsets = impl->data_format.offsets; @@ -1210,10 +1208,9 @@ static BOOL CALLBACK find_object( const DIDEVICEOBJECTINSTANCEW *instance, void return DIENUM_STOP; }
-static HRESULT WINAPI IDirectInputDevice2WImpl_GetProperty( IDirectInputDevice8W *iface, - const GUID *guid, DIPROPHEADER *header ) +static HRESULT WINAPI dinput_device_GetProperty( IDirectInputDevice8W *iface, const GUID *guid, DIPROPHEADER *header ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); DWORD object_mask = DIDFT_AXIS | DIDFT_BUTTON | DIDFT_POV; DIDEVICEOBJECTINSTANCEW instance; DIPROPHEADER filter; @@ -1329,16 +1326,16 @@ struct set_object_property_params static BOOL CALLBACK set_object_property( const DIDEVICEOBJECTINSTANCEW *instance, void *context ) { struct set_object_property_params *params = context; - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( params->iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( params->iface ); impl->vtbl->set_property( params->iface, params->property, params->header, instance ); return DIENUM_CONTINUE; }
-static HRESULT WINAPI IDirectInputDevice2WImpl_SetProperty( IDirectInputDevice8W *iface, - const GUID *guid, const DIPROPHEADER *header ) +static HRESULT WINAPI dinput_device_SetProperty( IDirectInputDevice8W *iface, const GUID *guid, + const DIPROPHEADER *header ) { struct set_object_property_params params = {.iface = iface, .header = header, .property = LOWORD( guid )}; - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); DIPROPHEADER filter; HRESULT hr;
@@ -1462,7 +1459,7 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_SetProperty( IDirectInputDevice8W return DI_OK; }
-static void dinput_device_set_username( IDirectInputDeviceImpl *impl, const DIPROPSTRING *value ) +static void dinput_device_set_username( struct dinput_device *impl, const DIPROPSTRING *value ) { struct DevicePlayer *device_player; BOOL found = FALSE; @@ -1495,11 +1492,10 @@ static BOOL CALLBACK get_object_info( const DIDEVICEOBJECTINSTANCEW *instance, v return DIENUM_STOP; }
-static HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo( IDirectInputDevice8W *iface, - DIDEVICEOBJECTINSTANCEW *instance, - DWORD obj, DWORD how ) +static HRESULT WINAPI dinput_device_GetObjectInfo( IDirectInputDevice8W *iface, + DIDEVICEOBJECTINSTANCEW *instance, DWORD obj, DWORD how ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); DIPROPHEADER filter = { .dwSize = sizeof(filter), @@ -1529,9 +1525,9 @@ static BOOL CALLBACK reset_axis_data( const DIDEVICEOBJECTINSTANCEW *instance, v return DIENUM_CONTINUE; }
-static HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceState( IDirectInputDevice8W *iface, DWORD size, void *data ) +static HRESULT WINAPI dinput_device_GetDeviceState( IDirectInputDevice8W *iface, DWORD size, void *data ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); DIPROPHEADER filter = { .dwSize = sizeof(filter), @@ -1564,10 +1560,10 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceState( IDirectInputDevic return hr; }
-static HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData( IDirectInputDevice8W *iface, DWORD size, - DIDEVICEOBJECTDATA *data, DWORD *count, DWORD flags ) +static HRESULT WINAPI dinput_device_GetDeviceData( IDirectInputDevice8W *iface, DWORD size, DIDEVICEOBJECTDATA *data, + DWORD *count, DWORD flags ) { - IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface); + struct dinput_device *This = impl_from_IDirectInputDevice8W( iface ); HRESULT ret = DI_OK; int len;
@@ -1618,25 +1614,25 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_GetDeviceData( IDirectInputDevice return ret; }
-static HRESULT WINAPI IDirectInputDevice2WImpl_RunControlPanel( IDirectInputDevice8W *iface, HWND hwnd, DWORD flags ) +static HRESULT WINAPI dinput_device_RunControlPanel( IDirectInputDevice8W *iface, HWND hwnd, DWORD flags ) { FIXME( "iface %p, hwnd %p, flags %#x stub!\n", iface, hwnd, flags ); return DI_OK; }
-static HRESULT WINAPI IDirectInputDevice2WImpl_Initialize( IDirectInputDevice8W *iface, HINSTANCE instance, - DWORD version, const GUID *guid ) +static HRESULT WINAPI dinput_device_Initialize( IDirectInputDevice8W *iface, HINSTANCE instance, + DWORD version, const GUID *guid ) { FIXME( "iface %p, instance %p, version %#x, guid %s stub!\n", iface, instance, version, debugstr_guid( guid ) ); return DI_OK; }
-static HRESULT WINAPI IDirectInputDevice2WImpl_CreateEffect( IDirectInputDevice8W *iface, - const GUID *guid, const DIEFFECT *params, - IDirectInputEffect **out, IUnknown *outer ) +static HRESULT WINAPI dinput_device_CreateEffect( IDirectInputDevice8W *iface, const GUID *guid, + const DIEFFECT *params, IDirectInputEffect **out, + IUnknown *outer ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); DWORD flags = DIEP_ALLPARAMS; HRESULT hr;
@@ -1665,9 +1661,8 @@ failed: return hr; }
-static HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects( IDirectInputDevice8W *iface, - LPDIENUMEFFECTSCALLBACKW callback, - void *context, DWORD type ) +static HRESULT WINAPI dinput_device_EnumEffects( IDirectInputDevice8W *iface, LPDIENUMEFFECTSCALLBACKW callback, + void *context, DWORD type ) { DIEFFECTINFOW info = {.dwSize = sizeof(info)}; HRESULT hr; @@ -1737,10 +1732,10 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_EnumEffects( IDirectInputDevice8W return DI_OK; }
-static HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo( IDirectInputDevice8W *iface, - DIEFFECTINFOW *info, const GUID *guid ) +static HRESULT WINAPI dinput_device_GetEffectInfo( IDirectInputDevice8W *iface, DIEFFECTINFOW *info, + const GUID *guid ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface );
TRACE( "iface %p, info %p, guid %s.\n", iface, info, debugstr_guid( guid ) );
@@ -1751,16 +1746,16 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_GetEffectInfo( IDirectInputDevice return impl->vtbl->get_effect_info( iface, info, guid ); }
-static HRESULT WINAPI IDirectInputDevice2WImpl_GetForceFeedbackState( IDirectInputDevice8W *iface, DWORD *out ) +static HRESULT WINAPI dinput_device_GetForceFeedbackState( IDirectInputDevice8W *iface, DWORD *out ) { FIXME( "iface %p, out %p stub!\n", iface, out ); if (!out) return E_POINTER; return DIERR_UNSUPPORTED; }
-static HRESULT WINAPI IDirectInputDevice2WImpl_SendForceFeedbackCommand( IDirectInputDevice8W *iface, DWORD command ) +static HRESULT WINAPI dinput_device_SendForceFeedbackCommand( IDirectInputDevice8W *iface, DWORD command ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); HRESULT hr;
TRACE( "iface %p, flags %x.\n", iface, command ); @@ -1787,11 +1782,11 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_SendForceFeedbackCommand( IDirect return hr; }
-static HRESULT WINAPI IDirectInputDevice2WImpl_EnumCreatedEffectObjects( IDirectInputDevice8W *iface, - LPDIENUMCREATEDEFFECTOBJECTSCALLBACK callback, - void *context, DWORD flags ) +static HRESULT WINAPI dinput_device_EnumCreatedEffectObjects( IDirectInputDevice8W *iface, + LPDIENUMCREATEDEFFECTOBJECTSCALLBACK callback, + void *context, DWORD flags ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface );
TRACE( "iface %p, callback %p, context %p, flags %#x.\n", iface, callback, context, flags );
@@ -1803,15 +1798,15 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_EnumCreatedEffectObjects( IDirect return impl->vtbl->enum_created_effect_objects( iface, callback, context, flags ); }
-static HRESULT WINAPI IDirectInputDevice2WImpl_Escape( IDirectInputDevice8W *iface, DIEFFESCAPE *escape ) +static HRESULT WINAPI dinput_device_Escape( IDirectInputDevice8W *iface, DIEFFESCAPE *escape ) { FIXME( "iface %p, escape %p stub!\n", iface, escape ); return DI_OK; }
-static HRESULT WINAPI IDirectInputDevice2WImpl_Poll( IDirectInputDevice8W *iface ) +static HRESULT WINAPI dinput_device_Poll( IDirectInputDevice8W *iface ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); HRESULT hr = DI_NOEFFECT;
EnterCriticalSection( &impl->crit ); @@ -1823,38 +1818,34 @@ static HRESULT WINAPI IDirectInputDevice2WImpl_Poll( IDirectInputDevice8W *iface return DI_OK; }
-static HRESULT WINAPI IDirectInputDevice2WImpl_SendDeviceData( IDirectInputDevice8W *iface, DWORD size, - const DIDEVICEOBJECTDATA *data, - DWORD *count, DWORD flags ) +static HRESULT WINAPI dinput_device_SendDeviceData( IDirectInputDevice8W *iface, DWORD size, + const DIDEVICEOBJECTDATA *data, DWORD *count, DWORD flags ) { FIXME( "iface %p, size %u, data %p, count %p, flags %#x stub!\n", iface, size, data, count, flags ); return DI_OK; }
-static HRESULT WINAPI IDirectInputDevice7WImpl_EnumEffectsInFile( IDirectInputDevice8W *iface, - const WCHAR *filename, - LPDIENUMEFFECTSINFILECALLBACK callback, - void *context, DWORD flags ) +static HRESULT WINAPI dinput_device_EnumEffectsInFile( IDirectInputDevice8W *iface, const WCHAR *filename, + LPDIENUMEFFECTSINFILECALLBACK callback, + void *context, DWORD flags ) { FIXME( "iface %p, filename %s, callback %p, context %p, flags %#x stub!\n", iface, debugstr_w(filename), callback, context, flags ); return DI_OK; }
-static HRESULT WINAPI IDirectInputDevice7WImpl_WriteEffectToFile( IDirectInputDevice8W *iface, - const WCHAR *filename, DWORD count, - DIFILEEFFECT *effects, DWORD flags ) +static HRESULT WINAPI dinput_device_WriteEffectToFile( IDirectInputDevice8W *iface, const WCHAR *filename, + DWORD count, DIFILEEFFECT *effects, DWORD flags ) { FIXME( "iface %p, filename %s, count %u, effects %p, flags %#x stub!\n", iface, debugstr_w(filename), count, effects, flags ); return DI_OK; }
-static HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap( IDirectInputDevice8W *iface, - DIACTIONFORMATW *format, - const WCHAR *username, DWORD flags ) +static HRESULT WINAPI dinput_device_BuildActionMap( IDirectInputDevice8W *iface, DIACTIONFORMATW *format, + const WCHAR *username, DWORD flags ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); BOOL load_success = FALSE, has_actions = FALSE; DWORD genre, username_len = MAX_PATH; WCHAR username_buf[MAX_PATH]; @@ -1938,10 +1929,10 @@ static HRESULT WINAPI IDirectInputDevice8WImpl_BuildActionMap( IDirectInputDevic return DI_OK; }
-static HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap( IDirectInputDevice8W *iface, DIACTIONFORMATW *format, - const WCHAR *username, DWORD flags ) +static HRESULT WINAPI dinput_device_SetActionMap( IDirectInputDevice8W *iface, DIACTIONFORMATW *format, + const WCHAR *username, DWORD flags ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); DIDATAFORMAT data_format; DIOBJECTDATAFORMAT *obj_df = NULL; DIPROPDWORD dp; @@ -2061,8 +2052,7 @@ static HRESULT WINAPI IDirectInputDevice8WImpl_SetActionMap( IDirectInputDevice8 return DI_OK; }
-static HRESULT WINAPI IDirectInputDevice8WImpl_GetImageInfo( IDirectInputDevice8W *iface, - DIDEVICEIMAGEINFOHEADERW *header ) +static HRESULT WINAPI dinput_device_GetImageInfo( IDirectInputDevice8W *iface, DIDEVICEIMAGEINFOHEADERW *header ) { FIXME( "iface %p, header %p stub!\n", iface, header ); return DI_OK; @@ -2072,48 +2062,48 @@ extern const IDirectInputDevice8AVtbl dinput_device_a_vtbl; static const IDirectInputDevice8WVtbl dinput_device_w_vtbl = { /*** IUnknown methods ***/ - IDirectInputDevice2WImpl_QueryInterface, - IDirectInputDevice2WImpl_AddRef, - IDirectInputDevice2WImpl_Release, + dinput_device_QueryInterface, + dinput_device_AddRef, + dinput_device_Release, /*** IDirectInputDevice methods ***/ - IDirectInputDevice2WImpl_GetCapabilities, - IDirectInputDevice2WImpl_EnumObjects, - IDirectInputDevice2WImpl_GetProperty, - IDirectInputDevice2WImpl_SetProperty, - IDirectInputDevice2WImpl_Acquire, - IDirectInputDevice2WImpl_Unacquire, - IDirectInputDevice2WImpl_GetDeviceState, - IDirectInputDevice2WImpl_GetDeviceData, - IDirectInputDevice2WImpl_SetDataFormat, - IDirectInputDevice2WImpl_SetEventNotification, - IDirectInputDevice2WImpl_SetCooperativeLevel, - IDirectInputDevice2WImpl_GetObjectInfo, - IDirectInputDevice2WImpl_GetDeviceInfo, - IDirectInputDevice2WImpl_RunControlPanel, - IDirectInputDevice2WImpl_Initialize, + dinput_device_GetCapabilities, + dinput_device_EnumObjects, + dinput_device_GetProperty, + dinput_device_SetProperty, + dinput_device_Acquire, + dinput_device_Unacquire, + dinput_device_GetDeviceState, + dinput_device_GetDeviceData, + dinput_device_SetDataFormat, + dinput_device_SetEventNotification, + dinput_device_SetCooperativeLevel, + dinput_device_GetObjectInfo, + dinput_device_GetDeviceInfo, + dinput_device_RunControlPanel, + dinput_device_Initialize, /*** IDirectInputDevice2 methods ***/ - IDirectInputDevice2WImpl_CreateEffect, - IDirectInputDevice2WImpl_EnumEffects, - IDirectInputDevice2WImpl_GetEffectInfo, - IDirectInputDevice2WImpl_GetForceFeedbackState, - IDirectInputDevice2WImpl_SendForceFeedbackCommand, - IDirectInputDevice2WImpl_EnumCreatedEffectObjects, - IDirectInputDevice2WImpl_Escape, - IDirectInputDevice2WImpl_Poll, - IDirectInputDevice2WImpl_SendDeviceData, + dinput_device_CreateEffect, + dinput_device_EnumEffects, + dinput_device_GetEffectInfo, + dinput_device_GetForceFeedbackState, + dinput_device_SendForceFeedbackCommand, + dinput_device_EnumCreatedEffectObjects, + dinput_device_Escape, + dinput_device_Poll, + dinput_device_SendDeviceData, /*** IDirectInputDevice7 methods ***/ - IDirectInputDevice7WImpl_EnumEffectsInFile, - IDirectInputDevice7WImpl_WriteEffectToFile, + dinput_device_EnumEffectsInFile, + dinput_device_WriteEffectToFile, /*** IDirectInputDevice8 methods ***/ - IDirectInputDevice8WImpl_BuildActionMap, - IDirectInputDevice8WImpl_SetActionMap, - IDirectInputDevice8WImpl_GetImageInfo, + dinput_device_BuildActionMap, + dinput_device_SetActionMap, + dinput_device_GetImageInfo, };
-HRESULT direct_input_device_alloc( SIZE_T size, const struct dinput_device_vtbl *vtbl, +HRESULT dinput_device_alloc( SIZE_T size, const struct dinput_device_vtbl *vtbl, const GUID *guid, IDirectInputImpl *dinput, void **out ) { - IDirectInputDeviceImpl *This; + struct dinput_device *This; DIDATAFORMAT *format;
if (!(This = calloc( 1, size ))) return DIERR_OUTOFMEMORY; @@ -2157,7 +2147,7 @@ static const GUID *object_instance_guid( const DIDEVICEOBJECTINSTANCEW *instance
static BOOL CALLBACK enum_objects_init( const DIDEVICEOBJECTINSTANCEW *instance, void *data ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( data ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( data ); DIDATAFORMAT *format = impl->data_format.wine_df; DIOBJECTDATAFORMAT *obj_format;
@@ -2188,9 +2178,9 @@ static BOOL CALLBACK enum_objects_init( const DIDEVICEOBJECTINSTANCEW *instance, return DIENUM_CONTINUE; }
-HRESULT direct_input_device_init( IDirectInputDevice8W *iface ) +HRESULT dinput_device_init( IDirectInputDevice8W *iface ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); DIDATAFORMAT *format = impl->data_format.wine_df; ULONG size;
diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h index 49819c95096..7ee0ef312c0 100644 --- a/dlls/dinput/device_private.h +++ b/dlls/dinput/device_private.h @@ -76,8 +76,7 @@ struct dinput_device_vtbl #define DEVICE_STATE_MAX_SIZE 1024
/* Device implementation */ -typedef struct IDirectInputDeviceImpl IDirectInputDeviceImpl; -struct IDirectInputDeviceImpl +struct dinput_device { IDirectInputDevice8W IDirectInputDevice8W_iface; IDirectInputDevice8A IDirectInputDevice8A_iface; @@ -117,10 +116,10 @@ struct IDirectInputDeviceImpl BYTE device_state[DEVICE_STATE_MAX_SIZE]; };
-extern HRESULT direct_input_device_alloc( SIZE_T size, const struct dinput_device_vtbl *vtbl, - const GUID *guid, IDirectInputImpl *dinput, void **out ) DECLSPEC_HIDDEN; -extern HRESULT direct_input_device_init( IDirectInputDevice8W *iface ); -extern void direct_input_device_destroy( IDirectInputDevice8W *iface ); +extern HRESULT dinput_device_alloc( SIZE_T size, const struct dinput_device_vtbl *vtbl, const GUID *guid, + IDirectInputImpl *dinput, void **out ) DECLSPEC_HIDDEN; +extern HRESULT dinput_device_init( IDirectInputDevice8W *iface ); +extern void dinput_device_destroy( IDirectInputDevice8W *iface );
extern BOOL get_app_key(HKEY*, HKEY*) DECLSPEC_HIDDEN; extern DWORD get_config_key( HKEY, HKEY, const WCHAR *, WCHAR *, DWORD ) DECLSPEC_HIDDEN; diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index bc033a1baca..3286e887662 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -69,9 +69,9 @@ static inline IDirectInputImpl *impl_from_IDirectInput8W( IDirectInput8W *iface return CONTAINING_RECORD( iface, IDirectInputImpl, IDirectInput8W_iface ); }
-static inline IDirectInputDeviceImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface) +static inline struct dinput_device *impl_from_IDirectInputDevice8W( IDirectInputDevice8W *iface ) { - return CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface); + return CONTAINING_RECORD( iface, struct dinput_device, IDirectInputDevice8W_iface ); }
HINSTANCE DINPUT_instance; @@ -89,32 +89,32 @@ static struct list acquired_device_list = LIST_INIT( acquired_device_list ); static HRESULT initialize_directinput_instance(IDirectInputImpl *This, DWORD dwVersion); static void uninitialize_directinput_instance(IDirectInputImpl *This);
-void dinput_hooks_acquire_device(LPDIRECTINPUTDEVICE8W iface) +void dinput_hooks_acquire_device( IDirectInputDevice8W *iface ) { - IDirectInputDeviceImpl *dev = impl_from_IDirectInputDevice8W(iface); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface );
EnterCriticalSection( &dinput_hook_crit ); - if (IsEqualGUID( &dev->guid, &GUID_SysMouse )) - list_add_tail( dev->use_raw_input ? &acquired_rawmouse_list : &acquired_mouse_list, &dev->entry ); - else if (IsEqualGUID( &dev->guid, &GUID_SysKeyboard )) - list_add_tail( &acquired_keyboard_list, &dev->entry ); + if (IsEqualGUID( &impl->guid, &GUID_SysMouse )) + list_add_tail( impl->use_raw_input ? &acquired_rawmouse_list : &acquired_mouse_list, &impl->entry ); + else if (IsEqualGUID( &impl->guid, &GUID_SysKeyboard )) + list_add_tail( &acquired_keyboard_list, &impl->entry ); else - list_add_tail( &acquired_device_list, &dev->entry ); + list_add_tail( &acquired_device_list, &impl->entry ); LeaveCriticalSection( &dinput_hook_crit ); }
-void dinput_hooks_unacquire_device(LPDIRECTINPUTDEVICE8W iface) +void dinput_hooks_unacquire_device( IDirectInputDevice8W *iface ) { - IDirectInputDeviceImpl *dev = impl_from_IDirectInputDevice8W(iface); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface );
EnterCriticalSection( &dinput_hook_crit ); - list_remove( &dev->entry ); + list_remove( &impl->entry ); LeaveCriticalSection( &dinput_hook_crit ); }
static void dinput_device_internal_unacquire( IDirectInputDevice8W *iface ) { - IDirectInputDeviceImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface );
TRACE( "iface %p.\n", iface );
@@ -422,7 +422,7 @@ static HRESULT WINAPI IDirectInputWImpl_QueryInterface( IDirectInput7W *iface, R
static LRESULT WINAPI di_em_win_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { - IDirectInputDeviceImpl *dev; + struct dinput_device *impl; RAWINPUT ri; UINT size = sizeof(ri); int rim = GET_RAWINPUT_CODE_WPARAM( wparam ); @@ -437,8 +437,8 @@ static LRESULT WINAPI di_em_win_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPAR else if (ri.header.dwType == RIM_TYPEMOUSE) { EnterCriticalSection( &dinput_hook_crit ); - LIST_FOR_EACH_ENTRY( dev, &acquired_rawmouse_list, IDirectInputDeviceImpl, entry ) - dinput_mouse_rawinput_hook( &dev->IDirectInputDevice8W_iface, wparam, lparam, &ri ); + LIST_FOR_EACH_ENTRY( impl, &acquired_rawmouse_list, struct dinput_device, entry ) + dinput_mouse_rawinput_hook( &impl->IDirectInputDevice8W_iface, wparam, lparam, &ri ); LeaveCriticalSection( &dinput_hook_crit ); } } @@ -1132,22 +1132,22 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
static LRESULT CALLBACK LL_hook_proc( int code, WPARAM wparam, LPARAM lparam ) { - IDirectInputDeviceImpl *dev; + struct dinput_device *impl; int skip = 0;
if (code != HC_ACTION) return CallNextHookEx( 0, code, wparam, lparam );
EnterCriticalSection( &dinput_hook_crit ); - LIST_FOR_EACH_ENTRY( dev, &acquired_mouse_list, IDirectInputDeviceImpl, entry ) + LIST_FOR_EACH_ENTRY( impl, &acquired_mouse_list, struct dinput_device, entry ) { - TRACE("calling dinput_mouse_hook (%p %lx %lx)\n", dev, wparam, lparam); - skip |= dinput_mouse_hook( &dev->IDirectInputDevice8W_iface, wparam, lparam ); + TRACE( "calling dinput_mouse_hook (%p %lx %lx)\n", impl, wparam, lparam ); + skip |= dinput_mouse_hook( &impl->IDirectInputDevice8W_iface, wparam, lparam ); } - LIST_FOR_EACH_ENTRY( dev, &acquired_keyboard_list, IDirectInputDeviceImpl, entry ) + LIST_FOR_EACH_ENTRY( impl, &acquired_keyboard_list, struct dinput_device, entry ) { - if (dev->use_raw_input) continue; - TRACE("calling dinput_keyboard_hook (%p %lx %lx)\n", dev, wparam, lparam); - skip |= dinput_keyboard_hook( &dev->IDirectInputDevice8W_iface, wparam, lparam ); + if (impl->use_raw_input) continue; + TRACE( "calling dinput_keyboard_hook (%p %lx %lx)\n", impl, wparam, lparam ); + skip |= dinput_keyboard_hook( &impl->IDirectInputDevice8W_iface, wparam, lparam ); } LeaveCriticalSection( &dinput_hook_crit );
@@ -1156,7 +1156,7 @@ static LRESULT CALLBACK LL_hook_proc( int code, WPARAM wparam, LPARAM lparam )
static LRESULT CALLBACK callwndproc_proc( int code, WPARAM wparam, LPARAM lparam ) { - IDirectInputDeviceImpl *dev, *next; + struct dinput_device *impl, *next; CWPSTRUCT *msg = (CWPSTRUCT *)lparam; HWND foreground;
@@ -1167,36 +1167,36 @@ static LRESULT CALLBACK callwndproc_proc( int code, WPARAM wparam, LPARAM lparam foreground = GetForegroundWindow();
EnterCriticalSection( &dinput_hook_crit ); - LIST_FOR_EACH_ENTRY_SAFE( dev, next, &acquired_device_list, IDirectInputDeviceImpl, entry ) + LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_device_list, struct dinput_device, entry ) { - if (msg->hwnd == dev->win && msg->hwnd != foreground) + if (msg->hwnd == impl->win && msg->hwnd != foreground) { - TRACE( "%p window is not foreground - unacquiring %p\n", dev->win, dev ); - dinput_device_internal_unacquire( &dev->IDirectInputDevice8W_iface ); + TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl ); + dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface ); } } - LIST_FOR_EACH_ENTRY_SAFE( dev, next, &acquired_mouse_list, IDirectInputDeviceImpl, entry ) + LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_mouse_list, struct dinput_device, entry ) { - if (msg->hwnd == dev->win && msg->hwnd != foreground) + if (msg->hwnd == impl->win && msg->hwnd != foreground) { - TRACE( "%p window is not foreground - unacquiring %p\n", dev->win, dev ); - dinput_device_internal_unacquire( &dev->IDirectInputDevice8W_iface ); + TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl ); + dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface ); } } - LIST_FOR_EACH_ENTRY_SAFE( dev, next, &acquired_rawmouse_list, IDirectInputDeviceImpl, entry ) + LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_rawmouse_list, struct dinput_device, entry ) { - if (msg->hwnd == dev->win && msg->hwnd != foreground) + if (msg->hwnd == impl->win && msg->hwnd != foreground) { - TRACE( "%p window is not foreground - unacquiring %p\n", dev->win, dev ); - dinput_device_internal_unacquire( &dev->IDirectInputDevice8W_iface ); + TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl ); + dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface ); } } - LIST_FOR_EACH_ENTRY_SAFE( dev, next, &acquired_keyboard_list, IDirectInputDeviceImpl, entry ) + LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_keyboard_list, struct dinput_device, entry ) { - if (msg->hwnd == dev->win && msg->hwnd != foreground) + if (msg->hwnd == impl->win && msg->hwnd != foreground) { - TRACE( "%p window is not foreground - unacquiring %p\n", dev->win, dev ); - dinput_device_internal_unacquire( &dev->IDirectInputDevice8W_iface ); + TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl ); + dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface ); } } LeaveCriticalSection( &dinput_hook_crit ); @@ -1207,7 +1207,7 @@ static LRESULT CALLBACK callwndproc_proc( int code, WPARAM wparam, LPARAM lparam static DWORD WINAPI hook_thread_proc(void *param) { static HHOOK kbd_hook, mouse_hook; - IDirectInputDeviceImpl *impl, *next; + struct dinput_device *impl, *next; SIZE_T events_count = 0; HANDLE finished_event; HANDLE events[128]; @@ -1228,7 +1228,7 @@ static DWORD WINAPI hook_thread_proc(void *param) if (ret < events_count) { EnterCriticalSection( &dinput_hook_crit ); - LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_device_list, IDirectInputDeviceImpl, entry ) + LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_device_list, struct dinput_device, entry ) { if (impl->read_event == events[ret]) { @@ -1265,7 +1265,7 @@ static DWORD WINAPI hook_thread_proc(void *param) EnterCriticalSection( &dinput_hook_crit ); kbd_cnt = list_count( &acquired_keyboard_list ); mice_cnt = list_count( &acquired_mouse_list ); - LIST_FOR_EACH_ENTRY( impl, &acquired_device_list, IDirectInputDeviceImpl, entry ) + LIST_FOR_EACH_ENTRY( impl, &acquired_device_list, struct dinput_device, entry ) { if (!impl->read_event || !impl->vtbl->read) continue; if (events_count >= ARRAY_SIZE(events)) break; @@ -1353,16 +1353,16 @@ static BOOL check_hook_thread(void) return hook_thread_id != 0; }
-void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface, BOOL acquired) +void check_dinput_hooks( IDirectInputDevice8W *iface, BOOL acquired ) { static HHOOK callwndproc_hook; static ULONG foreground_cnt; - IDirectInputDeviceImpl *dev = impl_from_IDirectInputDevice8W(iface); + struct dinput_device *impl = impl_from_IDirectInputDevice8W( iface ); HANDLE hook_change_finished_event = NULL;
EnterCriticalSection(&dinput_hook_crit);
- if (dev->dwCoopLevel & DISCL_FOREGROUND) + if (impl->dwCoopLevel & DISCL_FOREGROUND) { if (acquired) foreground_cnt++; @@ -1386,29 +1386,29 @@ void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface, BOOL acquired) hook_thread_event = NULL; }
- if (dev->use_raw_input) + if (impl->use_raw_input) { if (acquired) { - dev->raw_device.dwFlags = 0; - if (dev->dwCoopLevel & DISCL_BACKGROUND) - dev->raw_device.dwFlags |= RIDEV_INPUTSINK; - if (dev->dwCoopLevel & DISCL_EXCLUSIVE) - dev->raw_device.dwFlags |= RIDEV_NOLEGACY; - if ((dev->dwCoopLevel & DISCL_EXCLUSIVE) && dev->raw_device.usUsage == 2) - dev->raw_device.dwFlags |= RIDEV_CAPTUREMOUSE; - if ((dev->dwCoopLevel & DISCL_EXCLUSIVE) && dev->raw_device.usUsage == 6) - dev->raw_device.dwFlags |= RIDEV_NOHOTKEYS; - dev->raw_device.hwndTarget = di_em_win; + impl->raw_device.dwFlags = 0; + if (impl->dwCoopLevel & DISCL_BACKGROUND) + impl->raw_device.dwFlags |= RIDEV_INPUTSINK; + if (impl->dwCoopLevel & DISCL_EXCLUSIVE) + impl->raw_device.dwFlags |= RIDEV_NOLEGACY; + if ((impl->dwCoopLevel & DISCL_EXCLUSIVE) && impl->raw_device.usUsage == 2) + impl->raw_device.dwFlags |= RIDEV_CAPTUREMOUSE; + if ((impl->dwCoopLevel & DISCL_EXCLUSIVE) && impl->raw_device.usUsage == 6) + impl->raw_device.dwFlags |= RIDEV_NOHOTKEYS; + impl->raw_device.hwndTarget = di_em_win; } else { - dev->raw_device.dwFlags = RIDEV_REMOVE; - dev->raw_device.hwndTarget = NULL; + impl->raw_device.dwFlags = RIDEV_REMOVE; + impl->raw_device.hwndTarget = NULL; }
- if (!RegisterRawInputDevices( &dev->raw_device, 1, sizeof(RAWINPUTDEVICE) )) - WARN( "Unable to (un)register raw device %x:%x\n", dev->raw_device.usUsagePage, dev->raw_device.usUsage ); + if (!RegisterRawInputDevices( &impl->raw_device, 1, sizeof(RAWINPUTDEVICE) )) + WARN( "Unable to (un)register raw device %x:%x\n", impl->raw_device.usUsagePage, impl->raw_device.usUsage ); }
hook_change_finished_event = CreateEventW( NULL, FALSE, FALSE, NULL ); diff --git a/dlls/dinput/dinput_private.h b/dlls/dinput/dinput_private.h index 461af021a30..a9777dc8dbb 100644 --- a/dlls/dinput/dinput_private.h +++ b/dlls/dinput/dinput_private.h @@ -65,14 +65,14 @@ struct DevicePlayer { struct list entry; };
-extern void dinput_hooks_acquire_device(LPDIRECTINPUTDEVICE8W iface); -extern void dinput_hooks_unacquire_device(LPDIRECTINPUTDEVICE8W iface); +extern void dinput_hooks_acquire_device( IDirectInputDevice8W *iface ); +extern void dinput_hooks_unacquire_device( IDirectInputDevice8W *iface ); extern int dinput_mouse_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam ); extern int dinput_keyboard_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam ); extern void dinput_mouse_rawinput_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam, RAWINPUT *raw );
-extern void check_dinput_hooks(LPDIRECTINPUTDEVICE8W, BOOL) DECLSPEC_HIDDEN; +extern void check_dinput_hooks( IDirectInputDevice8W *iface, BOOL acquired ) DECLSPEC_HIDDEN; extern void check_dinput_events(void) DECLSPEC_HIDDEN;
extern HRESULT _configure_devices(IDirectInput8W *iface, LPDICONFIGUREDEVICESCALLBACK lpdiCallback, LPDICONFIGUREDEVICESPARAMSW lpdiCDParams, DWORD dwFlags, LPVOID pvRefData) DECLSPEC_HIDDEN; diff --git a/dlls/dinput/joystick_hid.c b/dlls/dinput/joystick_hid.c index 4632109a35b..3a8c7213ebc 100644 --- a/dlls/dinput/joystick_hid.c +++ b/dlls/dinput/joystick_hid.c @@ -157,7 +157,7 @@ struct pid_set_ramp_force
struct hid_joystick { - IDirectInputDeviceImpl base; + struct dinput_device base; LONG internal_ref;
HANDLE device; @@ -189,7 +189,7 @@ struct hid_joystick
static inline struct hid_joystick *impl_from_IDirectInputDevice8W( IDirectInputDevice8W *iface ) { - return CONTAINING_RECORD( CONTAINING_RECORD( iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface ), + return CONTAINING_RECORD( CONTAINING_RECORD( iface, struct dinput_device, IDirectInputDevice8W_iface ), struct hid_joystick, base ); }
@@ -630,7 +630,7 @@ static void hid_joystick_release( IDirectInputDevice8W *iface ) HidD_FreePreparsedData( impl->preparsed ); CloseHandle( impl->base.read_event ); CloseHandle( impl->device ); - direct_input_device_destroy( iface ); + dinput_device_destroy( iface ); } }
@@ -1781,8 +1781,7 @@ HRESULT hid_joystick_create_device( IDirectInputImpl *dinput, const GUID *guid, else return DIERR_DEVICENOTREG;
- hr = direct_input_device_alloc( sizeof(struct hid_joystick), &hid_joystick_vtbl, - guid, dinput, (void **)&impl ); + hr = dinput_device_alloc( sizeof(struct hid_joystick), &hid_joystick_vtbl, guid, dinput, (void **)&impl ); if (FAILED(hr)) return hr; impl->base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": hid_joystick.base.crit"); impl->base.dwCoopLevel = DISCL_NONEXCLUSIVE | DISCL_BACKGROUND; @@ -1856,8 +1855,7 @@ HRESULT hid_joystick_create_device( IDirectInputImpl *dinput, const GUID *guid, impl->base.caps.dwFFDriverVersion = 1; }
- if (FAILED(hr = direct_input_device_init( &impl->base.IDirectInputDevice8W_iface ))) - goto failed; + if (FAILED(hr = dinput_device_init( &impl->base.IDirectInputDevice8W_iface ))) goto failed;
*out = &impl->base.IDirectInputDevice8W_iface; return DI_OK; diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c index a6032cbd0a4..713c5310322 100644 --- a/dlls/dinput/keyboard.c +++ b/dlls/dinput/keyboard.c @@ -39,12 +39,13 @@ static const struct dinput_device_vtbl keyboard_vtbl; typedef struct SysKeyboardImpl SysKeyboardImpl; struct SysKeyboardImpl { - struct IDirectInputDeviceImpl base; + struct dinput_device base; };
static inline SysKeyboardImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface) { - return CONTAINING_RECORD(CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface), SysKeyboardImpl, base); + return CONTAINING_RECORD( CONTAINING_RECORD( iface, struct dinput_device, IDirectInputDevice8W_iface ), + SysKeyboardImpl, base ); }
static BYTE map_dik_code(DWORD scanCode, DWORD vkCode, DWORD subType, DWORD version) @@ -184,8 +185,7 @@ HRESULT keyboard_create_device( IDirectInputImpl *dinput, const GUID *guid, IDir *out = NULL; if (!IsEqualGUID( &GUID_SysKeyboard, guid )) return DIERR_DEVICENOTREG;
- if (FAILED(hr = direct_input_device_alloc( sizeof(SysKeyboardImpl), &keyboard_vtbl, - guid, dinput, (void **)&impl ))) + if (FAILED(hr = dinput_device_alloc( sizeof(SysKeyboardImpl), &keyboard_vtbl, guid, dinput, (void **)&impl ))) return hr; impl->base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SysKeyboardImpl*->base.crit");
@@ -194,7 +194,7 @@ HRESULT keyboard_create_device( IDirectInputImpl *dinput, const GUID *guid, IDir impl->base.caps.dwFirmwareRevision = 100; impl->base.caps.dwHardwareRevision = 100;
- if (FAILED(hr = direct_input_device_init( &impl->base.IDirectInputDevice8W_iface ))) + if (FAILED(hr = dinput_device_init( &impl->base.IDirectInputDevice8W_iface ))) { IDirectInputDevice_Release( &impl->base.IDirectInputDevice8W_iface ); return hr; diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c index 84b5410bb36..9cf8ab07463 100644 --- a/dlls/dinput/mouse.c +++ b/dlls/dinput/mouse.c @@ -56,7 +56,7 @@ typedef enum
struct SysMouseImpl { - struct IDirectInputDeviceImpl base; + struct dinput_device base;
/* SysMouseAImpl */ /* These are used in case of relative -> absolute transitions */ @@ -72,7 +72,7 @@ struct SysMouseImpl
static inline SysMouseImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface) { - return CONTAINING_RECORD(CONTAINING_RECORD(iface, IDirectInputDeviceImpl, IDirectInputDevice8W_iface), SysMouseImpl, base); + return CONTAINING_RECORD( CONTAINING_RECORD( iface, struct dinput_device, IDirectInputDevice8W_iface ), SysMouseImpl, base ); }
HRESULT mouse_enum_device( DWORD type, DWORD flags, DIDEVICEINSTANCEW *instance, DWORD version, int index ) @@ -116,8 +116,7 @@ HRESULT mouse_create_device( IDirectInputImpl *dinput, const GUID *guid, IDirect *out = NULL; if (!IsEqualGUID( &GUID_SysMouse, guid )) return DIERR_DEVICENOTREG;
- if (FAILED(hr = direct_input_device_alloc( sizeof(SysMouseImpl), &mouse_vtbl, - guid, dinput, (void **)&impl ))) + if (FAILED(hr = dinput_device_alloc( sizeof(SysMouseImpl), &mouse_vtbl, guid, dinput, (void **)&impl ))) return hr; impl->base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SysMouseImpl*->base.crit");
@@ -136,7 +135,7 @@ HRESULT mouse_create_device( IDirectInputImpl *dinput, const GUID *guid, IDirect if (appkey) RegCloseKey(appkey); if (hkey) RegCloseKey(hkey);
- if (FAILED(hr = direct_input_device_init( &impl->base.IDirectInputDevice8W_iface ))) + if (FAILED(hr = dinput_device_init( &impl->base.IDirectInputDevice8W_iface ))) { IDirectInputDevice_Release( &impl->base.IDirectInputDevice8W_iface ); return hr;
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/keyboard.c | 43 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 22 deletions(-)
diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c index 713c5310322..ef125176ecb 100644 --- a/dlls/dinput/keyboard.c +++ b/dlls/dinput/keyboard.c @@ -36,16 +36,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput);
static const struct dinput_device_vtbl keyboard_vtbl;
-typedef struct SysKeyboardImpl SysKeyboardImpl; -struct SysKeyboardImpl +struct keyboard { struct dinput_device base; };
-static inline SysKeyboardImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface) +static inline struct keyboard *impl_from_IDirectInputDevice8W( IDirectInputDevice8W *iface ) { return CONTAINING_RECORD( CONTAINING_RECORD( iface, struct dinput_device, IDirectInputDevice8W_iface ), - SysKeyboardImpl, base ); + struct keyboard, base ); }
static BYTE map_dik_code(DWORD scanCode, DWORD vkCode, DWORD subType, DWORD version) @@ -86,9 +85,9 @@ static BYTE map_dik_code(DWORD scanCode, DWORD vkCode, DWORD subType, DWORD vers
int dinput_keyboard_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam ) { - SysKeyboardImpl *This = impl_from_IDirectInputDevice8W( iface ); - BYTE new_diks, subtype = GET_DIDEVICE_SUBTYPE( This->base.instance.dwDevType ); - int dik_code, ret = This->base.dwCoopLevel & DISCL_EXCLUSIVE; + struct keyboard *impl = impl_from_IDirectInputDevice8W( iface ); + BYTE new_diks, subtype = GET_DIDEVICE_SUBTYPE( impl->base.instance.dwDevType ); + int dik_code, ret = impl->base.dwCoopLevel & DISCL_EXCLUSIVE; KBDLLHOOKSTRUCT *hook = (KBDLLHOOKSTRUCT *)lparam; DWORD scan_code;
@@ -109,21 +108,21 @@ int dinput_keyboard_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lpa default: scan_code = hook->scanCode & 0xff; if (hook->flags & LLKHF_EXTENDED) scan_code |= 0x100; - dik_code = map_dik_code( scan_code, hook->vkCode, subtype, This->base.dinput->dwVersion ); + dik_code = map_dik_code( scan_code, hook->vkCode, subtype, impl->base.dinput->dwVersion ); } new_diks = hook->flags & LLKHF_UP ? 0 : 0x80;
/* returns now if key event already known */ - if (new_diks == This->base.device_state[dik_code]) return ret; + if (new_diks == impl->base.device_state[dik_code]) return ret;
- This->base.device_state[dik_code] = new_diks; - TRACE( " setting key %02x to %02x\n", dik_code, This->base.device_state[dik_code] ); + impl->base.device_state[dik_code] = new_diks; + TRACE( " setting key %02x to %02x\n", dik_code, impl->base.device_state[dik_code] );
- EnterCriticalSection(&This->base.crit); - queue_event(iface, DIDFT_MAKEINSTANCE(dik_code) | DIDFT_PSHBUTTON, - new_diks, GetCurrentTime(), This->base.dinput->evsequence++); - if (This->base.hEvent) SetEvent( This->base.hEvent ); - LeaveCriticalSection(&This->base.crit); + EnterCriticalSection( &impl->base.crit ); + queue_event( iface, DIDFT_MAKEINSTANCE( dik_code ) | DIDFT_PSHBUTTON, new_diks, + GetCurrentTime(), impl->base.dinput->evsequence++ ); + if (impl->base.hEvent) SetEvent( impl->base.hEvent ); + LeaveCriticalSection( &impl->base.crit );
return ret; } @@ -177,7 +176,7 @@ HRESULT keyboard_enum_device( DWORD type, DWORD flags, DIDEVICEINSTANCEW *instan
HRESULT keyboard_create_device( IDirectInputImpl *dinput, const GUID *guid, IDirectInputDevice8W **out ) { - SysKeyboardImpl *impl; + struct keyboard *impl; HRESULT hr;
TRACE( "dinput %p, guid %s, out %p\n", dinput, debugstr_guid( guid ), out ); @@ -185,9 +184,9 @@ HRESULT keyboard_create_device( IDirectInputImpl *dinput, const GUID *guid, IDir *out = NULL; if (!IsEqualGUID( &GUID_SysKeyboard, guid )) return DIERR_DEVICENOTREG;
- if (FAILED(hr = dinput_device_alloc( sizeof(SysKeyboardImpl), &keyboard_vtbl, guid, dinput, (void **)&impl ))) + if (FAILED(hr = dinput_device_alloc( sizeof(struct keyboard), &keyboard_vtbl, guid, dinput, (void **)&impl ))) return hr; - impl->base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SysKeyboardImpl*->base.crit"); + impl->base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": struct keyboard*->base.crit");
keyboard_enum_device( 0, 0, &impl->base.instance, dinput->dwVersion, 0 ); impl->base.caps.dwDevType = impl->base.instance.dwDevType; @@ -217,8 +216,8 @@ static HRESULT keyboard_acquire( IDirectInputDevice8W *iface )
static HRESULT keyboard_unacquire( IDirectInputDevice8W *iface ) { - SysKeyboardImpl *This = impl_from_IDirectInputDevice8W( iface ); - memset( This->base.device_state, 0, sizeof(This->base.device_state) ); + struct keyboard *impl = impl_from_IDirectInputDevice8W( iface ); + memset( impl->base.device_state, 0, sizeof(impl->base.device_state) ); return DI_OK; }
@@ -245,7 +244,7 @@ static BOOL try_enum_object( const DIPROPHEADER *filter, DWORD flags, LPDIENUMDE static HRESULT keyboard_enum_objects( IDirectInputDevice8W *iface, const DIPROPHEADER *filter, DWORD flags, LPDIENUMDEVICEOBJECTSCALLBACKW callback, void *context ) { - SysKeyboardImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct keyboard *impl = impl_from_IDirectInputDevice8W( iface ); BYTE subtype = GET_DIDEVICE_SUBTYPE( impl->base.instance.dwDevType ); DIDEVICEOBJECTINSTANCEW instance = {
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/mouse.c | 91 ++++++++++++++++++++------------------------- 1 file changed, 41 insertions(+), 50 deletions(-)
diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c index 9cf8ab07463..4e1762fbc50 100644 --- a/dlls/dinput/mouse.c +++ b/dlls/dinput/mouse.c @@ -45,8 +45,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput);
static const struct dinput_device_vtbl mouse_vtbl;
-typedef struct SysMouseImpl SysMouseImpl; - typedef enum { WARP_DEFAULT, @@ -54,11 +52,10 @@ typedef enum WARP_FORCE_ON } WARP_MOUSE;
-struct SysMouseImpl +struct mouse { struct dinput_device base;
- /* SysMouseAImpl */ /* These are used in case of relative -> absolute transitions */ POINT org_coords; BOOL clipped; @@ -70,9 +67,9 @@ struct SysMouseImpl WARP_MOUSE warp_override; };
-static inline SysMouseImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface) +static inline struct mouse *impl_from_IDirectInputDevice8W( IDirectInputDevice8W *iface ) { - return CONTAINING_RECORD( CONTAINING_RECORD( iface, struct dinput_device, IDirectInputDevice8W_iface ), SysMouseImpl, base ); + return CONTAINING_RECORD( CONTAINING_RECORD( iface, struct dinput_device, IDirectInputDevice8W_iface ), struct mouse, base ); }
HRESULT mouse_enum_device( DWORD type, DWORD flags, DIDEVICEINSTANCEW *instance, DWORD version, int index ) @@ -106,7 +103,7 @@ HRESULT mouse_enum_device( DWORD type, DWORD flags, DIDEVICEINSTANCEW *instance,
HRESULT mouse_create_device( IDirectInputImpl *dinput, const GUID *guid, IDirectInputDevice8W **out ) { - SysMouseImpl *impl; + struct mouse *impl; HKEY hkey, appkey; WCHAR buffer[20]; HRESULT hr; @@ -116,9 +113,9 @@ HRESULT mouse_create_device( IDirectInputImpl *dinput, const GUID *guid, IDirect *out = NULL; if (!IsEqualGUID( &GUID_SysMouse, guid )) return DIERR_DEVICENOTREG;
- if (FAILED(hr = dinput_device_alloc( sizeof(SysMouseImpl), &mouse_vtbl, guid, dinput, (void **)&impl ))) + if (FAILED(hr = dinput_device_alloc( sizeof(struct mouse), &mouse_vtbl, guid, dinput, (void **)&impl ))) return hr; - impl->base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SysMouseImpl*->base.crit"); + impl->base.crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": struct mouse*->base.crit");
mouse_enum_device( 0, 0, &impl->base.instance, dinput->dwVersion, 0 ); impl->base.caps.dwDevType = impl->base.instance.dwDevType; @@ -152,14 +149,10 @@ HRESULT mouse_create_device( IDirectInputImpl *dinput, const GUID *guid, IDirect return DI_OK; }
-/****************************************************************************** - * SysMouseA (DInput Mouse support) - */ - void dinput_mouse_rawinput_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam, RAWINPUT *ri ) { - SysMouseImpl *This = impl_from_IDirectInputDevice8W( iface ); - DIMOUSESTATE2 *state = (DIMOUSESTATE2 *)This->base.device_state; + struct mouse *impl = impl_from_IDirectInputDevice8W( iface ); + DIMOUSESTATE2 *state = (DIMOUSESTATE2 *)impl->base.device_state; POINT rel, pt; DWORD seq; int i, wdata = 0; @@ -181,8 +174,8 @@ void dinput_mouse_rawinput_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPA if (ri->data.mouse.usFlags & MOUSE_ATTRIBUTES_CHANGED) FIXME( "Unimplemented MOUSE_ATTRIBUTES_CHANGED flag\n" );
- EnterCriticalSection( &This->base.crit ); - seq = This->base.dinput->evsequence++; + EnterCriticalSection( &impl->base.crit ); + seq = impl->base.dinput->evsequence++;
rel.x = ri->data.mouse.lLastX; rel.y = ri->data.mouse.lLastY; @@ -196,7 +189,7 @@ void dinput_mouse_rawinput_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPA state->lX += rel.x; state->lY += rel.y;
- if (This->base.data_format.user_df->dwFlags & DIDF_ABSAXIS) + if (impl->base.data_format.user_df->dwFlags & DIDF_ABSAXIS) { pt.x = state->lX; pt.y = state->lY; @@ -222,9 +215,9 @@ void dinput_mouse_rawinput_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPA
if (rel.x || rel.y) { - if ((This->warp_override == WARP_FORCE_ON) || - (This->warp_override != WARP_DISABLE && (This->base.dwCoopLevel & DISCL_EXCLUSIVE))) - This->need_warp = TRUE; + if ((impl->warp_override == WARP_FORCE_ON) || + (impl->warp_override != WARP_DISABLE && (impl->base.dwCoopLevel & DISCL_EXCLUSIVE))) + impl->need_warp = TRUE; }
if (ri->data.mouse.usButtonFlags & RI_MOUSE_WHEEL) @@ -250,22 +243,22 @@ void dinput_mouse_rawinput_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPA state->rgbButtons[1], state->rgbButtons[2], state->rgbButtons[3], state->rgbButtons[4], state->lX, state->lY, state->lZ );
- if (notify && This->base.hEvent) SetEvent( This->base.hEvent ); - LeaveCriticalSection( &This->base.crit ); + if (notify && impl->base.hEvent) SetEvent( impl->base.hEvent ); + LeaveCriticalSection( &impl->base.crit ); }
/* low-level mouse hook */ int dinput_mouse_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam ) { MSLLHOOKSTRUCT *hook = (MSLLHOOKSTRUCT *)lparam; - SysMouseImpl *This = impl_from_IDirectInputDevice8W( iface ); - DIMOUSESTATE2 *state = (DIMOUSESTATE2 *)This->base.device_state; + struct mouse *impl = impl_from_IDirectInputDevice8W( iface ); + DIMOUSESTATE2 *state = (DIMOUSESTATE2 *)impl->base.device_state; int wdata = 0, inst_id = -1, ret = 0; BOOL notify = FALSE;
TRACE("msg %lx @ (%d %d)\n", wparam, hook->pt.x, hook->pt.y);
- EnterCriticalSection(&This->base.crit); + EnterCriticalSection( &impl->base.crit );
switch(wparam) { case WM_MOUSEMOVE: @@ -276,7 +269,7 @@ int dinput_mouse_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam state->lX += pt.x = hook->pt.x - pt.x; state->lY += pt.y = hook->pt.y - pt.y;
- if (This->base.data_format.user_df->dwFlags & DIDF_ABSAXIS) + if (impl->base.data_format.user_df->dwFlags & DIDF_ABSAXIS) { pt1.x = state->lX; pt1.y = state->lY; @@ -293,8 +286,7 @@ int dinput_mouse_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam /* Already have X, need to queue it */ if (inst_id != -1) { - queue_event(iface, inst_id, - wdata, GetCurrentTime(), This->base.dinput->evsequence); + queue_event( iface, inst_id, wdata, GetCurrentTime(), impl->base.dinput->evsequence ); notify = TRUE; } inst_id = DIDFT_MAKEINSTANCE(WINE_MOUSE_Y_AXIS_INSTANCE) | DIDFT_RELAXIS; @@ -303,9 +295,9 @@ int dinput_mouse_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam
if (pt.x || pt.y) { - if ((This->warp_override == WARP_FORCE_ON) || - (This->warp_override != WARP_DISABLE && (This->base.dwCoopLevel & DISCL_EXCLUSIVE))) - This->need_warp = TRUE; + if ((impl->warp_override == WARP_FORCE_ON) || + (impl->warp_override != WARP_DISABLE && (impl->base.dwCoopLevel & DISCL_EXCLUSIVE))) + impl->need_warp = TRUE; } break; } @@ -314,7 +306,7 @@ int dinput_mouse_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam state->lZ += wdata = (short)HIWORD( hook->mouseData ); /* FarCry crashes if it gets a mouse wheel message */ /* FIXME: should probably filter out other messages too */ - ret = This->clipped; + ret = impl->clipped; break; case WM_LBUTTONDOWN: inst_id = DIDFT_MAKEINSTANCE(WINE_MOUSE_BUTTONS_INSTANCE + 0) | DIDFT_PSHBUTTON; @@ -353,8 +345,7 @@ int dinput_mouse_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam
if (inst_id != -1) { - queue_event(iface, inst_id, - wdata, GetCurrentTime(), This->base.dinput->evsequence++); + queue_event( iface, inst_id, wdata, GetCurrentTime(), impl->base.dinput->evsequence++ ); notify = TRUE; }
@@ -362,33 +353,33 @@ int dinput_mouse_hook( IDirectInputDevice8W *iface, WPARAM wparam, LPARAM lparam state->rgbButtons[1], state->rgbButtons[2], state->rgbButtons[3], state->rgbButtons[4], state->lX, state->lY, state->lZ );
- if (notify && This->base.hEvent) SetEvent( This->base.hEvent ); - LeaveCriticalSection(&This->base.crit); + if (notify && impl->base.hEvent) SetEvent( impl->base.hEvent ); + LeaveCriticalSection( &impl->base.crit ); return ret; }
-static void warp_check( SysMouseImpl* This, BOOL force ) +static void warp_check( struct mouse *impl, BOOL force ) { DWORD now = GetCurrentTime(); - const DWORD interval = This->clipped ? 500 : 10; + const DWORD interval = impl->clipped ? 500 : 10;
- if (force || (This->need_warp && (now - This->last_warped > interval))) + if (force || (impl->need_warp && (now - impl->last_warped > interval))) { RECT rect, new_rect; POINT mapped_center;
- This->last_warped = now; - This->need_warp = FALSE; - if (!GetClientRect(This->base.win, &rect)) return; - MapWindowPoints( This->base.win, 0, (POINT *)&rect, 2 ); - if (!This->clipped) + impl->last_warped = now; + impl->need_warp = FALSE; + if (!GetClientRect( impl->base.win, &rect )) return; + MapWindowPoints( impl->base.win, 0, (POINT *)&rect, 2 ); + if (!impl->clipped) { mapped_center.x = (rect.left + rect.right) / 2; mapped_center.y = (rect.top + rect.bottom) / 2; TRACE("Warping mouse to %d - %d\n", mapped_center.x, mapped_center.y); SetCursorPos( mapped_center.x, mapped_center.y ); } - if (This->base.dwCoopLevel & DISCL_EXCLUSIVE) + if (impl->base.dwCoopLevel & DISCL_EXCLUSIVE) { /* make sure we clip even if the window covers the whole screen */ rect.left = max( rect.left, GetSystemMetrics( SM_XVIRTUALSCREEN ) + 1 ); @@ -397,14 +388,14 @@ static void warp_check( SysMouseImpl* This, BOOL force ) rect.bottom = min( rect.bottom, rect.top + GetSystemMetrics( SM_CYVIRTUALSCREEN ) - 2 ); TRACE("Clipping mouse to %s\n", wine_dbgstr_rect( &rect )); ClipCursor( &rect ); - This->clipped = GetClipCursor( &new_rect ) && EqualRect( &rect, &new_rect ); + impl->clipped = GetClipCursor( &new_rect ) && EqualRect( &rect, &new_rect ); } } }
static HRESULT mouse_poll( IDirectInputDevice8W *iface ) { - SysMouseImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct mouse *impl = impl_from_IDirectInputDevice8W( iface ); check_dinput_events(); warp_check( impl, FALSE ); return DI_OK; @@ -412,7 +403,7 @@ static HRESULT mouse_poll( IDirectInputDevice8W *iface )
static HRESULT mouse_acquire( IDirectInputDevice8W *iface ) { - SysMouseImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct mouse *impl = impl_from_IDirectInputDevice8W( iface ); DIMOUSESTATE2 *state = (DIMOUSESTATE2 *)impl->base.device_state; POINT point;
@@ -456,7 +447,7 @@ static HRESULT mouse_acquire( IDirectInputDevice8W *iface )
static HRESULT mouse_unacquire( IDirectInputDevice8W *iface ) { - SysMouseImpl *impl = impl_from_IDirectInputDevice8W( iface ); + struct mouse *impl = impl_from_IDirectInputDevice8W( iface );
if (impl->base.dwCoopLevel & DISCL_EXCLUSIVE) {