Don't allow the mouse to drift when failing poll

This commit is contained in:
Elias Naur 2003-02-12 12:11:05 +00:00
parent dcaaccc138
commit 68045ce08f
1 changed files with 6 additions and 3 deletions

View File

@ -266,9 +266,13 @@ void UpdateMouseFields() {
HRESULT hRes;
// get data from the Mouse
hRes = mDIDevice->GetDeviceState(sizeof(DIMOUSESTATE), &diMouseState);
hRes = mDIDevice->GetDeviceState(sizeof(DIMOUSESTATE), &diMouseState);
if (hRes != DI_OK) {
// Don't allow the mouse to drift when failed
diMouseState.lX = 0;
diMouseState.lY = 0;
diMouseState.lZ = 0;
// did the read fail because we lost input for some reason?
// if so, then attempt to reacquire.
if(hRes == DIERR_INPUTLOST || hRes == DIERR_NOTACQUIRED) {
@ -281,7 +285,6 @@ void UpdateMouseFields() {
printf("Error getting mouse state: %d\n", hRes);
#endif
}
return;
}
mEnvironment->SetStaticIntField(clsMouse, fidMDX, (jint) diMouseState.lX);