mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUAC-862: Add reliability flag to KeyEvent.
This commit is contained in:
@@ -97,6 +97,15 @@ Guacamole.Keyboard = function(element) {
|
|||||||
*/
|
*/
|
||||||
this.keysym = null;
|
this.keysym = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the keysym value of this key event is known to be reliable.
|
||||||
|
* If false, the keysym may still be valid, but it's only a best guess,
|
||||||
|
* and future key events may be a better source of information.
|
||||||
|
*
|
||||||
|
* @type Boolean
|
||||||
|
*/
|
||||||
|
this.reliable = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of milliseconds elapsed since this event was
|
* Returns the number of milliseconds elapsed since this event was
|
||||||
* received.
|
* received.
|
||||||
@@ -169,6 +178,10 @@ Guacamole.Keyboard = function(element) {
|
|||||||
this.keysym = keysym_from_key_identifier(key, location)
|
this.keysym = keysym_from_key_identifier(key, location)
|
||||||
|| keysym_from_keycode(keyCode, location);
|
|| keysym_from_keycode(keyCode, location);
|
||||||
|
|
||||||
|
// DOM3 and keyCode are reliable sources
|
||||||
|
if (this.keysym)
|
||||||
|
this.reliable = true;
|
||||||
|
|
||||||
// We must use the (potentially buggy) keyIdentifier immediately if
|
// We must use the (potentially buggy) keyIdentifier immediately if
|
||||||
// keypress will likely not fire, as we need to make a best effort
|
// keypress will likely not fire, as we need to make a best effort
|
||||||
// to prevent default if requested
|
// to prevent default if requested
|
||||||
@@ -212,6 +225,9 @@ Guacamole.Keyboard = function(element) {
|
|||||||
// Pull keysym from char code
|
// Pull keysym from char code
|
||||||
this.keysym = keysym_from_charcode(charCode);
|
this.keysym = keysym_from_charcode(charCode);
|
||||||
|
|
||||||
|
// Keypress is always reliable
|
||||||
|
this.reliable = true;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
KeypressEvent.prototype = new KeyEvent();
|
KeypressEvent.prototype = new KeyEvent();
|
||||||
@@ -276,6 +292,9 @@ Guacamole.Keyboard = function(element) {
|
|||||||
|| keysym_from_keycode(keyCode, location)
|
|| keysym_from_keycode(keyCode, location)
|
||||||
|| recentKeysym[keyCode];
|
|| recentKeysym[keyCode];
|
||||||
|
|
||||||
|
// Keyup is as reliable as it will ever be
|
||||||
|
this.reliable = true;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
KeyupEvent.prototype = new KeyEvent();
|
KeyupEvent.prototype = new KeyEvent();
|
||||||
|
Reference in New Issue
Block a user