mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 05:31:22 +00:00
Properly handle shift within identifier parse.
This commit is contained in:
@@ -339,7 +339,7 @@ Guacamole.Keyboard = function(element) {
|
|||||||
var typedCharacter;
|
var typedCharacter;
|
||||||
|
|
||||||
// Convert case if shifted
|
// Convert case if shifted
|
||||||
if (shifted === 0)
|
if (!shifted)
|
||||||
typedCharacter = String.fromCharCode(codepoint).toLowerCase();
|
typedCharacter = String.fromCharCode(codepoint).toLowerCase();
|
||||||
else
|
else
|
||||||
typedCharacter = String.fromCharCode(codepoint).toUpperCase();
|
typedCharacter = String.fromCharCode(codepoint).toUpperCase();
|
||||||
@@ -467,29 +467,6 @@ Guacamole.Keyboard = function(element) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function isTypable(keyIdentifier) {
|
|
||||||
|
|
||||||
// Identifiers which are a single character are typeable
|
|
||||||
if (keyIdentifier.length === 1)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// Find unicode prefix
|
|
||||||
var unicodePrefixLocation = keyIdentifier.indexOf("U+");
|
|
||||||
if (unicodePrefixLocation === -1)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Parse codepoint value
|
|
||||||
var hex = keyIdentifier.substring(unicodePrefixLocation+2);
|
|
||||||
var codepoint = parseInt(hex, 16);
|
|
||||||
|
|
||||||
// If control character, not typable
|
|
||||||
if (isControlCharacter(codepoint)) return false;
|
|
||||||
|
|
||||||
// Otherwise, typable
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a keyboard event, updates the local modifier state and remote
|
* Given a keyboard event, updates the local modifier state and remote
|
||||||
* key state based on the modifier flags within the event. This function
|
* key state based on the modifier flags within the event. This function
|
||||||
@@ -537,7 +514,7 @@ Guacamole.Keyboard = function(element) {
|
|||||||
var identifier = e.key || e.keyIdentifier;
|
var identifier = e.key || e.keyIdentifier;
|
||||||
|
|
||||||
// Ignore any unknown key events
|
// Ignore any unknown key events
|
||||||
if (keynum === 0 && !identifier) {
|
if (!keynum && !identifier) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user