Added mouse button swap support.

This commit is contained in:
Ylian Saint-Hilaire 2020-09-29 11:44:53 -07:00
parent a037cea400
commit e97e3db8d3
4 changed files with 28 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@ -43,6 +43,7 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
obj.CompressionLevel = 50; obj.CompressionLevel = 50;
obj.ScalingLevel = 1024; obj.ScalingLevel = 1024;
obj.FrameRateTimer = 100; obj.FrameRateTimer = 100;
obj.SwapMouse = false;
obj.FirstDraw = false; obj.FirstDraw = false;
obj.ScreenWidth = 960; obj.ScreenWidth = 960;
@ -467,6 +468,12 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
if (event.detail) { Delta = (-1 * (event.detail * 120)); } else if (event.wheelDelta) { Delta = (event.wheelDelta * 3); } if (event.detail) { Delta = (-1 * (event.detail * 120)); } else if (event.wheelDelta) { Delta = (event.wheelDelta * 3); }
} }
// Swap mouse buttons if needed
if (obj.SwapMouse === true) {
if (Button == obj.MouseButton.LEFT) { Button = obj.MouseButton.RIGHT; }
else if (Button == obj.MouseButton.RIGHT) { Button = obj.MouseButton.LEFT; }
}
var MouseMsg = ""; var MouseMsg = "";
if (Action == obj.KeyAction.DBLCLICK) { 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)); MouseMsg = String.fromCharCode(0x00, obj.InputType.MOUSE, 0x00, 0x0A, 0x00, 0x88, ((X / 256) & 0xFF), (X & 0xFF), ((Y / 256) & 0xFF), (Y & 0xFF));

View File

