From d4502f7b11e5b6c6efb227785c4bf9d39c44d2bf Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Mon, 20 Jun 2022 10:55:11 -0700 Subject: [PATCH] Added reverse mouse wheel option to remote desktop and Intel AMT KVM. --- public/scripts/agent-desktop-0.0.2.js | 3 +++ public/scripts/amt-desktop-0.0.2.js | 4 ++++ views/default.handlebars | 17 ++++++++++++++--- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/public/scripts/agent-desktop-0.0.2.js b/public/scripts/agent-desktop-0.0.2.js index 4401b365..95428466 100644 --- a/public/scripts/agent-desktop-0.0.2.js +++ b/public/scripts/agent-desktop-0.0.2.js @@ -533,6 +533,9 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) { else if (Button == obj.MouseButton.RIGHT) { Button = obj.MouseButton.LEFT; } } + // Reverse mouse wheel if needed + if (obj.ReverseMouseWheel) { Delta = -1 * Delta; } + var MouseMsg = ""; if (Action == obj.KeyAction.DBLCLICK) { MouseMsg = String.fromCharCode(0x00, obj.InputType.MOUSE, 0x00, 0x0A, 0x00, 0x88, ((X / 256) & 0xFF), (X & 0xFF), ((Y / 256) & 0xFF), (Y & 0xFF)); diff --git a/public/scripts/amt-desktop-0.0.2.js b/public/scripts/amt-desktop-0.0.2.js index ceb550c2..9cde5b2e 100644 --- a/public/scripts/amt-desktop-0.0.2.js +++ b/public/scripts/amt-desktop-0.0.2.js @@ -931,6 +931,10 @@ var CreateAmtRemoteDesktop = function (divid, scrolldiv) { else if (typeof e.detail == 'number') { v = -1 * e.detail; } else if (typeof e.wheelDelta == 'number') { v = e.wheelDelta; } if (v == 0) return; + + // Reverse mouse wheel if needed + if (obj.ReverseMouseWheel) { v = -1 * v; } + var tmpmask = obj.buttonmask; obj.buttonmask |= (1 << ((v > 0) ? 3 : 4)); obj.mousemove(e, 1); diff --git a/views/default.handlebars b/views/default.handlebars index 1066c302..6a23166e 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -1323,6 +1323,7 @@
Other Settings
+ @@ -1346,6 +1347,7 @@ +
@@ -4853,6 +4855,7 @@ desk.m.ScalingLevel = multidesktopsettings.scaling; if (multidesktopsettings.framerate) { desk.m.FrameRateTimer = multidesktopsettings.framerate; } if (multidesktopsettings.swapmouse) { desk.m.SwapMouse = multidesktopsettings.swapmouse; } + if (multidesktopsettings.rmw) { desk.m.ReverseMouseWheel = multidesktopsettings.rmw; } if (multidesktopsettings.remotekeymap == true) { desk.m.remoteKeyMap = multidesktopsettings.remotekeymap; } //desk.m.onDisplayinfo = deskDisplayInfo; desk.m.onScreenSizeChange = mdeskAdjust; // Multi-Desktop Adjust @@ -8467,6 +8470,7 @@ desktop.m.bpp = (desktopsettings.encoding == 1 || desktopsettings.encoding == 3) ? 1 : 2; desktop.m.useZRLE = (desktopsettings.encoding < 3); desktop.m.localKeyMap = desktopsettings.localkeymap; + desktop.m.ReverseMouseWheel = desktopsettings.kvmrmw; desktop.m.showmouse = desktopsettings.showmouse; desktop.m.onScreenSizeChange = deskAdjust; desktop.m.onKvmData = function (x) { @@ -8579,6 +8583,7 @@ desktop.m.ScalingLevel = desktopsettings.scaling; if (desktopsettings.framerate) { desktop.m.FrameRateTimer = desktopsettings.framerate; } if (desktopsettings.swapmouse) { desktop.m.SwapMouse = desktopsettings.swapmouse; } + if (desktopsettings.rmw) { desktop.m.ReverseMouseWheel = desktopsettings.rmw; } if (desktopsettings.remotekeymap == true) { desktop.m.remoteKeyMap = desktopsettings.remotekeymap; } desktop.m.onDisplayinfo = deskDisplayInfo; desktop.m.onScreenSizeChange = deskAdjust; @@ -8878,10 +8883,12 @@ desktopsettings.scaling = d7bitmapscaling.value; desktopsettings.framerate = d7framelimiter.value; desktopsettings.swapmouse = d7deskSwapMouse.checked; + desktopsettings.rmw = d7deskrmw.checked; desktopsettings.remotekeymap = d7deskRemoteKeyMap.checked; desktopsettings.autoclipboard = d7deskAutoClipboard.checked; desktopsettings.autolock = d7deskAutoLock.checked; desktopsettings.localkeymap = d7localKeyMap.checked; + desktopsettings.kvmrmw = d7kvmrmw.checked; desktopsettings.rdpsize = d7rdpsize.value; desktopsettings.rdpsmb = d7rdpsmb.checked; desktopsettings.rdprmw = d7rdprmw.checked; @@ -8893,19 +8900,21 @@ applyDesktopSettings(); updateDesktopButtons(); if (desktop) { - if (desktop.contype == 1) { + if (desktop.contype == 1) { // Intel AMT KVM desktop.m.SwapMouse = desktopsettings.swapmouse; + desktop.m.ReverseMouseWheel = desktopsettings.rmw; desktop.m.remoteKeyMap = desktopsettings.remotekeymap; if (desktop.State != 0) { desktop.m.SendCompressionLevel(webpSupport?4:1, desktopsettings.quality, desktopsettings.scaling, desktopsettings.framerate); desktop.sendCtrlMsg('{"ctrlChannel":"102938","type":"autolock","value":' + desktopsettings.autolock + '}'); } } - if (desktop.contype == 2) { + if (desktop.contype == 2) { // Mesh Agent Remote Desktop + desktop.m.ReverseMouseWheel = desktopsettings.kvmrmw; if (desktopsettings.showfocus == false) { desktop.m.focusmode = 0; deskFocusBtn.value = "All Focus"; } if (desktop.State != 0) { desktop.Stop(); setTimeout(function () { connectDesktop(null, 2); }, 50); } } - if (desktop.contype == 4) { + if (desktop.contype == 4) { // Web-RDP desktop.m.SwapMouse = desktopsettings.rdpsmb; desktop.m.ReverseMouseWheel = desktopsettings.rdprmw; } @@ -8924,10 +8933,12 @@ d7bitmapscaling.value = desktopsettings.scaling; if (desktopsettings.framerate) { d7framelimiter.value = desktopsettings.framerate; } else { d7framelimiter.value = 100; } if (desktopsettings.swapmouse != null) { d7deskSwapMouse.checked = desktopsettings.swapmouse; } + if (desktopsettings.rmw != null) { d7deskrmw.checked = desktopsettings.rmw; } if (desktopsettings.remotekeymap != null) { d7deskRemoteKeyMap.checked = desktopsettings.remotekeymap; } if (desktopsettings.autoclipboard != null) { d7deskAutoClipboard.checked = desktopsettings.autoclipboard; } if (desktopsettings.autolock != null) { d7deskAutoLock.checked = desktopsettings.autolock; } if (desktopsettings.localkeymap) { d7localKeyMap.checked = desktopsettings.localkeymap; } + if (desktopsettings.kvmrmw) { d7kvmrmw.checked = desktopsettings.kvmrmw; } QV('deskFocusBtn', (desktop != null) && (desktop.contype == 2) && (desktop.state != 0) && (desktopsettings.showfocus)); if (desktopsettings.rdpsize != null) { d7rdpsize.value = desktopsettings.rdpsize; } if (desktopsettings.rdpflags == null) { desktopsettings.rdpflags = 0x2F; }