Fixed remote desktop problems with input keys.

This commit is contained in:
Ylian Saint-Hilaire 2019-07-05 15:25:03 -07:00
parent 70a9c56c7a
commit 91acb4e448
5 changed files with 36 additions and 8 deletions

View File

@ -1,6 +1,6 @@
{
"name": "meshcentral",
"version": "0.3.7-g",
"version": "0.3.7-h",
"keywords": [
"Remote Management",
"Intel AMT",

View File

@ -32,6 +32,9 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
obj.firstUpKeys = [];
obj.stopInput = false;
obj.localKeyMap = true;
obj.altPressed = false;
obj.ctrlPressed = false;
obj.shiftPressed = false;
obj.sessionid = 0;
obj.username;
@ -394,6 +397,8 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
// Older browser support this.
var kc = event.keyCode;
if (kc == 0x3B) { kc = 0xBA; } // Fix the ';' key
else if (kc == 173) { kc = 189; } // Fix the '-' key for Firefox
else if (kc == 61) { kc = 187; } // Fix the '=' key for Firefox
obj.SendKeyMsgKC(action, kc);
}
}
@ -531,9 +536,27 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
if (obj.firstUpKeys.length < 5) {
obj.firstUpKeys.push(e.keyCode);
if ((obj.firstUpKeys.length == 5)) { var j = obj.firstUpKeys.join(','); if ((j == '16,17,91,91,16') || (j == '16,17,18,91,92')) { obj.stopInput = true; } }
} return obj.xxKeyUp(e);
}
obj.handleKeyDown = function (e) { if (obj.stopInput == true || desktop.State != 3) return false; return obj.xxKeyDown(e); }
if (e.keyCode == 16) { obj.shiftPressed = false; }
if (e.keyCode == 17) { obj.ctrlPressed = false; }
if (e.keyCode == 18) { obj.altPressed = false; }
return obj.xxKeyUp(e);
}
obj.handleKeyDown = function (e) {
if (obj.stopInput == true || desktop.State != 3) return false;
if (e.keyCode == 16) { obj.shiftPressed = true; }
if (e.keyCode == 17) { obj.ctrlPressed = true; }
if (e.keyCode == 18) { obj.altPressed = true; }
return obj.xxKeyDown(e);
}
// Release the CTRL, ALT, SHIFT keys if they are pressed.
obj.handleReleaseKeys = function () {
if (obj.shiftPressed) { obj.SendKeyMsgKC(obj.KeyAction.UP, 16); } // Shift
if (obj.ctrlPressed) { obj.SendKeyMsgKC(obj.KeyAction.UP, 17); } // Ctrl
if (obj.altPressed) { obj.SendKeyMsgKC(obj.KeyAction.UP, 18); } // Alt
obj.shiftPressed = obj.ctrlPressed = obj.altPressed = false;
}
// Mouse handlers
obj.mousedblclick = function (e) { if (obj.stopInput == true) return false; return obj.xxMouseDblClick(e); }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -473,7 +473,7 @@
</div>
<div id=deskarea4 class="areaFoot">
<div class="toright2">
<select id=termdisplays style="display:none" onchange=deskSetDisplay(event)></select>&nbsp;
<select id=termdisplays style="display:none" onchange=deskSetDisplay(event) onkeypress="return false" onkeydown="return false"></select>&nbsp;
<input id=DeskToolsButton type=button value=Tools title="Toggle tools view" onkeypress="return false" onkeydown="return false" onclick="toggleDeskTools()">&nbsp;
<span id=DeskChatButton class="deskarea" title="Open chat window to this computer"><img src='images/icon-chat.png' onclick=deviceChat() height=16 width=16 style=padding-top:2px /></span>
<span id=DeskNotifyButton title="Display a notification on the remote computer"><img src='images/icon-notify.png' onclick=deviceToastFunction() height=16 width=16 style=padding-top:2px /></span>
@ -1006,6 +1006,8 @@
document.onkeypress = ondockeypress;
document.onkeydown = ondockeydown;
document.onkeyup = ondockeyup;
//window.addEventListener("focus", ondocfocus, false);
window.addEventListener("blur", ondocblur, false);
window.onresize = function () { masterUpdate(512); }
setTimeout("masterUpdate(512)", 200);
@ -2164,6 +2166,9 @@
if (Q('viewselect').value == 3) { if ((e.keyCode === 8 && mapSearchFocus == 0) || e.keyCode === 27) { return haltEvent(e); } }
}
//function ondocfocus() { }
function ondocblur() { if (!xxdialogMode && xxcurrentView == 11 && desktop && Q("DeskControl").checked) { return desktop.m.handleReleaseKeys(); } }
// Highlights the device being hovered
function devMouseHover(element, over) {
setSessionActivity();
@ -4995,7 +5000,7 @@
function deskGetDisplayNumbers(e) { desktop.m.GetDisplayNumbers(); }
var deskPreferedStickyDisplay = 0;
function deskSetDisplay(e) { desktop.m.SetDisplay(deskPreferedStickyDisplay = parseInt(Q('termdisplays').value)); }
function deskSetDisplay(e) { desktop.m.SetDisplay(deskPreferedStickyDisplay = parseInt(Q('termdisplays').value)); Q('termdisplays').blur(); }
// Double click detection. This is important for MacOS.
var dblClickDetectArgs = { t:0, x:0, y:0 };