@ -26069,6 +26069,7 @@
"zh-cht": "其他設定", "zh-cht": "其他設定",
"xloc": [ "xloc": [
"default.handlebars->container->dialog->dialogBody->dialog7->d7amtkvm->5->1", "default.handlebars->container->dialog->dialogBody->dialog7->d7amtkvm->5->1",
"default.handlebars->container->dialog->dialogBody->dialog7->d7meshkvm->d7desktopOtherSettings->1",
"desktop.handlebars->p11->dialog->dialogBody->dialog7->d7amtkvm->5->1" "desktop.handlebars->p11->dialog->dialogBody->dialog7->d7amtkvm->5->1"
] ]
}, },
@ -34592,6 +34593,12 @@
"default.handlebars->27->1201" "default.handlebars->27->1201"
] ]
}, },
{
"en": "Swap Mouse Buttons",
"xloc": [
"default.handlebars->container->dialog->dialogBody->dialog7->d7meshkvm->d7desktopOtherSettings->d7otherset2->1"
]
},
{ {
"cs": "švédština", "cs": "švédština",
"de": "Schwedisch", "de": "Schwedisch",

View File

@ -1171,6 +1171,12 @@
<option value=1000>Very slow</option> <option value=1000>Very slow</option>
</select> </select>
</div> </div>
<div id="d7desktopOtherSettings">
<div>Other Settings</div>
<div id="d7otherset2" style="display:block">
<label style="display:block"><input type="checkbox" id="d7deskSwapMouse" />Swap Mouse Buttons</label>
</div>
</div>
</div> </div>
<div id="d7amtkvm"> <div id="d7amtkvm">
<h4>Intel&reg; AMT Hardware KVM</h4> <h4>Intel&reg; AMT Hardware KVM</h4>
@ -1240,7 +1246,7 @@
var stars = {}; // Devices that have been "stared" by the user. var stars = {}; // Devices that have been "stared" by the user.
var nodeShortIdent = 0; var nodeShortIdent = 0;
var desktop; var desktop;
var desktopsettings = { encoding: 2, showfocus: false, showmouse: true, showcad: true, quality: 40, scaling: 1024, framerate: 50, localkeymap: false }; var desktopsettings = { encoding: 2, showfocus: false, showmouse: true, showcad: true, quality: 40, scaling: 1024, framerate: 50, localkeymap: false, swapmouse: false };
var multidesktopsettings = { quality: 20, scaling: 128, framerate: 1000 }; var multidesktopsettings = { quality: 20, scaling: 128, framerate: 1000 };
var terminal; var terminal;
var files; var files;
@ -3849,6 +3855,7 @@
function showMultiDesktopSettings() { function showMultiDesktopSettings() {
QV('d7amtkvm', false); QV('d7amtkvm', false);
QV('d7meshkvm', true); QV('d7meshkvm', true);
QV('d7desktopOtherSettings', false);
d7bitmapquality.value = multidesktopsettings.quality; d7bitmapquality.value = multidesktopsettings.quality;
d7bitmapscaling.value = multidesktopsettings.scaling; d7bitmapscaling.value = multidesktopsettings.scaling;
if (multidesktopsettings.framerate) { d7framelimiter.value = multidesktopsettings.framerate; } else { d7framelimiter.value = 100; } if (multidesktopsettings.framerate) { d7framelimiter.value = multidesktopsettings.framerate; } else { d7framelimiter.value = 100; }
@ -3896,6 +3903,7 @@
desk.m.CompressionLevel = multidesktopsettings.quality; desk.m.CompressionLevel = multidesktopsettings.quality;
desk.m.ScalingLevel = multidesktopsettings.scaling; desk.m.ScalingLevel = multidesktopsettings.scaling;
if (multidesktopsettings.framerate) { desk.m.FrameRateTimer = multidesktopsettings.framerate; } if (multidesktopsettings.framerate) { desk.m.FrameRateTimer = multidesktopsettings.framerate; }
if (multidesktopsettings.swapmouse) { desk.m.SwapMouse = multidesktopsettings.swapmouse; }
//desk.m.onDisplayinfo = deskDisplayInfo; //desk.m.onDisplayinfo = deskDisplayInfo;
//desk.m.onScreenSizeChange = deskAdjust; //desk.m.onScreenSizeChange = deskAdjust;
if (debugmode > 0) { desk.m.onScreenSizeChange = mdeskAdjust; } // Multi-Desktop Adjust if (debugmode > 0) { desk.m.onScreenSizeChange = mdeskAdjust; } // Multi-Desktop Adjust
@ -6725,6 +6733,7 @@
desktop.m.CompressionLevel = desktopsettings.quality; // Number from 1 to 100. 50 or less is best. desktop.m.CompressionLevel = desktopsettings.quality; // Number from 1 to 100. 50 or less is best.
desktop.m.ScalingLevel = desktopsettings.scaling; desktop.m.ScalingLevel = desktopsettings.scaling;
if (desktopsettings.framerate) { desktop.m.FrameRateTimer = desktopsettings.framerate; } if (desktopsettings.framerate) { desktop.m.FrameRateTimer = desktopsettings.framerate; }
if (desktopsettings.swapmouse) { desktop.m.SwapMouse = desktopsettings.swapmouse; }
desktop.m.onDisplayinfo = deskDisplayInfo; desktop.m.onDisplayinfo = deskDisplayInfo;
desktop.m.onScreenSizeChange = deskAdjust; desktop.m.onScreenSizeChange = deskAdjust;
desktop.Start(desktopNode._id); desktop.Start(desktopNode._id);
@ -6878,11 +6887,13 @@
desktopsettings.quality = d7bitmapquality.value; desktopsettings.quality = d7bitmapquality.value;
desktopsettings.scaling = d7bitmapscaling.value; desktopsettings.scaling = d7bitmapscaling.value;
desktopsettings.framerate = d7framelimiter.value; desktopsettings.framerate = d7framelimiter.value;
desktopsettings.swapmouse = d7deskSwapMouse.checked;
desktopsettings.localkeymap = d7localKeyMap.checked; desktopsettings.localkeymap = d7localKeyMap.checked;
localStorage.setItem('desktopsettings', JSON.stringify(desktopsettings)); localStorage.setItem('desktopsettings', JSON.stringify(desktopsettings));
applyDesktopSettings(); applyDesktopSettings();
if (desktop) { if (desktop) {
if (desktop.contype == 1) { if (desktop.contype == 1) {
desktop.m.SwapMouse = desktopsettings.swapmouse;
if (desktop.State != 0) { if (desktop.State != 0) {
desktop.m.SendCompressionLevel(1, desktopsettings.quality, desktopsettings.scaling, desktopsettings.framerate); desktop.m.SendCompressionLevel(1, desktopsettings.quality, desktopsettings.scaling, desktopsettings.framerate);
} }
@ -6905,6 +6916,7 @@
if (ops.indexOf(parseInt(desktopsettings.quality)) >= 0) { d7bitmapquality.value = desktopsettings.quality; } if (ops.indexOf(parseInt(desktopsettings.quality)) >= 0) { d7bitmapquality.value = desktopsettings.quality; }
d7bitmapscaling.value = desktopsettings.scaling; d7bitmapscaling.value = desktopsettings.scaling;
if (desktopsettings.framerate) { d7framelimiter.value = desktopsettings.framerate; } else { d7framelimiter.value = 100; } if (desktopsettings.framerate) { d7framelimiter.value = desktopsettings.framerate; } else { d7framelimiter.value = 100; }
if (desktopsettings.swapmouse != null) { d7deskSwapMouse.checked = desktopsettings.swapmouse; }
if (desktopsettings.localkeymap) { d7localKeyMap.checked = desktopsettings.localkeymap; } if (desktopsettings.localkeymap) { d7localKeyMap.checked = desktopsettings.localkeymap; }
QV('deskFocusBtn', (desktop != null) && (desktop.contype == 2) && (desktop.state != 0) && (desktopsettings.showfocus)); QV('deskFocusBtn', (desktop != null) && (desktop.contype == 2) && (desktop.state != 0) && (desktopsettings.showfocus));
} }