mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-01 09:50:52 +00:00
dinput: Combine all Release functionality into base class.
This commit is contained in:
parent
d2966c2dfb
commit
fb1082ae73
5 changed files with 24 additions and 138 deletions
|
@ -677,8 +677,21 @@ ULONG WINAPI IDirectInputDevice2AImpl_Release(LPDIRECTINPUTDEVICE8A iface)
|
||||||
ref = InterlockedDecrement(&(This->ref));
|
ref = InterlockedDecrement(&(This->ref));
|
||||||
if (ref) return ref;
|
if (ref) return ref;
|
||||||
|
|
||||||
DeleteCriticalSection(&This->crit);
|
IDirectInputDevice_Unacquire(iface);
|
||||||
|
/* Reset the FF state, free all effects, etc */
|
||||||
|
IDirectInputDevice8_SendForceFeedbackCommand(iface, DISFFC_RESET);
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, This->data_queue);
|
HeapFree(GetProcessHeap(), 0, This->data_queue);
|
||||||
|
|
||||||
|
/* Free data format */
|
||||||
|
HeapFree(GetProcessHeap(), 0, This->data_format.wine_df->rgodf);
|
||||||
|
HeapFree(GetProcessHeap(), 0, This->data_format.wine_df);
|
||||||
|
release_DataFormat(&This->data_format);
|
||||||
|
|
||||||
|
IDirectInput_Release((LPDIRECTINPUTDEVICE8A)This->dinput);
|
||||||
|
This->crit.DebugInfo->Spare[0] = 0;
|
||||||
|
DeleteCriticalSection(&This->crit);
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
|
|
||||||
return DI_OK;
|
return DI_OK;
|
||||||
|
@ -1173,9 +1186,8 @@ HRESULT WINAPI IDirectInputDevice2AImpl_SendForceFeedbackCommand(
|
||||||
LPDIRECTINPUTDEVICE8A iface,
|
LPDIRECTINPUTDEVICE8A iface,
|
||||||
DWORD dwFlags)
|
DWORD dwFlags)
|
||||||
{
|
{
|
||||||
FIXME("(this=%p,0x%08x): stub!\n",
|
TRACE("(%p) 0x%08x:\n", iface, dwFlags);
|
||||||
iface, dwFlags);
|
return DI_NOEFFECT;
|
||||||
return DI_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IDirectInputDevice2AImpl_EnumCreatedEffectObjects(
|
HRESULT WINAPI IDirectInputDevice2AImpl_EnumCreatedEffectObjects(
|
||||||
|
|
|
@ -631,45 +631,6 @@ const struct dinput_device joystick_linux_device = {
|
||||||
joydev_create_deviceW
|
joydev_create_deviceW
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* Joystick
|
|
||||||
*/
|
|
||||||
static ULONG WINAPI JoystickAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
|
|
||||||
{
|
|
||||||
JoystickImpl *This = (JoystickImpl *)iface;
|
|
||||||
ULONG ref;
|
|
||||||
|
|
||||||
ref = InterlockedDecrement(&This->base.ref);
|
|
||||||
if (ref)
|
|
||||||
return ref;
|
|
||||||
|
|
||||||
IDirectInputDevice_Unacquire(iface);
|
|
||||||
|
|
||||||
/* Free the device name */
|
|
||||||
HeapFree(GetProcessHeap(),0,This->name);
|
|
||||||
|
|
||||||
/* Free the axis map */
|
|
||||||
HeapFree(GetProcessHeap(),0,This->axis_map);
|
|
||||||
|
|
||||||
/* Free the data queue */
|
|
||||||
HeapFree(GetProcessHeap(), 0, This->base.data_queue);
|
|
||||||
|
|
||||||
/* Free the properties */
|
|
||||||
HeapFree(GetProcessHeap(), 0, This->props);
|
|
||||||
|
|
||||||
/* release the data transform filter */
|
|
||||||
HeapFree(GetProcessHeap(), 0, This->base.data_format.wine_df->rgodf);
|
|
||||||
HeapFree(GetProcessHeap(), 0, This->base.data_format.wine_df);
|
|
||||||
release_DataFormat(&This->base.data_format);
|
|
||||||
|
|
||||||
This->base.crit.DebugInfo->Spare[0] = 0;
|
|
||||||
IDirectInput_Release((LPDIRECTINPUTDEVICE8A)This->base.dinput);
|
|
||||||
DeleteCriticalSection(&This->base.crit);
|
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(),0,This);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Acquire : gets exclusive control of the joystick
|
* Acquire : gets exclusive control of the joystick
|
||||||
*/
|
*/
|
||||||
|
@ -1214,7 +1175,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt =
|
||||||
{
|
{
|
||||||
IDirectInputDevice2AImpl_QueryInterface,
|
IDirectInputDevice2AImpl_QueryInterface,
|
||||||
IDirectInputDevice2AImpl_AddRef,
|
IDirectInputDevice2AImpl_AddRef,
|
||||||
JoystickAImpl_Release,
|
IDirectInputDevice2AImpl_Release,
|
||||||
JoystickAImpl_GetCapabilities,
|
JoystickAImpl_GetCapabilities,
|
||||||
IDirectInputDevice2AImpl_EnumObjects,
|
IDirectInputDevice2AImpl_EnumObjects,
|
||||||
JoystickAImpl_GetProperty,
|
JoystickAImpl_GetProperty,
|
||||||
|
@ -1256,7 +1217,7 @@ static const IDirectInputDevice8WVtbl SysJoystickWvt =
|
||||||
{
|
{
|
||||||
IDirectInputDevice2WImpl_QueryInterface,
|
IDirectInputDevice2WImpl_QueryInterface,
|
||||||
XCAST(AddRef)IDirectInputDevice2AImpl_AddRef,
|
XCAST(AddRef)IDirectInputDevice2AImpl_AddRef,
|
||||||
XCAST(Release)JoystickAImpl_Release,
|
XCAST(Release)IDirectInputDevice2AImpl_Release,
|
||||||
XCAST(GetCapabilities)JoystickAImpl_GetCapabilities,
|
XCAST(GetCapabilities)JoystickAImpl_GetCapabilities,
|
||||||
IDirectInputDevice2WImpl_EnumObjects,
|
IDirectInputDevice2WImpl_EnumObjects,
|
||||||
XCAST(GetProperty)JoystickAImpl_GetProperty,
|
XCAST(GetProperty)JoystickAImpl_GetProperty,
|
||||||
|
|
|
@ -501,39 +501,6 @@ const struct dinput_device joystick_linuxinput_device = {
|
||||||
joydev_create_deviceW
|
joydev_create_deviceW
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* Joystick
|
|
||||||
*/
|
|
||||||
static ULONG WINAPI JoystickAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
|
|
||||||
{
|
|
||||||
JoystickImpl *This = (JoystickImpl *)iface;
|
|
||||||
ULONG ref;
|
|
||||||
|
|
||||||
ref = InterlockedDecrement(&This->base.ref);
|
|
||||||
if (ref)
|
|
||||||
return ref;
|
|
||||||
|
|
||||||
IDirectInputDevice_Unacquire(iface);
|
|
||||||
|
|
||||||
/* Reset the FF state, free all effects, etc */
|
|
||||||
IDirectInputDevice8_SendForceFeedbackCommand(iface, DISFFC_RESET);
|
|
||||||
|
|
||||||
/* Free the data queue */
|
|
||||||
HeapFree(GetProcessHeap(), 0, This->base.data_queue);
|
|
||||||
|
|
||||||
/* release the data transform filter */
|
|
||||||
HeapFree(GetProcessHeap(), 0, This->base.data_format.wine_df->rgodf);
|
|
||||||
HeapFree(GetProcessHeap(), 0, This->base.data_format.wine_df);
|
|
||||||
release_DataFormat(&This->base.data_format);
|
|
||||||
|
|
||||||
IDirectInput_Release((LPDIRECTINPUTDEVICE8A)This->base.dinput);
|
|
||||||
This->base.crit.DebugInfo->Spare[0] = 0;
|
|
||||||
DeleteCriticalSection(&This->base.crit);
|
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(),0,This);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Acquire : gets exclusive control of the joystick
|
* Acquire : gets exclusive control of the joystick
|
||||||
*/
|
*/
|
||||||
|
@ -1325,7 +1292,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt =
|
||||||
{
|
{
|
||||||
IDirectInputDevice2AImpl_QueryInterface,
|
IDirectInputDevice2AImpl_QueryInterface,
|
||||||
IDirectInputDevice2AImpl_AddRef,
|
IDirectInputDevice2AImpl_AddRef,
|
||||||
JoystickAImpl_Release,
|
IDirectInputDevice2AImpl_Release,
|
||||||
JoystickAImpl_GetCapabilities,
|
JoystickAImpl_GetCapabilities,
|
||||||
IDirectInputDevice2AImpl_EnumObjects,
|
IDirectInputDevice2AImpl_EnumObjects,
|
||||||
JoystickAImpl_GetProperty,
|
JoystickAImpl_GetProperty,
|
||||||
|
@ -1367,7 +1334,7 @@ static const IDirectInputDevice8WVtbl JoystickWvt =
|
||||||
{
|
{
|
||||||
IDirectInputDevice2WImpl_QueryInterface,
|
IDirectInputDevice2WImpl_QueryInterface,
|
||||||
XCAST(AddRef)IDirectInputDevice2AImpl_AddRef,
|
XCAST(AddRef)IDirectInputDevice2AImpl_AddRef,
|
||||||
XCAST(Release)JoystickAImpl_Release,
|
XCAST(Release)IDirectInputDevice2AImpl_Release,
|
||||||
XCAST(GetCapabilities)JoystickAImpl_GetCapabilities,
|
XCAST(GetCapabilities)JoystickAImpl_GetCapabilities,
|
||||||
IDirectInputDevice2WImpl_EnumObjects,
|
IDirectInputDevice2WImpl_EnumObjects,
|
||||||
XCAST(GetProperty)JoystickAImpl_GetProperty,
|
XCAST(GetProperty)JoystickAImpl_GetProperty,
|
||||||
|
|
|
@ -271,31 +271,6 @@ const struct dinput_device keyboard_device = {
|
||||||
keyboarddev_create_deviceW
|
keyboarddev_create_deviceW
|
||||||
};
|
};
|
||||||
|
|
||||||
static ULONG WINAPI SysKeyboardAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
|
|
||||||
{
|
|
||||||
SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
|
|
||||||
ULONG ref;
|
|
||||||
|
|
||||||
ref = InterlockedDecrement(&This->base.ref);
|
|
||||||
if (ref) return ref;
|
|
||||||
|
|
||||||
IDirectInputDevice_Unacquire(iface);
|
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, This->base.data_queue);
|
|
||||||
|
|
||||||
/* Free data format */
|
|
||||||
HeapFree(GetProcessHeap(), 0, This->base.data_format.wine_df->rgodf);
|
|
||||||
HeapFree(GetProcessHeap(), 0, This->base.data_format.wine_df);
|
|
||||||
release_DataFormat(&This->base.data_format);
|
|
||||||
|
|
||||||
IDirectInput_Release((LPDIRECTINPUTDEVICE8A)This->base.dinput);
|
|
||||||
This->base.crit.DebugInfo->Spare[0] = 0;
|
|
||||||
DeleteCriticalSection(&This->base.crit);
|
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
|
||||||
|
|
||||||
return DI_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI SysKeyboardAImpl_GetDeviceState(
|
static HRESULT WINAPI SysKeyboardAImpl_GetDeviceState(
|
||||||
LPDIRECTINPUTDEVICE8A iface,DWORD len,LPVOID ptr
|
LPDIRECTINPUTDEVICE8A iface,DWORD len,LPVOID ptr
|
||||||
)
|
)
|
||||||
|
@ -487,7 +462,7 @@ static const IDirectInputDevice8AVtbl SysKeyboardAvt =
|
||||||
{
|
{
|
||||||
IDirectInputDevice2AImpl_QueryInterface,
|
IDirectInputDevice2AImpl_QueryInterface,
|
||||||
IDirectInputDevice2AImpl_AddRef,
|
IDirectInputDevice2AImpl_AddRef,
|
||||||
SysKeyboardAImpl_Release,
|
IDirectInputDevice2AImpl_Release,
|
||||||
SysKeyboardAImpl_GetCapabilities,
|
SysKeyboardAImpl_GetCapabilities,
|
||||||
IDirectInputDevice2AImpl_EnumObjects,
|
IDirectInputDevice2AImpl_EnumObjects,
|
||||||
IDirectInputDevice2AImpl_GetProperty,
|
IDirectInputDevice2AImpl_GetProperty,
|
||||||
|
@ -529,7 +504,7 @@ static const IDirectInputDevice8WVtbl SysKeyboardWvt =
|
||||||
{
|
{
|
||||||
IDirectInputDevice2WImpl_QueryInterface,
|
IDirectInputDevice2WImpl_QueryInterface,
|
||||||
XCAST(AddRef)IDirectInputDevice2AImpl_AddRef,
|
XCAST(AddRef)IDirectInputDevice2AImpl_AddRef,
|
||||||
XCAST(Release)SysKeyboardAImpl_Release,
|
XCAST(Release)IDirectInputDevice2AImpl_Release,
|
||||||
XCAST(GetCapabilities)SysKeyboardAImpl_GetCapabilities,
|
XCAST(GetCapabilities)SysKeyboardAImpl_GetCapabilities,
|
||||||
IDirectInputDevice2WImpl_EnumObjects,
|
IDirectInputDevice2WImpl_EnumObjects,
|
||||||
XCAST(GetProperty)IDirectInputDevice2AImpl_GetProperty,
|
XCAST(GetProperty)IDirectInputDevice2AImpl_GetProperty,
|
||||||
|
|
|
@ -254,35 +254,6 @@ const struct dinput_device mouse_device = {
|
||||||
* SysMouseA (DInput Mouse support)
|
* SysMouseA (DInput Mouse support)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* Release : release the mouse buffer.
|
|
||||||
*/
|
|
||||||
static ULONG WINAPI SysMouseAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
|
|
||||||
{
|
|
||||||
SysMouseImpl *This = (SysMouseImpl *)iface;
|
|
||||||
ULONG ref;
|
|
||||||
|
|
||||||
ref = InterlockedDecrement(&This->base.ref);
|
|
||||||
if (ref)
|
|
||||||
return ref;
|
|
||||||
|
|
||||||
IDirectInputDevice_Unacquire(iface);
|
|
||||||
|
|
||||||
/* Free the data queue */
|
|
||||||
HeapFree(GetProcessHeap(), 0, This->base.data_queue);
|
|
||||||
|
|
||||||
/* Free data format */
|
|
||||||
HeapFree(GetProcessHeap(), 0, This->base.data_format.wine_df->rgodf);
|
|
||||||
HeapFree(GetProcessHeap(), 0, This->base.data_format.wine_df);
|
|
||||||
release_DataFormat(&This->base.data_format);
|
|
||||||
|
|
||||||
IDirectInput_Release((LPDIRECTINPUTDEVICE8A)This->base.dinput);
|
|
||||||
This->base.crit.DebugInfo->Spare[0] = 0;
|
|
||||||
DeleteCriticalSection(&This->base.crit);
|
|
||||||
HeapFree(GetProcessHeap(),0,This);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* low-level mouse hook */
|
/* low-level mouse hook */
|
||||||
static LRESULT CALLBACK dinput_mouse_hook( int code, WPARAM wparam, LPARAM lparam )
|
static LRESULT CALLBACK dinput_mouse_hook( int code, WPARAM wparam, LPARAM lparam )
|
||||||
{
|
{
|
||||||
|
@ -738,7 +709,7 @@ static const IDirectInputDevice8AVtbl SysMouseAvt =
|
||||||
{
|
{
|
||||||
IDirectInputDevice2AImpl_QueryInterface,
|
IDirectInputDevice2AImpl_QueryInterface,
|
||||||
IDirectInputDevice2AImpl_AddRef,
|
IDirectInputDevice2AImpl_AddRef,
|
||||||
SysMouseAImpl_Release,
|
IDirectInputDevice2AImpl_Release,
|
||||||
SysMouseAImpl_GetCapabilities,
|
SysMouseAImpl_GetCapabilities,
|
||||||
IDirectInputDevice2AImpl_EnumObjects,
|
IDirectInputDevice2AImpl_EnumObjects,
|
||||||
SysMouseAImpl_GetProperty,
|
SysMouseAImpl_GetProperty,
|
||||||
|
@ -780,7 +751,7 @@ static const IDirectInputDevice8WVtbl SysMouseWvt =
|
||||||
{
|
{
|
||||||
IDirectInputDevice2WImpl_QueryInterface,
|
IDirectInputDevice2WImpl_QueryInterface,
|
||||||
XCAST(AddRef)IDirectInputDevice2AImpl_AddRef,
|
XCAST(AddRef)IDirectInputDevice2AImpl_AddRef,
|
||||||
XCAST(Release)SysMouseAImpl_Release,
|
XCAST(Release)IDirectInputDevice2AImpl_Release,
|
||||||
XCAST(GetCapabilities)SysMouseAImpl_GetCapabilities,
|
XCAST(GetCapabilities)SysMouseAImpl_GetCapabilities,
|
||||||
IDirectInputDevice2WImpl_EnumObjects,
|
IDirectInputDevice2WImpl_EnumObjects,
|
||||||
XCAST(GetProperty)SysMouseAImpl_GetProperty,
|
XCAST(GetProperty)SysMouseAImpl_GetProperty,
|
||||||
|
|
Loading…
Reference in a new issue