Skip to content

Commit

Permalink
LinuxEventDeviceTracker: Map printable char using KeyEvent.isPrintabl…
Browse files Browse the repository at this point in the history
…eKey.

The NEWT VK namespace tries to map keyCodes
to its Unicode varianti, make use this quirk.

Signed-off-by: Xerxes Rånby <xerxes@zafena.se>
  • Loading branch information
xranby committed Jan 31, 2013
1 parent f8bc0ad commit ae89ca7
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public void run() {
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;
Expand Down Expand Up @@ -314,6 +314,13 @@ public void run() {
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

Expand Down

0 comments on commit ae89ca7

Please sign in to comment.