[INPUT] KeyListener has strange behaviour in 1.4.2

Hi

As Herkules noticed in my game (Castle Trouble) some days ago, my library has problems with catching keyboard events with VM 1.4.2.

At that time I was using J2SE 1.4.1_02 and all was OK, but now (only in Applet mode) with 1.4.2 sometime key events (key pressed or released) come after a while…

This is a piece of the Input class:


public class Input implements KeyListener,MouseListener,MouseMotionListener {
      
      ...
      
      public void keyPressed(KeyEvent e){
            changeKeyboardState(e,true);
            
            System.out.println("KEY Pressed: "+e.getKeyCode());
      }
      public void keyReleased(KeyEvent e){
            changeKeyboardState(e,false);
            System.out.println("KEY Released: "+e.getKeyCode());
      }
      public void keyTyped(KeyEvent e){
            
      }
      
      ...

}

As you can notice the same class intercepts Events from keyboard and mouse (maybe is this the problem?).

With J2SE 1.4.2 key events simply arrive late (the same time the relative string is printed out)…

Someone else have noticed this mulfunction of KeyListener Class?

[quote]As you can notice the same class intercepts Events from keyboard and mouse (maybe is this the problem?).
[/quote]
i don’t know what the problem is… but this in particular should have no effect.

yeah, i’ve encountered the problem of ‘stalled’ Event Delivery.
I’ve known about it since 1.4.0, but havn’t managed to work out what exactly was the cause.

It seems to only happen when I spawn my app. from within JCreator.
It also seems to only happen on Win98, and only when when running in Fullscreen using BufferStrategy.

I think its something to do with the Thread scheduler in Windows, because I can interrupt the ‘stall’ by opening and closing my CD drive. (which i gather sends an interrupt, which results in the Thread scheduler ‘fixing’ itself.)

A very peculiar bug.

[quote]It seems to only happen when I spawn my app. from within JCreator.
It also seems to only happen on Win98, and only when when running in Fullscreen using BufferStrategy.
[/quote]
Since not many users would be meeting these strict requirements to reproduce this problem, I suggest forgetting you ever discovered it ;D.

[quote]yeah, i’ve encountered the problem of ‘stalled’ Event Delivery.
I’ve known about it since 1.4.0, but havn’t managed to work out what exactly was the cause.

It seems to only happen when I spawn my app. from within JCreator.
It also seems to only happen on Win98, and only when when running in Fullscreen using BufferStrategy.

I think its something to do with the Thread scheduler in Windows, because I can interrupt the ‘stall’ by opening and closing my CD drive. (which i gather sends an interrupt, which results in the Thread scheduler ‘fixing’ itself.)

A very peculiar bug.
[/quote]
I don’t run from JCreator, simply build and run from a batch…

In standalone mode no problems, but with applets the problem is serious :frowning:
With previous versions all was OK (Mozilla 1.3 and Explorer 6.0), now with exactly the same code no way to get smooth event handling…

This happens with XP…
I’ll try on Win98se to see the result.