dinput: Let each device decide which hook event to skip.
Some programs acquire mouse in exclusive and keyboard in non-exclusive mode.
This commit is contained in:
parent
6f73f1bdbb
commit
74f2eccc90
|
@ -899,8 +899,7 @@ static LRESULT CALLBACK LL_hook_proc( int code, WPARAM wparam, LPARAM lparam )
|
|||
if (dev->acquired && dev->event_proc)
|
||||
{
|
||||
TRACE("calling %p->%p (%lx %lx)\n", dev, dev->event_proc, wparam, lparam);
|
||||
dev->event_proc( (LPDIRECTINPUTDEVICE8A)dev, wparam, lparam );
|
||||
skip |= dev->dwCoopLevel & DISCL_EXCLUSIVE;
|
||||
skip |= dev->event_proc( (LPDIRECTINPUTDEVICE8A)dev, wparam, lparam );
|
||||
}
|
||||
LeaveCriticalSection( &dinput->crit );
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ extern const struct dinput_device joystick_linux_device;
|
|||
extern const struct dinput_device joystick_linuxinput_device;
|
||||
|
||||
extern void check_dinput_hooks(LPDIRECTINPUTDEVICE8A);
|
||||
typedef void (*DI_EVENT_PROC)(LPDIRECTINPUTDEVICE8A, WPARAM, LPARAM);
|
||||
typedef int (*DI_EVENT_PROC)(LPDIRECTINPUTDEVICE8A, WPARAM, LPARAM);
|
||||
|
||||
extern void _dump_diactionformatA(LPDIACTIONFORMATA);
|
||||
|
||||
|
|
|
@ -74,16 +74,16 @@ static BYTE map_dik_code(DWORD scanCode, DWORD vkCode)
|
|||
return out_code;
|
||||
}
|
||||
|
||||
static void KeyboardCallback( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam )
|
||||
static int KeyboardCallback( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam )
|
||||
{
|
||||
SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
|
||||
int dik_code;
|
||||
int dik_code, ret = This->base.dwCoopLevel & DISCL_EXCLUSIVE;
|
||||
KBDLLHOOKSTRUCT *hook = (KBDLLHOOKSTRUCT *)lparam;
|
||||
BYTE new_diks;
|
||||
|
||||
if (wparam != WM_KEYDOWN && wparam != WM_KEYUP &&
|
||||
wparam != WM_SYSKEYDOWN && wparam != WM_SYSKEYUP)
|
||||
return;
|
||||
return 0;
|
||||
|
||||
TRACE("(%p) %ld,%ld\n", iface, wparam, lparam);
|
||||
|
||||
|
@ -96,15 +96,17 @@ static void KeyboardCallback( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM
|
|||
|
||||
/* returns now if key event already known */
|
||||
if (new_diks == This->DInputKeyState[dik_code])
|
||||
return;
|
||||
return ret;
|
||||
|
||||
This->DInputKeyState[dik_code] = new_diks;
|
||||
TRACE(" setting %02X to %02X\n", dik_code, This->DInputKeyState[dik_code]);
|
||||
|
||||
|
||||
dik_code = id_to_offset(&This->base.data_format, DIDFT_MAKEINSTANCE(dik_code) | DIDFT_PSHBUTTON);
|
||||
EnterCriticalSection(&This->base.crit);
|
||||
queue_event((LPDIRECTINPUTDEVICE8A)This, dik_code, new_diks, hook->time, This->base.dinput->evsequence++);
|
||||
LeaveCriticalSection(&This->base.crit);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
const GUID DInput_Wine_Keyboard_GUID = { /* 0ab8648a-7735-11d2-8c73-71df54a96441 */
|
||||
|
|
|
@ -78,7 +78,7 @@ struct SysMouseImpl
|
|||
WARP_MOUSE warp_override;
|
||||
};
|
||||
|
||||
static void dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam );
|
||||
static int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam );
|
||||
|
||||
const GUID DInput_Wine_Mouse_GUID = { /* 9e573ed8-7734-11d2-8d4a-23903fb6bdf7 */
|
||||
0x9e573ed8, 0x7734, 0x11d2, {0x8d, 0x4a, 0x23, 0x90, 0x3f, 0xb6, 0xbd, 0xf7}
|
||||
|
@ -286,17 +286,18 @@ const struct dinput_device mouse_device = {
|
|||
*/
|
||||
|
||||
/* low-level mouse hook */
|
||||
static void dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam )
|
||||
static int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam )
|
||||
{
|
||||
MSLLHOOKSTRUCT *hook = (MSLLHOOKSTRUCT *)lparam;
|
||||
SysMouseImpl* This = (SysMouseImpl*) iface;
|
||||
DWORD dwCoop;
|
||||
int wdata = 0, inst_id = -1;
|
||||
int wdata = 0, inst_id = -1, ret;
|
||||
|
||||
TRACE("msg %lx @ (%d %d)\n", wparam, hook->pt.x, hook->pt.y);
|
||||
|
||||
EnterCriticalSection(&This->base.crit);
|
||||
dwCoop = This->base.dwCoopLevel;
|
||||
ret = dwCoop & DISCL_EXCLUSIVE;
|
||||
|
||||
switch(wparam) {
|
||||
case WM_MOUSEMOVE:
|
||||
|
@ -370,6 +371,8 @@ static void dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARA
|
|||
inst_id = DIDFT_MAKEINSTANCE(WINE_MOUSE_BUTTONS_INSTANCE + 2 + HIWORD(hook->mouseData)) | DIDFT_PSHBUTTON;
|
||||
This->m_state.rgbButtons[2 + HIWORD(hook->mouseData)] = wdata = 0x00;
|
||||
break;
|
||||
default:
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -381,6 +384,7 @@ static void dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARA
|
|||
}
|
||||
|
||||
LeaveCriticalSection(&This->base.crit);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static BOOL dinput_window_check(SysMouseImpl* This) {
|
||||
|
|
Loading…
Reference in New Issue