Input system obtain-focus problem

I guess it is not common practice, but I learn a lot from running the jME test and sample programs as I code and document.  To do this, one needs to make the mouse visible in order to be able to edit in another window (at least, from my knowledge base, this is the only easy way to do it).  That works just fine, but if I additionally run in Windowed (as opposed to fullscreen) mode, I hit the following problem.  There is some bug in the input system to do with mouse position deltas when the jME app loses focus.  If you move your mouse out of the jME app and click on some other window, then when you click on your jME app again to give focus, the app thinks you have just jumped the mouse cursor from the exit point where you left the jME window earlier.  With SimpleGame or DebugGameState, simple or JMEDesktop, this usually results in changing the camera angle so drastically that you can no longer find what you were looking at and need to restart the app.



This  effects all jME apps, and I need a fix for my own games.  I'm focusing here on the demos because you can easily produce the problem with them.



I have an effective work-around, but I have to completely override the RelativeMouse class, since the effected code is in a private method.  I don't like doing this because it makes this class out-of-sync with the jME source code base.



My fix is just a hack that ignores mouse delta that are over X pixels for a single frame change.  I don't like this method, because I suppose a slow frame rate or fast hand could purposefully move the mouse that fast.  Could anybody advise of a better fix for this problem; or opine about the implications of my fix?  I have failed to understand the input system well enough to really fix this (I just noticed there's an article on the input system, but don't have time to study it now).  I'd like to get some fix in the jME code base so I won't have to maintain this work-around forever, plus there must be sombody else out there who would like their non-Windowed, visible-mouse-cursor game to not suffer from this problem.

just to get some ideas, another workaround would be to reset the dx/dy values even if the display is not active (in in foreground)


Index: src/com/jme/input/lwjgl/LWJGLMouseInput.java
===================================================================
--- src/com/jme/input/lwjgl/LWJGLMouseInput.java   (revision 4287)
+++ src/com/jme/input/lwjgl/LWJGLMouseInput.java   (working copy)
@@ -242,6 +242,9 @@
             }
             return;
          }
+        } else {
+            Mouse.getDX();
+            Mouse.getDY();
         }
 
       // clear events - could use a faster method in lwjgl here...