Add allowQEMUExtKeyEvent option, which allows the qemu keyboard extensions to be disabled. This is required for compatability with instances that are still running with a '-k' option on the command line

This commit is contained in:
Brian Rak 2016-09-21 17:04:28 -04:00
parent 33e1462999
commit e496d6291d
3 changed files with 14 additions and 2 deletions

4
app/ui.js Normal file → Executable file
View File

@ -202,6 +202,10 @@ var UI;
initRFB: function() { initRFB: function() {
try { try {
UI.rfb = new RFB({'target': document.getElementById('noVNC_canvas'), UI.rfb = new RFB({'target': document.getElementById('noVNC_canvas'),
// If you have qemu guests that are still running with the '-k en-us' (or any other keymap), you'll need
// to set this to false, or each keypress will result in messages like:
// Unknown key released (translated set 2, code 0x0 on isa0060/serio0).
'allowQEMUExtKeyEvent': true,
'onUpdateState': UI.updateState, 'onUpdateState': UI.updateState,
'onXvpInit': UI.updateXvpButton, 'onXvpInit': UI.updateXvpButton,
'onClipboard': UI.clipboardReceive, 'onClipboard': UI.clipboardReceive,

4
core/rfb.js Normal file → Executable file
View File

@ -155,6 +155,7 @@
'wsProtocols': ['binary'], // Protocols to use in the WebSocket connection 'wsProtocols': ['binary'], // Protocols to use in the WebSocket connection
'repeaterID': '', // [UltraVNC] RepeaterID to connect to 'repeaterID': '', // [UltraVNC] RepeaterID to connect to
'viewportDrag': false, // Move the viewport on mouse drags 'viewportDrag': false, // Move the viewport on mouse drags
'allowQEMUExtKeyEvent': true, // Should the QEMU extended keymap support be available
// Callback functions // Callback functions
'onUpdateState': function () { }, // onUpdateState(rfb, state, oldstate, statusMsg): state update/change 'onUpdateState': function () { }, // onUpdateState(rfb, state, oldstate, statusMsg): state update/change
@ -1323,6 +1324,7 @@
['wsProtocols', 'rw', 'arr'], // Protocols to use in the WebSocket connection ['wsProtocols', 'rw', 'arr'], // Protocols to use in the WebSocket connection
['repeaterID', 'rw', 'str'], // [UltraVNC] RepeaterID to connect to ['repeaterID', 'rw', 'str'], // [UltraVNC] RepeaterID to connect to
['viewportDrag', 'rw', 'bool'], // Move the viewport on mouse drags ['viewportDrag', 'rw', 'bool'], // Move the viewport on mouse drags
['allowQEMUExtKeyEvent', 'rw', 'bool'], // Should the QEMU keyboard extensions be allowed
// Callback functions // Callback functions
['onUpdateState', 'rw', 'func'], // onUpdateState(rfb, state, oldstate, statusMsg): RFB state update/change ['onUpdateState', 'rw', 'func'], // onUpdateState(rfb, state, oldstate, statusMsg): RFB state update/change
@ -2320,7 +2322,7 @@
this._FBU.rects--; this._FBU.rects--;
var keyboardEvent = document.createEvent("keyboardEvent"); var keyboardEvent = document.createEvent("keyboardEvent");
if (keyboardEvent.code !== undefined) { if (this.allowQEMUExtKeyEvent && keyboardEvent.code !== undefined) {
this._qemuExtKeyEventSupported = true; this._qemuExtKeyEventSupported = true;
this._keyboard.setQEMUVNCKeyboardHandler(); this._keyboard.setQEMUVNCKeyboardHandler();
} }

8
vnc_auto.html Normal file → Executable file
View File

@ -233,10 +233,16 @@
'local_cursor': WebUtil.getConfigVar('cursor', true), 'local_cursor': WebUtil.getConfigVar('cursor', true),
'shared': WebUtil.getConfigVar('shared', true), 'shared': WebUtil.getConfigVar('shared', true),
'view_only': WebUtil.getConfigVar('view_only', false), 'view_only': WebUtil.getConfigVar('view_only', false),
// If you have qemu guests that are still running with the '-k en-us' (or any other keymap), you'll need
// to set this to false, or each keypress will result in messages like:
// Unknown key released (translated set 2, code 0x0 on isa0060/serio0).
'allowQEMUExtKeyEvent': true,
'onUpdateState': updateState, 'onUpdateState': updateState,
'onXvpInit': xvpInit, 'onXvpInit': xvpInit,
'onPasswordRequired': passwordRequired, 'onPasswordRequired': passwordRequired,
'onFBUComplete': FBUComplete}); 'onFBUComplete': FBUComplete,
});
} catch (exc) { } catch (exc) {
updateState(null, 'fatal', null, 'Unable to create RFB client -- ' + exc); updateState(null, 'fatal', null, 'Unable to create RFB client -- ' + exc);
return; // don't continue trying to connect return; // don't continue trying to connect