fix latency bouncing monitors (#5756)

Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
Simon Smith 2024-02-02 10:22:25 +00:00 committed by GitHub
parent e6f27fca36
commit 550ee34f00
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -730,7 +730,7 @@
</div> </div>
<div id=deskarea4 class="areaFoot"> <div id=deskarea4 class="areaFoot">
<div class="toright2"> <div class="toright2">
<span id="DeskLatency" title="Desktop Session Latency"></span> <span id="DeskLatency" style="line-height:22px;width:50px" title="Desktop Session Latency"></span>
<span id="DeskTimer" style="line-height:22px" title="Session time"></span> <span id="DeskTimer" style="line-height:22px" title="Session time"></span>
<input id=DeskToolsButton type=button value=Tools title="Toggle tools view" onkeypress="return false" onkeydown="return false" onclick="toggleDeskTools()" /> <input id=DeskToolsButton type=button value=Tools title="Toggle tools view" onkeypress="return false" onkeydown="return false" onclick="toggleDeskTools()" />
<span>&nbsp;</span> <span>&nbsp;</span>
@ -9014,6 +9014,8 @@
QV('deskkeys', inputAllowed); QV('deskkeys', inputAllowed);
QE('deskkeys', desktop != null); QE('deskkeys', desktop != null);
QV('DeskTimer', deskState == 3); QV('DeskTimer', deskState == 3);
QV('DeskLatency', deskState == 3);
QS('DeskLatency').display = (deskState == 3 ? 'inline-block' : 'none');
// Enable browser clipboard read if supported // Enable browser clipboard read if supported
var autoclipboard = ((desktop) && (desktop.contype == 4)) ? desktopsettings.rdpautoclipboard : desktopsettings.autoclipboard; var autoclipboard = ((desktop) && (desktop.contype == 4)) ? desktopsettings.rdpautoclipboard : desktopsettings.autoclipboard;
@ -9420,9 +9422,10 @@
// Desktop // Desktop
var latencyStr = '', seconds = 0; var latencyStr = '', seconds = 0;
if (desktop && desktop.startTime) { if (desktop && desktop.startTime) {
if (desktop.latency && (desktop.latency.current >= 0)) { latencyStr = format('{0} ms, ', desktop.latency.current); } if (desktop.latency && (desktop.latency.current >= 0)) { latencyStr = format('{0} ms', desktop.latency.current); }
seconds = Math.floor((new Date() - desktop.startTime) / 1000); seconds = Math.floor((new Date() - desktop.startTime) / 1000);
QH('DeskTimer', latencyStr + zeroPad(Math.floor(seconds / 3600), 2) + ':' + zeroPad((Math.floor(seconds / 60) % 60), 2) + ':' + zeroPad((seconds % 60), 2)); QH('DeskTimer', zeroPad(Math.floor(seconds / 3600), 2) + ':' + zeroPad((Math.floor(seconds / 60) % 60), 2) + ':' + zeroPad((seconds % 60), 2));
QH('DeskLatency', latencyStr);
// Auto-clipboard // Auto-clipboard
if ((((desktop.contype != 4) && (desktopsettings.autoclipboard === true)) || ((desktop.contype == 4) && (desktopsettings.rdpautoclipboard === true))) && (navigator.clipboard != null) && (navigator.clipboard.readText != null)) { if ((((desktop.contype != 4) && (desktopsettings.autoclipboard === true)) || ((desktop.contype == 4) && (desktopsettings.rdpautoclipboard === true))) && (navigator.clipboard != null) && (navigator.clipboard.readText != null)) {
try { try {
@ -9437,6 +9440,7 @@
} }
} else { } else {
QH('DeskTimer', ''); QH('DeskTimer', '');
QH('DeskLatency', '');
} }
// Terminal // Terminal