mirror of
https://github.com/novnc/noVNC.git
synced 2026-05-29 16:39:40 +00:00
Keyboard Handling [4/8]: Update input.html to work with new keyboard handling
Plug new keyboard handling into input.js (which breaks everything else), and update input.html to work with this
This commit is contained in:
1693
include/input.js
1693
include/input.js
File diff suppressed because it is too large
Load Diff
@@ -26,6 +26,8 @@
|
||||
<script src="../include/util.js"></script>
|
||||
<script src="../include/webutil.js"></script>
|
||||
<script src="../include/base64.js"></script>
|
||||
<script src="../include/keysymdef.js"></script>
|
||||
<script src="../include/keyboard.js"></script>
|
||||
<script src="../include/input.js"></script>
|
||||
<script src="../include/display.js"></script>
|
||||
<script>
|
||||
@@ -57,9 +59,17 @@
|
||||
//console.log(msg);
|
||||
}
|
||||
|
||||
function keyPress(keysym, down, e) {
|
||||
function rfbKeyPress(keysym, down) {
|
||||
var d = down ? "down" : " up ";
|
||||
msg = "keyPress " + d + " keysym: " + keysym +
|
||||
var key = keysyms.lookup(keysym);
|
||||
var msg = "RFB keypress " + d + " keysym: " + keysym;
|
||||
if (key && key.keyname) {
|
||||
msg += " key name: " + key.keyname;
|
||||
}
|
||||
message(msg);
|
||||
}
|
||||
function rawKey(e) {
|
||||
msg = "raw key event " + e.type +
|
||||
" (key: " + e.keyCode + ", char: " + e.charCode +
|
||||
", which: " + e.which +")";
|
||||
message(msg);
|
||||
@@ -94,7 +104,10 @@
|
||||
window.onload = function() {
|
||||
canvas = new Display({'target' : $D('canvas')});
|
||||
keyboard = new Keyboard({'target': document,
|
||||
'onKeyPress': keyPress});
|
||||
'onKeyPress': rfbKeyPress});
|
||||
Util.addEvent(document, 'keypress', rawKey);
|
||||
Util.addEvent(document, 'keydown', rawKey);
|
||||
Util.addEvent(document, 'keyup', rawKey);
|
||||
mouse = new Mouse({'target': $D('canvas'),
|
||||
'onMouseButton': mouseButton,
|
||||
'onMouseMove': mouseMove});
|
||||
|
||||
Reference in New Issue
Block a user