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) {
if (obj.State != 3) return;
obj.send(String.fromCharCode(0x00, obj.InputType.KEYUNICODE, 0x00, 0x07, (action - 1)) + ShortToStr(val));

View File

@ -14572,10 +14572,15 @@
"zh-chs": "输入文本,然后单击“确定”以使用美式英语键盘远程输入文本。在继续操作之前,请确保将远程鼠标放置在正确的位置。",
"zh-cht": "輸入文本,然後單擊“確定”以使用美式英語鍵盤遠程輸入文本。在繼續操作之前,請確保將遠程光標放置在正確的位置。",
"xloc": [
"default.handlebars->29->848",
"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",
"de": "Geben Sie das Kontoerstellungstoken ein",

View File

@ -7383,7 +7383,7 @@
function showDeskType() {
if (xxdialogMode || desktop == null || desktop.State != 3) return;
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>';
setDialogMode(2, "Remote Keyboard Entry", 3, showDeskTypeEx, x);
Q('d2typeText').focus();
@ -7406,24 +7406,31 @@
}, 10);
} else {
// MeshAgent
for (var i in txt) {
var a = txt.charCodeAt(i), b = ltxt.charCodeAt(i);
if (((a >= 65) && (a <= 90)) || ((a >= 97) && (a <= 122))) {
if ((a == b) && (shift == false)) { x.push([desktop.m.KeyAction.DOWN, 16]); shift = true; } // LShift down
if ((a != b) && (shift == true)) { x.push([desktop.m.KeyAction.UP, 16]); shift = false; } // LShift up
} else if ((a >= 48) && (a <= 57)) {
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];
var winagent = ((currentNode.agent.id > 0) && (currentNode.agent.id < 5));
if (winagent) {
// New unicode typing
desktop.m.SendStringUnicode(txt);
} else {
// Old scan code typing. Remove this when non-Windows platforms support Unicode.
for (var i in txt) {
var a = txt.charCodeAt(i), b = ltxt.charCodeAt(i);
if (((a >= 65) && (a <= 90)) || ((a >= 97) && (a <= 122))) {
if ((a == b) && (shift == false)) { x.push([desktop.m.KeyAction.DOWN, 16]); shift = true; } // LShift down
if ((a != b) && (shift == true)) { x.push([desktop.m.KeyAction.UP, 16]); shift = false; } // LShift up
} else if ((a >= 48) && (a <= 57)) {
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);
}
}