Posted by
maxs on
May 30, 2012; 5:16am
URL: https://forum.jogamp.org/NEWT-KeyEvents-behaving-odd-in-Linux-tp4021912.html
Hey guys,
Love JOGL, thanks for your work on it.
I've got a problem using NEWT on Linux (Ubuntu 12.04). I've created a GLWindow using:
final GLProfile profile = GLProfile.get(GLProfile.GL2ES2);
final GLCapabilities capabilities = new GLCapabilities(profile);
gameWindow = GLWindow.create(capabilities);
However, I noticed something was odd with the KeyEvents. I added a TraceKeyListener to investigate:
gameWindow.addKeyListener(new TraceKeyAdapter());
And here is the output when I hold the key 'b' for a while without releasing:
KeyEvent[EVENT_KEY_PRESSED, code 66(0x42), char '?' (0xffff), isActionKey false, InputEvent[modifiers: 0x0, NEWTEvent[sys:false, source:jogamp.newt.driver.x11.X11Window, when:1338354727112 d 0ms]]]
KeyEvent[EVENT_KEY_RELEASED, code 66(0x42), char '?' (0xffff), isActionKey false, InputEvent[modifiers: 0x0, NEWTEvent[sys:false, source:jogamp.newt.driver.x11.X11Window, when:1338354727617 d 0ms]]]
KeyEvent[EVENT_KEY_TYPED, code 66(0x42), char 'b' (0x62), isActionKey false, InputEvent[modifiers: 0x0, NEWTEvent[sys:false, source:jogamp.newt.driver.x11.X11Window, when:1338354727617 d 0ms]]]
KeyEvent[EVENT_KEY_PRESSED, code 66(0x42), char '?' (0xffff), isActionKey false, InputEvent[modifiers: 0x0, NEWTEvent[sys:false, source:jogamp.newt.driver.x11.X11Window, when:1338354727618 d 0ms]]]
KeyEvent[EVENT_KEY_RELEASED, code 66(0x42), char '?' (0xffff), isActionKey false, InputEvent[modifiers: 0x0, NEWTEvent[sys:false, source:jogamp.newt.driver.x11.X11Window, when:1338354727638 d 1ms]]]
KeyEvent[EVENT_KEY_TYPED, code 66(0x42), char 'b' (0x62), isActionKey false, InputEvent[modifiers: 0x0, NEWTEvent[sys:false, source:jogamp.newt.driver.x11.X11Window, when:1338354727639 d 0ms]]]
KeyEvent[EVENT_KEY_PRESSED, code 66(0x42), char '?' (0xffff), isActionKey false, InputEvent[modifiers: 0x0, NEWTEvent[sys:false, source:jogamp.newt.driver.x11.X11Window, when:1338354727639 d 0ms]]]
KeyEvent[EVENT_KEY_RELEASED, code 66(0x42), char '?' (0xffff), isActionKey false, InputEvent[modifiers: 0x0, NEWTEvent[sys:false, source:jogamp.newt.driver.x11.X11Window, when:1338354727670 d 0ms]]]
KeyEvent[EVENT_KEY_TYPED, code 66(0x42), char 'b' (0x62), isActionKey false, InputEvent[modifiers: 0x0, NEWTEvent[sys:false, source:jogamp.newt.driver.x11.X11Window, when:1338354727671 d 0ms]]]
KeyEvent[EVENT_KEY_PRESSED, code 66(0x42), char '?' (0xffff), isActionKey false, InputEvent[modifiers: 0x0, NEWTEvent[sys:false, source:jogamp.newt.driver.x11.X11Window, when:1338354727671 d 0ms]]]
KeyEvent[EVENT_KEY_RELEASED, code 66(0x42), char '?' (0xffff), isActionKey false, InputEvent[modifiers: 0x0, NEWTEvent[sys:false, source:jogamp.newt.driver.x11.X11Window, when:1338354727682 d 0ms]]]
KeyEvent[EVENT_KEY_TYPED, code 66(0x42), char 'b' (0x62), isActionKey false, InputEvent[modifiers: 0x0, NEWTEvent[sys:false, source:jogamp.newt.driver.x11.X11Window, when:1338354727682 d 0ms]]]
FPS = 58
KeyEvent[EVENT_KEY_PRESSED, code 66(0x42), char '?' (0xffff), isActionKey false, InputEvent[modifiers: 0x0, NEWTEvent[sys:false, source:jogamp.newt.driver.x11.X11Window, when:1338354728608 d 0ms]]]
KeyEvent[EVENT_KEY_RELEASED, code 66(0x42), char '?' (0xffff), isActionKey false, InputEvent[modifiers: 0x0, NEWTEvent[sys:false, source:jogamp.newt.driver.x11.X11Window, when:1338354728933 d 0ms]]]
KeyEvent[EVENT_KEY_TYPED, code 66(0x42), char 'b' (0x62), isActionKey false, InputEvent[modifiers: 0x0, NEWTEvent[sys:false, source:jogamp.newt.driver.x11.X11Window, when:1338354728934 d 0ms]]]
To clarify: I am holding 'b' down, but I am getting consecutive Pressed/Released/Typed events. I'd instead expect to get only one set of Pressed/Released events (I am not sure what Typed event is). I am also confused about the char 0xffff events -- what's going on here?
Thank you very much for any help!
--
Max