1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-02-12 11:01:52 +00:00

Fixed remote desktop typing

This commit is contained in:
Ylian Saint-Hilaire 2020-11-18 17:03:49 -08:00
parent ac525bc408
commit 9fa5924c5d
4 changed files with 36 additions and 19 deletions

File diff suppressed because one or more lines are too long

View file

@ -403,6 +403,11 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
} }
} }
obj.SendStringUnicode = function (str) {
if (obj.State != 3) return;
for (var i = 0; i < str.length; i++) { obj.send(String.fromCharCode(0x00, obj.InputType.KEYUNICODE, 0x00, 0x07, 0) + ShortToStr(str.charCodeAt(i))); }
}
obj.SendKeyUnicode = function (action, val) { obj.SendKeyUnicode = function (action, val) {
if (obj.State != 3) return; if (obj.State != 3) return;
obj.send(String.fromCharCode(0x00, obj.InputType.KEYUNICODE, 0x00, 0x07, (action - 1)) + ShortToStr(val)); obj.send(String.fromCharCode(0x00, obj.InputType.KEYUNICODE, 0x00, 0x07, (action - 1)) + ShortToStr(val));

View file

@ -14572,10 +14572,15 @@
"zh-chs": "输入文本,然后单击“确定”以使用美式英语键盘远程输入文本。在继续操作之前,请确保将远程鼠标放置在正确的位置。", "zh-chs": "输入文本,然后单击“确定”以使用美式英语键盘远程输入文本。在继续操作之前,请确保将远程鼠标放置在正确的位置。",
"zh-cht": "輸入文本,然後單擊“確定”以使用美式英語鍵盤遠程輸入文本。在繼續操作之前,請確保將遠程光標放置在正確的位置。", "zh-cht": "輸入文本,然後單擊“確定”以使用美式英語鍵盤遠程輸入文本。在繼續操作之前,請確保將遠程光標放置在正確的位置。",
"xloc": [ "xloc": [
"default.handlebars->29->848",
"desktop.handlebars->3->21" "desktop.handlebars->3->21"
] ]
}, },
{
"en": "Enter text and click OK to remotely type it. Make sure to place the remote cursor at the correct position before proceeding.",
"xloc": [
"default.handlebars->29->848"
]
},
{ {
"cs": "Zadejte token pro vytvoření účtu", "cs": "Zadejte token pro vytvoření účtu",
"de": "Geben Sie das Kontoerstellungstoken ein", "de": "Geben Sie das Kontoerstellungstoken ein",

View file

@ -7383,7 +7383,7 @@
function showDeskType() { function showDeskType() {
if (xxdialogMode || desktop == null || desktop.State != 3) return; if (xxdialogMode || desktop == null || desktop.State != 3) return;
Q('DeskType').blur(); Q('DeskType').blur();
var x = '<div>' + "Enter text and click OK to remotely type it using a US english keyboard. Make sure to place the remote cursor at the correct position before proceeding." + '<div>'; var x = '<div>' + "Enter text and click OK to remotely type it. Make sure to place the remote cursor at the correct position before proceeding." + '<div>';
x += '<textarea id=d2typeText style="margin-top:5px;width:100%;height:184px;resize:none" maxlength=2000></textarea>'; x += '<textarea id=d2typeText style="margin-top:5px;width:100%;height:184px;resize:none" maxlength=2000></textarea>';
setDialogMode(2, "Remote Keyboard Entry", 3, showDeskTypeEx, x); setDialogMode(2, "Remote Keyboard Entry", 3, showDeskTypeEx, x);
Q('d2typeText').focus(); Q('d2typeText').focus();
@ -7406,24 +7406,31 @@
}, 10); }, 10);
} else { } else {
// MeshAgent // MeshAgent
for (var i in txt) { var winagent = ((currentNode.agent.id > 0) && (currentNode.agent.id < 5));
var a = txt.charCodeAt(i), b = ltxt.charCodeAt(i); if (winagent) {
if (((a >= 65) && (a <= 90)) || ((a >= 97) && (a <= 122))) { // New unicode typing
if ((a == b) && (shift == false)) { x.push([desktop.m.KeyAction.DOWN, 16]); shift = true; } // LShift down desktop.m.SendStringUnicode(txt);
if ((a != b) && (shift == true)) { x.push([desktop.m.KeyAction.UP, 16]); shift = false; } // LShift up } else {
} else if ((a >= 48) && (a <= 57)) { // Old scan code typing. Remove this when non-Windows platforms support Unicode.
if (shift == true) { x.push([desktop.m.KeyAction.UP, 16]); shift = false; } // Shift up for (var i in txt) {
} else if (DeskTypeTranslate[a]) { var a = txt.charCodeAt(i), b = ltxt.charCodeAt(i);
if (shift == true) { x.push([desktop.m.KeyAction.UP, 16]); shift = false; } // Shift up if (((a >= 65) && (a <= 90)) || ((a >= 97) && (a <= 122))) {
b = DeskTypeTranslate[a]; if ((a == b) && (shift == false)) { x.push([desktop.m.KeyAction.DOWN, 16]); shift = true; } // LShift down
} else if (DeskTypeShiftTranslate[a]) { if ((a != b) && (shift == true)) { x.push([desktop.m.KeyAction.UP, 16]); shift = false; } // LShift up
if (shift == false) { x.push([desktop.m.KeyAction.DOWN, 16]); shift = true; } // LShift down } else if ((a >= 48) && (a <= 57)) {
b = DeskTypeShiftTranslate[a]; if (shift == true) { x.push([desktop.m.KeyAction.UP, 16]); shift = false; } // Shift up
} else if (DeskTypeTranslate[a]) {
if (shift == true) { x.push([desktop.m.KeyAction.UP, 16]); shift = false; } // Shift up
b = DeskTypeTranslate[a];
} else if (DeskTypeShiftTranslate[a]) {
if (shift == false) { x.push([desktop.m.KeyAction.DOWN, 16]); shift = true; } // LShift down
b = DeskTypeShiftTranslate[a];
}
x.push([desktop.m.KeyAction.DOWN, b], [desktop.m.KeyAction.UP, b]);
} }
x.push([desktop.m.KeyAction.DOWN, b], [desktop.m.KeyAction.UP, b]); if (shift == true) { x.push([desktop.m.KeyAction.UP, 16]); shift = false; } // Shift up
desktop.m.SendKeyMsgKC(x);
} }
if (shift == true) { x.push([desktop.m.KeyAction.UP, 16]); shift = false; } // Shift up
desktop.m.SendKeyMsgKC(x);
} }
} }