mirror of
https://github.com/reactos/wine.git
synced 2024-11-26 13:10:28 +00:00
dinput: Acquire should not reset buffer position.
This commit is contained in:
parent
157528eb0f
commit
1a56be85be
@ -791,10 +791,7 @@ HRESULT WINAPI IDirectInputDevice2WImpl_Acquire(LPDIRECTINPUTDEVICE8W 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;
|
||||
|
@ -72,6 +72,9 @@ static void test_acquire(LPDIRECTINPUT pDI, HWND hwnd)
|
||||
LPDIRECTINPUTDEVICE pMouse = NULL;
|
||||
DIMOUSESTATE m_state;
|
||||
HWND hwnd2;
|
||||
DIPROPDWORD di_op;
|
||||
DIDEVICEOBJECTDATA mouse_state;
|
||||
DWORD cnt;
|
||||
|
||||
if (! SetForegroundWindow(hwnd))
|
||||
{
|
||||
@ -86,6 +89,14 @@ static void test_acquire(LPDIRECTINPUT pDI, HWND hwnd)
|
||||
hr = IDirectInputDevice_SetCooperativeLevel(pMouse, hwnd, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND);
|
||||
ok(hr == S_OK, "SetCooperativeLevel: %08x\n", hr);
|
||||
|
||||
memset(&di_op, 0, sizeof(di_op));
|
||||
di_op.dwData = 20;
|
||||
di_op.diph.dwHow = DIPH_DEVICE;
|
||||
di_op.diph.dwSize = sizeof(DIPROPDWORD);
|
||||
di_op.diph.dwHeaderSize = sizeof(DIPROPHEADER);
|
||||
hr = IDirectInputDevice_SetProperty(pMouse, DIPROP_BUFFERSIZE, (LPCDIPROPHEADER)&di_op);
|
||||
ok(hr == S_OK, "SetProperty() failed: %08x\n", hr);
|
||||
|
||||
hr = IDirectInputDevice_SetDataFormat(pMouse, &c_dfDIMouse);
|
||||
ok(SUCCEEDED(hr), "IDirectInputDevice_SetDataFormat() failed: %08x\n", hr);
|
||||
hr = IDirectInputDevice_Unacquire(pMouse);
|
||||
@ -113,6 +124,25 @@ static void test_acquire(LPDIRECTINPUT pDI, HWND hwnd)
|
||||
hr = IDirectInputDevice_Acquire(pMouse);
|
||||
ok(hr == S_OK, "Acquire() failed: %08x\n", hr);
|
||||
|
||||
mouse_event(MOUSEEVENTF_MOVE, 10, 10, 0, 0);
|
||||
cnt = 1;
|
||||
hr = IDirectInputDevice_GetDeviceData(pMouse, sizeof(mouse_state), &mouse_state, &cnt, 0);
|
||||
ok(hr == S_OK && cnt > 0, "GetDeviceData() failed: %08x cnt:%d\n", hr, cnt);
|
||||
|
||||
mouse_event(MOUSEEVENTF_MOVE, 10, 10, 0, 0);
|
||||
IDirectInputDevice_Unacquire(pMouse);
|
||||
cnt = 1;
|
||||
hr = IDirectInputDevice_GetDeviceData(pMouse, sizeof(mouse_state), &mouse_state, &cnt, 0);
|
||||
ok(hr == S_OK && cnt > 0, "GetDeviceData() failed: %08x cnt:%d\n", hr, cnt);
|
||||
|
||||
IDirectInputDevice_Acquire(pMouse);
|
||||
mouse_event(MOUSEEVENTF_MOVE, 10, 10, 0, 0);
|
||||
IDirectInputDevice_Unacquire(pMouse);
|
||||
IDirectInputDevice_Acquire(pMouse);
|
||||
cnt = 1;
|
||||
hr = IDirectInputDevice_GetDeviceData(pMouse, sizeof(mouse_state), &mouse_state, &cnt, 0);
|
||||
ok(hr == S_OK && cnt > 0, "GetDeviceData() failed: %08x cnt:%d\n", hr, cnt);
|
||||
|
||||
if (pMouse) IUnknown_Release(pMouse);
|
||||
|
||||
DestroyWindow( hwnd2 );
|
||||
|
Loading…
Reference in New Issue
Block a user