1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Updated MeshCommander and fixes to message dispatch.

This commit is contained in:
Ylian Saint-Hilaire 2019-07-10 14:27:38 -07:00
parent 5e010273e3
commit abe8e97f24
6 changed files with 911 additions and 909 deletions

View file

@ -49,9 +49,10 @@ var CreateAmtRemoteDesktop = function (divid, scrolldiv) {
obj.lastKeepAlive = Date.now();
// ###END###{DesktopInband}
// ###BEGIN###{DesktopFocus}
obj.mNagleTimer = null; // Mouse motion slowdown timer
obj.mx = 0; // Last mouse x position
obj.my = 0; // Last mouse y position
// ###BEGIN###{DesktopFocus}
obj.ox = -1; // Old mouse x position
obj.oy = -1; // Old mouse y position
obj.focusmode = 0;
@ -836,10 +837,10 @@ var CreateAmtRemoteDesktop = function (divid, scrolldiv) {
// RFB "PointerEvent" and mouse handlers
obj.mousedblclick = function (e) { }
obj.mousedown = function (e) { obj.buttonmask |= (1 << e.button); return obj.mousemove(e); }
obj.mouseup = function (e) { obj.buttonmask &= (0xFFFF - (1 << e.button)); return obj.mousemove(e); }
obj.mousemove = function (e) {
if (obj.state != 4) return true;
obj.mousedown = function (e) { obj.buttonmask |= (1 << e.button); return obj.mousemove(e, 1); }
obj.mouseup = function (e) { obj.buttonmask &= (0xFFFF - (1 << e.button)); return obj.mousemove(e, 1); }
obj.mousemove = function (e, force) {
if (obj.state < 4) return true;
var ScaleFactorHeight = (obj.canvas.canvas.height / Q(obj.canvasid).offsetHeight);
var ScaleFactorWidth = (obj.canvas.canvas.width / Q(obj.canvasid).offsetWidth);
var Offsets = obj.getPositionOfControl(Q(obj.canvasid));
@ -856,7 +857,18 @@ var CreateAmtRemoteDesktop = function (divid, scrolldiv) {
}
// ###END###{DesktopRotation}
obj.send(String.fromCharCode(5, obj.buttonmask) + ShortToStr(obj.mx) + ShortToStr(obj.my));
// This is the mouse motion nagle timer. Slow down the mouse motion event rate.
if (force == 1) {
obj.send(String.fromCharCode(5, obj.buttonmask) + ShortToStr(obj.mx) + ShortToStr(obj.my));
if (obj.mNagleTimer != null) { clearTimeout(obj.mNagleTimer); obj.mNagleTimer = null; }
} else {
if (obj.mNagleTimer == null) {
obj.mNagleTimer = setTimeout(function () {
obj.send(String.fromCharCode(5, obj.buttonmask) + ShortToStr(obj.mx) + ShortToStr(obj.my));
obj.mNagleTimer = null;
}, 50);
}
}
// ###BEGIN###{DesktopFocus}
// Update focus area if we are in focus mode

View file

@ -261,7 +261,7 @@ var CreateAmtRedirect = function (module, authCookie) {
if (obj.debugmode == 1) { console.log('Send', x); }
var b = new Uint8Array(x.length);
for (var i = 0; i < x.length; ++i) { b[i] = x.charCodeAt(i); }
obj.socket.send(b.buffer);
try { obj.socket.send(b.buffer); } catch (ex) { }
}
}