Issue Details (XML | Word | Printable)

Key: GIVE_CHALLENGE-8
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: akoller
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
give-challenge

Moves and turns continue forever if client loses focus

Created: 06/Oct/09 09:19 AM   Updated: 11/Jan/10 01:11 PM
Component/s: Client
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

Tags:


 Description  « Hide

If the 3D client loses focus while the user is moving or turning, it will continue moving or turning forever. Pressing the key for turning in the opposite direction will stop the spinning
while the key is held down; once it is released, the spinning resumes. The correct behavior would be to stop the motion when the 3D client loses focus.



akoller added a comment - 11/Jan/10 01:11 PM

I have looked at this bug in some more detail, and have discovered the following:

  • We can detect whether the window loses focus with DisplaySystem.getDisplaySystem().isActive(). However, the KeyboardInputHandlerDevice keeps generating new keystroke events while the focus is gone and also once it has been regained. This means that although we can temporarily suppress the movement while we don't have the focus if we only move the camera if we currently have focus, the movement will resume once we regain the focus.
  • We can't recognize whether two events belong to the same chain of repeated events or not, because each gets its own timestamp, and none of them have "pressed" set to true.
  • Theoretically, the LWJGLKeyInput class in jME 2 checks for whether we're losing focus, and clears the keyboard event queue when this happens (see update method there). But this just somehow doesn't seem to happen for some reason.

So we'll live with the bug for now.