Expose getKeysym and add keyboard test.

Related to issue Non-US keyboard layout option issue:
https://github.com/kanaka/noVNC/issues#issue/21
This commit is contained in:
Joel Martin
2011-01-03 12:34:41 -06:00
parent 56d9aa816b
commit bf5ee68828
2 changed files with 72 additions and 5 deletions

View File

@@ -216,7 +216,7 @@ function constructor() {
}
/* Translate DOM key down/up event to keysym value */
function getKeysym(e) {
that.getKeysym = function(e) {
var evt, keysym;
evt = (e ? e : window.event);
@@ -362,24 +362,24 @@ function onMouseMove(e) {
}
function onKeyDown(e) {
//Util.Debug("keydown: " + getKeysym(e));
//Util.Debug("keydown: " + that.getKeysym(e));
if (! conf.focused) {
return true;
}
if (c_keyPress) {
c_keyPress(getKeysym(e), 1);
c_keyPress(that.getKeysym(e), 1);
}
Util.stopEvent(e);
return false;
}
function onKeyUp(e) {
//Util.Debug("keyup: " + getKeysym(e));
//Util.Debug("keyup: " + that.getKeysym(e));
if (! conf.focused) {
return true;
}
if (c_keyPress) {
c_keyPress(getKeysym(e), 0);
c_keyPress(that.getKeysym(e), 0);
}
Util.stopEvent(e);
return false;