From 959a496e595ededd2d8479db4835ebcd7741f3af Mon Sep 17 00:00:00 2001 From: Brendan Robert Date: Sun, 29 Mar 2015 14:17:07 -0500 Subject: [PATCH] FIX: Shift was not properly relaying keys being sent to the emulator in Windows 8.1 (Thanks Justin Scott!) --- src/main/java/jace/core/Keyboard.java | 37 ++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/src/main/java/jace/core/Keyboard.java b/src/main/java/jace/core/Keyboard.java index 1bf97f2..3506fce 100644 --- a/src/main/java/jace/core/Keyboard.java +++ b/src/main/java/jace/core/Keyboard.java @@ -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);