Commit 7f9fb63a authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

dinput: Split dinput_unacquire_window_devices helper.

parent cde58336
......@@ -163,40 +163,50 @@ static void dinput_unacquire_window_devices( HWND window )
LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_device_list, struct dinput_device, entry )
{
if (!window || window == impl->win)
{
TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl );
dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED );
}
if (window != impl->win) continue;
TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl );
dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED );
}
LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_mouse_list, struct dinput_device, entry )
{
if (!window || window == impl->win)
{
TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl );
dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED );
}
if (window != impl->win) continue;
TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl );
dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED );
}
LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_rawmouse_list, struct dinput_device, entry )
{
if (!window || window == impl->win)
{
TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl );
dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED );
}
if (window != impl->win) continue;
TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl );
dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED );
}
LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_keyboard_list, struct dinput_device, entry )
{
if (!window || window == impl->win)
{
TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl );
dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED );
}
if (window != impl->win) continue;
TRACE( "%p window is not foreground - unacquiring %p\n", impl->win, impl );
dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED );
}
LeaveCriticalSection( &dinput_hook_crit );
}
static void dinput_unacquire_devices(void)
{
struct dinput_device *impl, *next;
EnterCriticalSection( &dinput_hook_crit );
LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_device_list, struct dinput_device, entry )
dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED );
LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_mouse_list, struct dinput_device, entry )
dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED );
LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_rawmouse_list, struct dinput_device, entry )
dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED );
LIST_FOR_EACH_ENTRY_SAFE( impl, next, &acquired_keyboard_list, struct dinput_device, entry )
dinput_device_internal_unacquire( &impl->IDirectInputDevice8W_iface, STATUS_UNACQUIRED );
LeaveCriticalSection( &dinput_hook_crit );
}
static LRESULT CALLBACK callwndproc_proc( int code, WPARAM wparam, LPARAM lparam )
{
CWPSTRUCT *msg = (CWPSTRUCT *)lparam;
......@@ -390,7 +400,7 @@ static DWORD WINAPI dinput_thread_proc( void *params )
if (state.running)
{
ERR( "Unexpected termination, ret %#lx\n", ret );
dinput_unacquire_window_devices( 0 );
dinput_unacquire_devices();
}
while (state.devices_count--) dinput_device_internal_release( state.devices[state.devices_count] );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment