mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 13:41:21 +00:00
Track pressed status of keys. Only release/press keys if not already in that status.
This commit is contained in:
@@ -269,6 +269,9 @@ Guacamole.OnScreenKeyboard = function(url) {
|
||||
key_element.onmousedown =
|
||||
key_element.ontouchstart = function() {
|
||||
|
||||
// Press key if not yet pressed
|
||||
if (!key.pressed) {
|
||||
|
||||
key_element.classList.add("guac-keyboard-pressed");
|
||||
|
||||
// Get current cap based on modifier state
|
||||
@@ -294,23 +297,38 @@ Guacamole.OnScreenKeyboard = function(url) {
|
||||
|
||||
}
|
||||
|
||||
// Send key event
|
||||
if (on_screen_keyboard.onkeydown && cap.keysym)
|
||||
on_screen_keyboard.onkeydown(cap.keysym);
|
||||
|
||||
// Mark key as pressed
|
||||
key.pressed = true;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
key_element.onmouseup =
|
||||
key_element.onmouseout =
|
||||
key_element.ontouchend = function() {
|
||||
|
||||
// Release key if currently pressed
|
||||
if (key.pressed) {
|
||||
|
||||
// Get current cap based on modifier state
|
||||
var cap = key.getCap(on_screen_keyboard.modifiers);
|
||||
|
||||
key_element.classList.remove("guac-keyboard-pressed");
|
||||
|
||||
// Send key event
|
||||
if (on_screen_keyboard.onkeyup && cap.keysym)
|
||||
on_screen_keyboard.onkeyup(cap.keysym);
|
||||
|
||||
// Mark key as released
|
||||
key.pressed = false;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
@@ -409,6 +427,11 @@ Guacamole.OnScreenKeyboard.Key = function() {
|
||||
|
||||
var key = this;
|
||||
|
||||
/**
|
||||
* Whether this key is currently pressed.
|
||||
*/
|
||||
this.pressed = false;
|
||||
|
||||
/**
|
||||
* Width of the key, relative to the size of the keyboard.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user