Hi When I switched to the latest aggregated build of April 11th 2013, almost all keys except keys for letters stopped working correctly. When I press F2, I get the virtual key corresponding to NUMPAD2. When I press '4' (not numpad 4), I get the virtual key corresponding to RIGHT. When I press '5', I get the virtual key corresponding to DOWN. When I press '1', I get the virtual key corresponding to UP. When I press F6, I get the virtual key corresponding to NUMPAD6. When I switch back to the build published April 4th 2013, it works anew: UP code 0x6F sym FF52 shifted FF52 char ' DOWN code 0x74 sym FF54 shifted FF54 char ' LEFT code 0x71 sym FF51 shifted FF51 char ' RIGHT code 0x72 sym FF53 shifted FF53 char ' NUMPAD6 code 0x55 sym FF98 shifted FFB6 char '6' javaUSkey US 0x27 NN 0x27 This bug is reproducible with JOGL build 974 too. Using getKeyCode() or getKeySymbol() doesn't help.
Compiling Ardor3D and my own program with different versions of JOGL 2 was a bad idea as VK values have changed (except those for letters?). My bug report is probably invalid, I will check that tonight.
It works now. Using several versions of JOGL at the same time was a bad idea.
There is still a problem with arrows in the latest aggregated build (April 25th 2013) under Windows.
Someone has just reported that it doesn't work at all under Windows XP whereas it partially works under Windows 7.
I get this under Windows 7: consumeKeyEvent: KeyEvent[EVENT_KEY_PRESSED, code 0x0, sym 0x95, char ' ' (0x0), printable false, modifier false, action true, InputEvent[modifiers: [], NEWTEvent[source:jogamp.newt.driver.windows.WindowDriver, consumed false, when:1367261180570 d 0ms]]] I get the same log for other arrows bt with sym between 96 and 98.
The key symbol is wrong under GNU Linux when I press the numpad keys but the key char is correct: consumeKeyEvent: KeyEvent[EVENT_KEY_PRESSED, code 0x96, sym 0x96, char '8' (0x38), printable false, modifier false, action true, InputEvent[modifiers: [], NEWTEvent[source:jogamp.newt.driver.x11.WindowDriver, consumed false, when:1367267402711 d 0ms]]] consumeKeyEvent: KeyEvent[EVENT_KEY_RELEASED, code 0x96, sym 0x96, char '8' (0x38), printable false, modifier false, action true, InputEvent[modifiers: [], NEWTEvent[source:jogamp.newt.driver.x11.WindowDriver, consumed false, when:1367267402803 d 0ms]]] consumeKeyEvent: KeyEvent[EVENT_KEY_PRESSED, code 0x98, sym 0x98, char '2' (0x32), printable false, modifier false, action true, InputEvent[modifiers: [], NEWTEvent[source:jogamp.newt.driver.x11.WindowDriver, consumed false, when:1367267412651 d 0ms]]] consumeKeyEvent: KeyEvent[EVENT_KEY_RELEASED, code 0x98, sym 0x98, char '2' (0x32), printable false, modifier false, action true, InputEvent[modifiers: [], NEWTEvent[source:jogamp.newt.driver.x11.WindowDriver, consumed false, when:1367267412826 d 0ms]]] consumeKeyEvent: KeyEvent[EVENT_KEY_PRESSED, code 0x95, sym 0x95, char '4' (0x34), printable false, modifier false, action true, InputEvent[modifiers: [], NEWTEvent[source:jogamp.newt.driver.x11.WindowDriver, consumed false, when:1367267413749 d 0ms]]] consumeKeyEvent: KeyEvent[EVENT_KEY_RELEASED, code 0x95, sym 0x95, char '4' (0x34), printable false, modifier false, action true, InputEvent[modifiers: [], NEWTEvent[source:jogamp.newt.driver.x11.WindowDriver, consumed false, when:1367267413925 d 0ms]]] consumeKeyEvent: KeyEvent[EVENT_KEY_PRESSED, code 0x97, sym 0x97, char '6' (0x36), printable false, modifier false, action true, InputEvent[modifiers: [], NEWTEvent[source:jogamp.newt.driver.x11.WindowDriver, consumed false, when:1367267414254 d 0ms]]] consumeKeyEvent: KeyEvent[EVENT_KEY_RELEASED, code 0x97, sym 0x97, char '6' (0x36), printable false, modifier false, action true, InputEvent[modifiers: [], NEWTEvent[source:jogamp.newt.driver.x11.WindowDriver, consumed false, when:1367267414422 d 0ms]]]
The key symbols of numpad keys '2', '4', '6' and '8' are the same than those of the arrow keys under GNU Linux which is a wrong behaviour: consumeKeyEvent: KeyEvent[EVENT_KEY_PRESSED, code 0x95, sym 0x95, char ' consumeKeyEvent: KeyEvent[EVENT_KEY_RELEASED, code 0x95, sym 0x95, char ' consumeKeyEvent: KeyEvent[EVENT_KEY_PRESSED, code 0x96, sym 0x96, char ' consumeKeyEvent: KeyEvent[EVENT_KEY_RELEASED, code 0x96, sym 0x96, char ' consumeKeyEvent: KeyEvent[EVENT_KEY_PRESSED, code 0x97, sym 0x97, char ' consumeKeyEvent: KeyEvent[EVENT_KEY_RELEASED, code 0x97, sym 0x97, char ' consumeKeyEvent: KeyEvent[EVENT_KEY_PRESSED, code 0x98, sym 0x98, char ' consumeKeyEvent: KeyEvent[EVENT_KEY_RELEASED, code 0x98, sym 0x98, char ' NUMPAD keys '1', '3', '7' and '9' seem to work: consumeKeyEvent: KeyEvent[EVENT_KEY_PRESSED, code 0x3, sym 0x3, char '1' (0x31), printable false, modifier false, action true, InputEvent[modifiers: [], NEWTEvent[source:jogamp.newt.driver.x11.WindowDriver, consumed false, when:1367267920557 d 0ms]]] consumeKeyEvent: KeyEvent[EVENT_KEY_RELEASED, code 0x3, sym 0x3, char '1' (0x31), printable false, modifier false, action true, InputEvent[modifiers: [], NEWTEvent[source:jogamp.newt.driver.x11.WindowDriver, consumed false, when:1367267920639 d 1ms]]] consumeKeyEvent: KeyEvent[EVENT_KEY_PRESSED, code 0xb, sym 0xb, char '3' (0x33), printable false, modifier false, action true, InputEvent[modifiers: [], NEWTEvent[source:jogamp.newt.driver.x11.WindowDriver, consumed false, when:1367267920816 d 0ms]]] consumeKeyEvent: KeyEvent[EVENT_KEY_RELEASED, code 0xb, sym 0xb, char '3' (0x33), printable false, modifier false, action true, InputEvent[modifiers: [], NEWTEvent[source:jogamp.newt.driver.x11.WindowDriver, consumed false, when:1367267920918 d 1ms]]] consumeKeyEvent: KeyEvent[EVENT_KEY_PRESSED, code 0x2, sym 0x2, char '7' (0x37), printable false, modifier false, action true, InputEvent[modifiers: [], NEWTEvent[source:jogamp.newt.driver.x11.WindowDriver, consumed false, when:1367267921487 d 0ms]]] consumeKeyEvent: KeyEvent[EVENT_KEY_RELEASED, code 0x2, sym 0x2, char '7' (0x37), printable false, modifier false, action true, InputEvent[modifiers: [], NEWTEvent[source:jogamp.newt.driver.x11.WindowDriver, consumed false, when:1367267921583 d 0ms]]] consumeKeyEvent: KeyEvent[EVENT_KEY_PRESSED, code 0x10, sym 0x10, char '9' (0x39), printable false, modifier false, action true, InputEvent[modifiers: [], NEWTEvent[source:jogamp.newt.driver.x11.WindowDriver, consumed false, when:1367267921780 d 0ms]]] consumeKeyEvent: KeyEvent[EVENT_KEY_RELEASED, code 0x10, sym 0x10, char '9' (0x39), printable false, modifier false, action true, InputEvent[modifiers: [], NEWTEvent[source:jogamp.newt.driver.x11.WindowDriver, consumed false, when:1367267921862 d 0ms]]]
I get that when pressing NUMPAD '2' under Windows 7 (it seems to be correct): consumeKeyEvent: KeyEvent[EVENT_KEY_PRESSED, code 0x98, sym 0x82, char '2' (0x32), printable false, modifier false, action true, InputEvent[modifiers: [], NEWTEvent[source:jogamp.newt.driver.windows.WindowDriver, consumed false, when:1367271878399 d 0ms]]] WindowsWindow: surface change 0x7d010eea -> 0x2d010eaa WindowsWindow: surface change 0x2d010eaa -> 0x7d010eea WindowsWindow: surface change 0x7d010eea -> 0x2d010eaa WindowsWindow: surface change 0x2d010eaa -> 0xffffffff9f010e45 consumeKeyEvent: KeyEvent[EVENT_KEY_RELEASED, code 0x98, sym 0x82, char '2' (0x32), printable false, modifier false, action true, InputEvent[modifiers: [], NEWTEvent[source:jogamp.newt.driver.windows.WindowDriver, consumed false, when:1367271878486 d 0ms]]] The key symbol and the key char are correct.
In X11Display.c here: https://github.com/sgothel/jogl/blob/master/src/newt/native/X11Display.c#L125 XK_Left and XK_KP_Left are mapped to J_VK_LEFT whereas the second one should be mapped to VK_KP_LEFT. The current (incorrect?) behaviour is the same than Chromium's one: http://src.chromium.org/svn/trunk/src/ui/base/keycodes/keyboard_code_conversion_x.cc I will test with a QWERTY keyboard under Mac OS X too.
This pull request partially fixes the bug under Linux: https://github.com/sgothel/jogl/pull/64
We should rather add a "keyLocation" field or duplicated virtual keys for the numeric keypad into KeyEvent in order to be able to make a distinction between keys originated with the numerical keypad and others.
Another solution consists in removing VK_KP_* constants and using only VK_NUMPAD* constants.
(In reply to comment #12) > Another solution consists in removing VK_KP_* constants and using only > VK_NUMPAD* constants. Yes, I will remove the VK_KP_* cursor keys, since they are not consistently supported on all platforms (Windows) or X11 configurations.
(In reply to comment #13) > (In reply to comment #12) > > Another solution consists in removing VK_KP_* constants and using only > > VK_NUMPAD* constants. > > Yes, I will remove the VK_KP_* cursor keys, since they are > not consistently supported on all platforms (Windows) > or X11 configurations. That's ok for me :)
- KeyEvent keyCode/keySym values re-ordered! - Remove VK_KP_<Cursor> numpad key-codes, use general VK_<Cursor> key-codes. Numpad cursor keys are not supported on some platforms (Windows), or not configured on most X11 configurations. - Respect numpad printable keys, i.e. don't treat them as non-printable. - Use keySym for numpad if possible. Numpad keys require modifiers, hence X11 and Windows shall return keySym.