Improved remote desktop multi-display selector, #3730

Ylian Saint-Hilaire committed Mar 2, 2022 at 15:29 UTC b5f16e7a5241026937c83a3d377c5f861a66e564
5 files changed +12 -11
public/images/icon-monitor1.png
Binary files /dev/null and b/public/images/icon-monitor1.png differ
public/images/icon-monitor2.png
Binary files /dev/null and b/public/images/icon-monitor2.png differ
public/images/monitor32.png
Binary files /dev/null and b/public/images/monitor32.png differ
public/styles/style.css
+1 -1
@@ -2654,7 +2654,7 @@ a {
2654 -ms-grid-row: 4;
2655 }
2656
2657 -#DeskChatButton, #DeskNotifyButton, #DeskOpenWebButton, #DeskBackgroundButton, #DeskSaveImageButton, #DeskRecordButton, #DeskClipboardInButton, #DeskClipboardOutButton, #DeskRefreshButton, #DeskLockButton, #DeskInputLockedButton, #DeskInputUnLockedButton, #DeskGuestShareButton {
2657 +#DeskChatButton, #DeskNotifyButton, #DeskOpenWebButton, #DeskBackgroundButton, #DeskSaveImageButton, #DeskRecordButton, #DeskClipboardInButton, #DeskClipboardOutButton, #DeskRefreshButton, #DeskLockButton, #DeskInputLockedButton, #DeskInputUnLockedButton, #DeskGuestShareButton, #DeskMonitorSelectionSpan {
2658 float: right;
2659 margin-top: 1px;
2660 margin-right: 4px;
views/default.handlebars
+11 -10
@@ -676,9 +676,8 @@
676 <div id=deskarea4 class="areaFoot">
677 <div class="toright2">
678 <span id="DeskLatency" title="Desktop Session Latency"></span>
679 - <span id="DeskTimer" title="Session time"></span>&nbsp;
680 - <select id=termdisplays style="display:none" onchange=deskSetDisplay(event) onkeypress="return false" onkeydown="return false"></select>&nbsp;
681 - <input id=DeskToolsButton type=button value=Tools title="Toggle tools view" onkeypress="return false" onkeydown="return false" onclick="toggleDeskTools()" />&nbsp;
679 + <span id="DeskTimer" title="Session time"></span>
680 + <input id=DeskToolsButton type=button value=Tools title="Toggle tools view" onkeypress="return false" onkeydown="return false" onclick="toggleDeskTools()" />
681 <span id=DeskChatButton class="deskarea" title="Open chat window to this computer"><img class="desktopButtons" src='images/icon-chat.png' onclick=deviceChat(event) height=16 width=16 style=padding-top:2px /></span>
682 <span id=DeskNotifyButton title="Display a notification on the remote computer"><img class="desktopButtons" src='images/icon-notify.png' onclick=deviceToastFunction() height=16 width=16 style=padding-top:2px /></span>
683 <span id=DeskLockButton title="Lock the remote computer"><img src='images/icon-lock.png' class="desktopButtons" onclick=deviceLockFunction() height=16 width=16 /></span>
@@ -692,7 +691,9 @@
691 <span id=DeskInputLockedButton title="Remote input is locked"><img class="desktopButtons" id=DeskInputLockedButtonImage src='images/icon-keylock-red.png' onclick=deskInputLockFunction(0) height=16 width=16 /></span>
692 <span id=DeskInputUnLockedButton title="Remote input is unlocked"><img class="desktopButtons" id=DeskInputUnLockedButtonImage src='images/icon-keylock.png' onclick=deskInputLockFunction(1) height=16 width=16 /></span>
693 <span id=DeskGuestShareButton title="Share the device with a guest"><img class="desktopButtons" id=DeskInputUnLockedButtonImage src='images/icon-share2.png' onclick=showShareDevice() height=16 width=16 /></span>
694 +
695 </div>
696 + <div class="toright2"><span id=DeskMonitorSelectionSpan></span></div>
697 <div>
698 <select id="deskkeys" cmenu=deskKeyShortcutContextMenu></select>
699 <input id="DeskWD" type=button value="Send" onkeypress="return false" onkeydown="return false" onclick="deskSendKeys()" />
@@ -8551,7 +8552,7 @@
8552 desktop.Stop();
8553 desktopNode = desktop = null;
8554 QV('DeskFocus', false);
8554 - QV('termdisplays', false);
8555 + QV('DeskMonitorSelectionSpan', false);
8556 QV('deskRecordIcon', false);
8557 QV('DeskInputLockedButton', false);
8558 QV('DeskInputUnLockedButton', false);
@@ -9313,20 +9314,20 @@
9314 var displayCount = 0, displaySelector = '';
9315 for (var i in displays) {
9316 displayCount++;
9316 - var str = displays[i];
9317 - if (str == 'All Displays') { str = "All Displays"; } // Language translation
9317 + var str = displays[i], allDisplays = 1;
9318 + if (str == 'All Displays') { str = "All Displays"; allDisplays = 2; } // Language translation
9319 if (str.startsWith('Display ')) { str = format("Display {0}", str.substring(8)); } // Language translation
9319 - displaySelector += '<option' + ((selDisplay == i) ? ' selected' : '') + ' value=' + i + '>' + str + '</option>';
9320 + displaySelector += '<img id=DeskMonitorSelectionX' + i + ' class="' + ((selDisplay == i) ? '' : ' gray') + '" src=\'images/icon-monitor' + allDisplays + '.png\' title="' + EscapeHtml(str) + '" onclick=deskSetDisplay(' + i + ') height=16 width=16 style=padding-top:2px;margin-left:2px />';
9321 if ((deskPreferedStickyDisplay == i) && (selDisplay != deskPreferedStickyDisplay)) { desktop.m.SetDisplay(i); }
9322 deskPreferedStickyDisplay = -1;
9323 }
9323 - QH('termdisplays', displaySelector);
9324 - QV('termdisplays', displayCount > 1);
9324 + QH('DeskMonitorSelectionSpan', displaySelector);
9325 + QV('DeskMonitorSelectionSpan', displayCount > 1);
9326 }
9327
9328 function deskGetDisplayNumbers(e) { desktop.m.GetDisplayNumbers(); }
9329 var deskPreferedStickyDisplay = -1;
9329 - function deskSetDisplay(e) { desktop.m.SetDisplay(deskPreferedStickyDisplay = parseInt(Q('termdisplays').value)); Q('termdisplays').blur(); }
9330 + function deskSetDisplay(v) { desktop.m.SetDisplay(deskPreferedStickyDisplay = parseInt(v)); }
9331
9332 // Double click detection. This is important for macOS.
9333 var dblClickDetectArgs = { t:0, x:0, y:0 };