Added support for unicode keys in desktop multiplexor.

This commit is contained in:
Ylian Saint-Hilaire 2020-11-19 12:15:09 -08:00
parent ceefca2c20
commit 680a82a431
2 changed files with 14 additions and 11 deletions

View File

@ -452,15 +452,15 @@ function CreateDesktopMultiplexor(parent, domain, nodeid, func) {
var cmdsize = data.readUInt16BE(2);
//console.log('ViewerData', data.length, command, cmdsize);
switch (command) {
case 1:// Key Events, forward to agent
case 1: // Key Events, forward to agent
//console.log('Viewer-Keys');
obj.sendToAgent(data);
break;
case 2:// Mouse events, forward to agent
case 2: // Mouse events, forward to agent
//console.log('Viewer-Mouse');
obj.sendToAgent(data);
break;
case 5:// Compression
case 5: // Compression
if (data.length < 10) return;
//viewer.imageType = data[4]; // Always 1=JPEG
viewer.imageCompression = data[5];
@ -493,12 +493,12 @@ function CreateDesktopMultiplexor(parent, domain, nodeid, func) {
obj.sendToAgent(cmd);
}
break;
case 6:// Refresh, handle this on the server
case 6: // Refresh, handle this on the server
//console.log('Viewer-Refresh');
viewer.dataPtr = obj.firstData; // Start over
if (viewer.sending == false) { sendViewerNext(viewer); }
break;
case 8:// Pause and unpause
case 8: // Pause and unpause
if (data.length != 5) break;
var pause = data[4]; // 0 = Unpause, 1 = Pause
if (viewer.desktopPaused == (pause == 1)) break;
@ -513,13 +513,16 @@ function CreateDesktopMultiplexor(parent, domain, nodeid, func) {
obj.sendToAgent(data);
}
break;
case 10:// CTRL-ALT-DEL, forward to agent
case 10: // CTRL-ALT-DEL, forward to agent
obj.sendToAgent(data);
break;
case 12:// SET DISPLAY, forward to agent
case 12: // SET DISPLAY, forward to agent
obj.sendToAgent(data);
break;
case 14:// Touch setup
case 14: // Touch setup
break;
case 85: // Unicode Key Events, forward to agent
obj.sendToAgent(data);
break;
default:
console.log('Un-handled viewer command: ' + command);

View File

@ -1519,7 +1519,7 @@
}
// Enable browser clipboard read if supported
QV('DeskClipboardInButton', navigator.clipboard.readText != null);
QV('DeskClipboardInButton', (navigator.clipboard != null) && (navigator.clipboard.readText != null));
// Session Refresh Timer
if (sessionTime >= 10) { sessionRefreshTimer = setTimeout(refreshCookieSession, Math.round((sessionTime * 60000) * 0.8)); }
@ -2197,7 +2197,7 @@
if ((message.tag == 1) && (xxdialogTag == 'clipboard')) {
Q('d2clipText').value = message.data; // Put remote clipboard data into dialog box
} else if (message.tag == 2) {
navigator.clipboard.writeText(message.data).then(function() { console.log('ok'); }).catch(function(err) { console.log(err); }) // Put remote clipboard data into our clipboard
if (navigator.clipboard != null) { navigator.clipboard.writeText(message.data).then(function() { console.log('ok'); }).catch(function(err) { console.log(err); }) } // Put remote clipboard data into our clipboard
}
} else if ((message.type == 'setclip') && (xxdialogTag == 'clipboard') && (currentNode != null) && (currentNode._id == message.nodeid)) {
// Display success/fail on the clipboard dialog box.
@ -6189,7 +6189,7 @@
}
function deskClipboardOutFunction() {
if (navigator.clipboard.readText) { navigator.clipboard.readText().then(function(text) { meshserver.send({ action: 'msg', type: 'setclip', nodeid: currentNode._id, data: text }); }).catch(function(err) { }); }
if ((navigator.clipboard != null) && (navigator.clipboard.readText != null)) { navigator.clipboard.readText().then(function(text) { meshserver.send({ action: 'msg', type: 'setclip', nodeid: currentNode._id, data: text }); }).catch(function(err) { }); }
}
function deskRefreshFunction() {