GUAC-862: Correct case of key based on shift if keyIdentifier in use. CapsLock cannot be tracked, but that should be OK here.

This commit is contained in:
Michael Jumper
2014-09-22 16:46:01 -07:00
parent 9ef5d14a01
commit ef42d7db68

View File

@@ -518,7 +518,7 @@ Guacamole.Keyboard = function(element) {
return keysyms[location] || keysyms[0]; return keysyms[location] || keysyms[0];
} }
function keysym_from_key_identifier(identifier, location) { function keysym_from_key_identifier(identifier, location, shifted) {
if (!identifier) if (!identifier)
return null; return null;
@@ -540,6 +540,12 @@ Guacamole.Keyboard = function(element) {
else else
return get_keysym(keyidentifier_keysym[identifier], location); return get_keysym(keyidentifier_keysym[identifier], location);
// Alter case if necessary
if (shifted === true)
typedCharacter = typedCharacter.toUpperCase();
else if (shifted === false)
typedCharacter = typedCharacter.toLowerCase();
// Get codepoint // Get codepoint
var codepoint = typedCharacter.charCodeAt(0); var codepoint = typedCharacter.charCodeAt(0);
return keysym_from_charcode(codepoint); return keysym_from_charcode(codepoint);
@@ -776,7 +782,7 @@ Guacamole.Keyboard = function(element) {
|| guac_keyboard.modifiers.alt || guac_keyboard.modifiers.alt
|| guac_keyboard.modifiers.meta || guac_keyboard.modifiers.meta
|| guac_keyboard.modifiers.hyper) || guac_keyboard.modifiers.hyper)
keysym = keysym || keysym_from_key_identifier(first.keyIdentifier, first.location); keysym = keysym || keysym_from_key_identifier(first.keyIdentifier, first.location, guac_keyboard.modifiers.shift);
if (keysym) { if (keysym) {
recentKeysym[first.keyCode] = keysym; recentKeysym[first.keyCode] = keysym;