mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-11 15:37:41 +00:00
As keydown/keypress are handled via deferred setTimeout(), so should keyup (otherwise, there's a race condition that keyup might happen before the deferred handling of keydown/keypress, and the key might be effectively stuck down or in a repeating state).
This commit is contained in:
@@ -511,6 +511,10 @@ Guacamole.Keyboard = function(element) {
|
|||||||
if (window.event) keynum = window.event.keyCode;
|
if (window.event) keynum = window.event.keyCode;
|
||||||
else if (e.which) keynum = e.which;
|
else if (e.which) keynum = e.which;
|
||||||
|
|
||||||
|
// Defer handling of keyup (otherwise, keyup may happen before
|
||||||
|
// deferred handling of keydown/keypress).
|
||||||
|
window.setTimeout(function() {
|
||||||
|
|
||||||
// Ctrl/Alt/Shift
|
// Ctrl/Alt/Shift
|
||||||
if (keynum == 16) guac_keyboard.modifiers.shift = false;
|
if (keynum == 16) guac_keyboard.modifiers.shift = false;
|
||||||
else if (keynum == 17) guac_keyboard.modifiers.ctrl = false;
|
else if (keynum == 17) guac_keyboard.modifiers.ctrl = false;
|
||||||
@@ -527,6 +531,8 @@ Guacamole.Keyboard = function(element) {
|
|||||||
// Send release event
|
// Send release event
|
||||||
sendKeyReleased(lastKeyDownChar);
|
sendKeyReleased(lastKeyDownChar);
|
||||||
|
|
||||||
|
}, 0);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// When focus is lost, clear modifiers.
|
// When focus is lost, clear modifiers.
|
||||||
|
Reference in New Issue
Block a user