From 68045ce08f7b511107a19bf27679bef67dbaea88 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Wed, 12 Feb 2003 12:11:05 +0000 Subject: [PATCH] Don't allow the mouse to drift when failing poll --- src/native/win32/org_lwjgl_input_Mouse.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/native/win32/org_lwjgl_input_Mouse.cpp b/src/native/win32/org_lwjgl_input_Mouse.cpp index 2d5d820e..9d0b9ddf 100644 --- a/src/native/win32/org_lwjgl_input_Mouse.cpp +++ b/src/native/win32/org_lwjgl_input_Mouse.cpp @@ -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);