Commit 97d848aa authored by Raphael Junqueira's avatar Raphael Junqueira Committed by Alexandre Julliard

- use WINE_DINPUT_KEYBOARD_MAX_KEYS instead hard-coded 256 value

- better use of critical section - some cleanup to better understand code paths - logic correction on SetWindowsHookExA/UnhookWindowsHookEx on keyboard.
parent 10a605b0
......@@ -579,11 +579,14 @@ static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
{
SysMouseImpl *This = (SysMouseImpl *)iface;
RECT rect;
POINT point;
TRACE("(this=%p)\n",This);
if (This->acquired == 0) {
POINT point;
if (This->acquired)
return S_FALSE;
This->acquired = 1;
/* Store (in a global variable) the current lock */
current_lock = (IDirectInputDevice8A*)This;
......@@ -629,10 +632,7 @@ static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
#endif
}
This->acquired = 1;
return DI_OK;
}
return S_FALSE;
}
/******************************************************************************
......@@ -644,7 +644,10 @@ static HRESULT WINAPI SysMouseAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
TRACE("(this=%p)\n",This);
if (This->acquired) {
if (0 == This->acquired) {
return DI_NOEFFECT;
}
/* Reinstall previous mouse event handler */
if (This->hook) {
UnhookWindowsHookEx( This->hook );
......@@ -655,7 +658,10 @@ static HRESULT WINAPI SysMouseAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
}
/* No more locks */
if (current_lock == (IDirectInputDevice8A*) This)
current_lock = NULL;
else
ERR("this(%p) != current_lock(%p)\n", This, current_lock);
/* Unacquire device */
This->acquired = 0;
......@@ -665,9 +671,6 @@ static HRESULT WINAPI SysMouseAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
TRACE(" warping mouse back to (%ld , %ld)\n", This->org_coords.x, This->org_coords.y);
SetCursorPos(This->org_coords.x, This->org_coords.y);
}
} else {
return DI_NOEFFECT;
}
return DI_OK;
}
......
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