From 5c049b02b99809c9b87963e44c4b9b0976718d77 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Mon, 21 Jul 2014 00:56:44 -0700 Subject: [PATCH] GUAC-788: When a modifier results in a keysym being pressed, release that same keysym when clearing the modifier, even if the key releasing the modifier is different. --- .../src/main/webapp/modules/OnScreenKeyboard.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/guacamole-common-js/src/main/webapp/modules/OnScreenKeyboard.js b/guacamole-common-js/src/main/webapp/modules/OnScreenKeyboard.js index b98fa6ad2..71a5a0897 100644 --- a/guacamole-common-js/src/main/webapp/modules/OnScreenKeyboard.js +++ b/guacamole-common-js/src/main/webapp/modules/OnScreenKeyboard.js @@ -42,6 +42,15 @@ Guacamole.OnScreenKeyboard = function(url) { */ var modifiers = 0; + /** + * Map of currently-set modifiers to the keysym associated with their + * original press. When the modifier is cleared, this keysym must be + * released. + * + * @type Object. + */ + var modifier_keysyms = {}; + var scaledElements = []; var modifier_masks = {}; @@ -357,6 +366,7 @@ Guacamole.OnScreenKeyboard = function(url) { if (modifiers & modifierMask) { addClass(keyboard, modifierClass); + modifier_keysyms[cap.modifier] = cap.keysym; // Send key event if (on_screen_keyboard.onkeydown && cap.keysym) @@ -367,11 +377,14 @@ Guacamole.OnScreenKeyboard = function(url) { // Deactivate if not pressed else { + var original_keysym = modifier_keysyms[cap.modifier]; + removeClass(keyboard, modifierClass); + delete modifier_keysyms[cap.modifier]; // Send key event - if (on_screen_keyboard.onkeyup && cap.keysym) - on_screen_keyboard.onkeyup(cap.keysym); + if (on_screen_keyboard.onkeyup && original_keysym) + on_screen_keyboard.onkeyup(original_keysym); }