FIX: Shift was not properly relaying keys being sent to the emulator in Windows 8.1 (Thanks Justin Scott!)

This commit is contained in:
Brendan Robert 2015-03-29 14:17:07 -05:00
parent 16bcc25204
commit 959a496e59
1 changed files with 36 additions and 1 deletions

View File

@ -203,7 +203,7 @@ public class Keyboard implements Reconfigurable {
if (e.isConsumed()) {
return;
}
char c = 255;
if (e.getText().length() > 0) {
c = e.getText().charAt(0);
@ -241,11 +241,46 @@ public class Keyboard implements Reconfigurable {
default:
}
if (e.isShiftDown()) {
c = fixShiftedChar(c);
}
if (c < 128) {
pressKey((byte) c);
}
}
private char fixShiftedChar(char c) {
if (c >= 'a' && c <= 'z') {
return (char) (c - 32);
} else {
switch (c) {
case '0': return ')';
case '1': return '!';
case '2': return '@';
case '3': return '#';
case '4': return '$';
case '5': return '%';
case '6': return '^';
case '7': return '&';
case '8': return '*';
case '9': return '(';
case '-': return '_';
case '=': return '+';
case '[': return '{';
case ']': return '}';
case '\\': return '|';
case ';': return ':';
case '\'': return '"';
case ',': return '<';
case '.': return '>';
case '/': return '?';
}
}
return c;
}
public void keyReleased(KeyEvent e) {
KeyCode code = e.getCode();
processKeyUpEvents(e);