dinput: Rename set_dinput_hook and call it from the base class.
Since keyboard's acquire and unacquire don't do anything special just call the base class.
This commit is contained in:
parent
deb74efc04
commit
8f28d4369e
|
@ -563,7 +563,10 @@ HRESULT WINAPI IDirectInputDevice2AImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
|
|||
res = This->acquired ? S_FALSE : DI_OK;
|
||||
This->acquired = 1;
|
||||
if (res == DI_OK)
|
||||
{
|
||||
This->queue_head = This->queue_tail = This->overflow = 0;
|
||||
check_dinput_hooks(iface);
|
||||
}
|
||||
LeaveCriticalSection(&This->crit);
|
||||
|
||||
return res;
|
||||
|
@ -581,6 +584,8 @@ HRESULT WINAPI IDirectInputDevice2AImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
|
|||
EnterCriticalSection(&This->crit);
|
||||
res = !This->acquired ? DI_NOEFFECT : DI_OK;
|
||||
This->acquired = 0;
|
||||
if (res == DI_OK)
|
||||
check_dinput_hooks(iface);
|
||||
LeaveCriticalSection(&This->crit);
|
||||
|
||||
return res;
|
||||
|
|
|
@ -854,12 +854,12 @@ static BOOL check_hook_thread(void)
|
|||
return hook_thread_hwnd != 0;
|
||||
}
|
||||
|
||||
HHOOK set_dinput_hook(int hook_id, LPVOID proc)
|
||||
void check_dinput_hooks(LPDIRECTINPUTDEVICE8A iface)
|
||||
{
|
||||
HWND hwnd;
|
||||
|
||||
EnterCriticalSection(&dinput_hook_crit);
|
||||
hwnd = hook_thread_hwnd;
|
||||
LeaveCriticalSection(&dinput_hook_crit);
|
||||
return (HHOOK)SendMessageW(hwnd, WM_USER+0x10, (WPARAM)hook_id, (LPARAM)proc);
|
||||
SendMessageW(hwnd, WM_USER+0x10, 1, 0);
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ extern const struct dinput_device joystick_linuxinput_device;
|
|||
|
||||
extern HINSTANCE DINPUT_instance;
|
||||
|
||||
extern HHOOK set_dinput_hook(int hook_id, LPVOID proc);
|
||||
extern void check_dinput_hooks(LPDIRECTINPUTDEVICE8A);
|
||||
typedef void (*DI_EVENT_PROC)(LPDIRECTINPUTDEVICE8A, WPARAM, LPARAM);
|
||||
|
||||
#endif /* __WINE_DLLS_DINPUT_DINPUT_PRIVATE_H */
|
||||
|
|
|
@ -287,36 +287,6 @@ static HRESULT WINAPI SysKeyboardAImpl_GetDeviceState(
|
|||
return DI_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI SysKeyboardAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface);
|
||||
|
||||
static HRESULT WINAPI SysKeyboardAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
|
||||
{
|
||||
SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
|
||||
HRESULT res;
|
||||
|
||||
TRACE("(%p)\n",This);
|
||||
|
||||
if ((res = IDirectInputDevice2AImpl_Acquire(iface)) != DI_OK) return res;
|
||||
|
||||
set_dinput_hook(WH_KEYBOARD_LL, KeyboardCallback);
|
||||
|
||||
return DI_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI SysKeyboardAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
|
||||
{
|
||||
SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
|
||||
HRESULT res;
|
||||
|
||||
TRACE("(this=%p)\n",This);
|
||||
|
||||
if ((res = IDirectInputDevice2AImpl_Unacquire(iface)) != DI_OK) return res;
|
||||
|
||||
set_dinput_hook(WH_KEYBOARD_LL, NULL);
|
||||
|
||||
return DI_OK;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* GetCapabilities : get the device capablitites
|
||||
*/
|
||||
|
@ -442,8 +412,8 @@ static const IDirectInputDevice8AVtbl SysKeyboardAvt =
|
|||
IDirectInputDevice2AImpl_EnumObjects,
|
||||
IDirectInputDevice2AImpl_GetProperty,
|
||||
IDirectInputDevice2AImpl_SetProperty,
|
||||
SysKeyboardAImpl_Acquire,
|
||||
SysKeyboardAImpl_Unacquire,
|
||||
IDirectInputDevice2AImpl_Acquire,
|
||||
IDirectInputDevice2AImpl_Unacquire,
|
||||
SysKeyboardAImpl_GetDeviceState,
|
||||
IDirectInputDevice2AImpl_GetDeviceData,
|
||||
IDirectInputDevice2AImpl_SetDataFormat,
|
||||
|
@ -484,8 +454,8 @@ static const IDirectInputDevice8WVtbl SysKeyboardWvt =
|
|||
IDirectInputDevice2WImpl_EnumObjects,
|
||||
XCAST(GetProperty)IDirectInputDevice2AImpl_GetProperty,
|
||||
XCAST(SetProperty)IDirectInputDevice2AImpl_SetProperty,
|
||||
XCAST(Acquire)SysKeyboardAImpl_Acquire,
|
||||
XCAST(Unacquire)SysKeyboardAImpl_Unacquire,
|
||||
XCAST(Acquire)IDirectInputDevice2AImpl_Acquire,
|
||||
XCAST(Unacquire)IDirectInputDevice2AImpl_Unacquire,
|
||||
XCAST(GetDeviceState)SysKeyboardAImpl_GetDeviceState,
|
||||
XCAST(GetDeviceData)IDirectInputDevice2AImpl_GetDeviceData,
|
||||
XCAST(SetDataFormat)IDirectInputDevice2AImpl_SetDataFormat,
|
||||
|
|
|
@ -398,7 +398,6 @@ static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
|
|||
/* Install our mouse hook */
|
||||
if (This->base.dwCoopLevel & DISCL_EXCLUSIVE)
|
||||
ShowCursor(FALSE); /* hide cursor */
|
||||
set_dinput_hook(WH_MOUSE_LL, dinput_mouse_hook);
|
||||
|
||||
/* Get the window dimension and find the center */
|
||||
GetWindowRect(This->base.win, &rect);
|
||||
|
@ -433,7 +432,6 @@ static HRESULT WINAPI SysMouseAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
|
|||
|
||||
if ((res = IDirectInputDevice2AImpl_Unacquire(iface)) != DI_OK) return res;
|
||||
|
||||
set_dinput_hook(WH_MOUSE_LL, NULL);
|
||||
if (This->base.dwCoopLevel & DISCL_EXCLUSIVE)
|
||||
ShowCursor(TRUE); /* show cursor */
|
||||
|
||||
|
|
Loading…
Reference in New Issue