dinput: Check acquired state in IDirectInputDevice2WImpl_SetCooperativeLevel.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0e75722971
commit
0686815ff6
|
@ -1118,6 +1118,7 @@ HRESULT WINAPI IDirectInputDevice2WImpl_SetDataFormat(LPDIRECTINPUTDEVICE8W ifac
|
||||||
HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8W iface, HWND hwnd, DWORD dwflags)
|
HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8W iface, HWND hwnd, DWORD dwflags)
|
||||||
{
|
{
|
||||||
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("(%p) %p,0x%08x\n", This, hwnd, dwflags);
|
TRACE("(%p) %p,0x%08x\n", This, hwnd, dwflags);
|
||||||
_dump_cooperativelevel_DI(dwflags);
|
_dump_cooperativelevel_DI(dwflags);
|
||||||
|
@ -1144,11 +1145,16 @@ HRESULT WINAPI IDirectInputDevice2WImpl_SetCooperativeLevel(LPDIRECTINPUTDEVICE8
|
||||||
|
|
||||||
/* Store the window which asks for the mouse */
|
/* Store the window which asks for the mouse */
|
||||||
EnterCriticalSection(&This->crit);
|
EnterCriticalSection(&This->crit);
|
||||||
This->win = hwnd;
|
if (This->acquired) hr = DIERR_ACQUIRED;
|
||||||
This->dwCoopLevel = dwflags;
|
else
|
||||||
|
{
|
||||||
|
This->win = hwnd;
|
||||||
|
This->dwCoopLevel = dwflags;
|
||||||
|
hr = DI_OK;
|
||||||
|
}
|
||||||
LeaveCriticalSection(&This->crit);
|
LeaveCriticalSection(&This->crit);
|
||||||
|
|
||||||
return DI_OK;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
|
|
@ -4082,7 +4082,6 @@ static void test_simple_joystick(void)
|
||||||
hr = IDirectInputDevice8_Acquire( device );
|
hr = IDirectInputDevice8_Acquire( device );
|
||||||
ok( hr == DI_OK, "IDirectInputDevice8_Acquire returned: %#x\n", hr );
|
ok( hr == DI_OK, "IDirectInputDevice8_Acquire returned: %#x\n", hr );
|
||||||
hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_FOREGROUND | DISCL_EXCLUSIVE );
|
hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_FOREGROUND | DISCL_EXCLUSIVE );
|
||||||
todo_wine
|
|
||||||
ok( hr == DIERR_ACQUIRED, "IDirectInputDevice8_SetCooperativeLevel returned: %#x\n", hr );
|
ok( hr == DIERR_ACQUIRED, "IDirectInputDevice8_SetCooperativeLevel returned: %#x\n", hr );
|
||||||
hr = IDirectInputDevice8_Unacquire( device );
|
hr = IDirectInputDevice8_Unacquire( device );
|
||||||
ok( hr == DI_OK, "IDirectInputDevice8_Unacquire returned: %#x\n", hr );
|
ok( hr == DI_OK, "IDirectInputDevice8_Unacquire returned: %#x\n", hr );
|
||||||
|
|
Loading…
Reference in New Issue