From ae89ca7342b8673e38b7d76bff386175e84a9173 Mon Sep 17 00:00:00 2001 From: Xerxes Rånby Date: Thu, 31 Jan 2013 16:47:06 +0100 Subject: LinuxEventDeviceTracker: Map printable char using KeyEvent.isPrintableKey. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The NEWT VK namespace tries to map keyCodes to its Unicode varianti, make use this quirk. Signed-off-by: Xerxes Rånby --- .../jogamp/newt/driver/linux/LinuxEventDeviceTracker.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/newt/classes') diff --git a/src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java b/src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java index 5c2a69142..5efce2524 100644 --- a/src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java +++ b/src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java @@ -258,7 +258,7 @@ public class LinuxEventDeviceTracker implements WindowListener { break; case 1: // EV_KEY keyCode = LinuxEVKey2NewtVKey(code); // The device independent code. - keyChar = LinuxEVKey2Unicode(code); // The printable character w/o key modifiers. + keyChar = NewtVKey2Unicode(keyCode); // The printable character w/o key modifiers. switch(value) { case 0: modifiers=0; @@ -314,6 +314,13 @@ public class LinuxEventDeviceTracker implements WindowListener { stop=true; } + private char NewtVKey2Unicode(int VK){ + if(KeyEvent.isPrintableKey(VK)){ + return (char)VK; + } + return 0; + } + private char LinuxEVKey2Unicode(short EVKey) { // This is the stuff normally mapped by a system keymap -- cgit v1.2.3