diff --git a/app/styles/base.css b/app/styles/base.css index e97c2905..b43fb54c 100644 --- a/app/styles/base.css +++ b/app/styles/base.css @@ -1291,6 +1291,13 @@ a:visited { background-color: #f1f1f1; font-size: 13px; border: 1px solid #e5e5e5; + line-height: 1; +} +#noVNC_setting_enable_hidpi_option { + display: none!important; +} +#noVNC_setting_enable_hidpi_option.show { + display: flex!important; } #noVNC_refreshMonitors { position: absolute; diff --git a/app/ui.js b/app/ui.js index 3a1270af..50aad392 100644 --- a/app/ui.js +++ b/app/ui.js @@ -1869,18 +1869,28 @@ const UI = { initMonitors(screenPlan) { const { scale } = UI.multiMonitorSettings() let monitors = [] + let showNativeResolution = false screenPlan.screens.forEach(screen => { + if (parseFloat(screen.pixelRatio) != 1) { + showNativeResolution = true + } monitors.push({ id: screen.screenID, x: screen.x / scale, y: screen.y / scale, w: screen.serverWidth / scale, h: screen.serverHeight / scale, + pixelRatio: screen.pixelRatio, scale: 1, fill: '#eeeeeecc', isDragging: false }) }) + if (showNativeResolution) { + document.getElementById('noVNC_setting_enable_hidpi_option').classList.add("show"); + } else { + document.getElementById('noVNC_setting_enable_hidpi_option').classList.remove("show"); + } UI.monitors = monitors }, @@ -2775,7 +2785,7 @@ const UI = { // Get the current screen plan // When a new display is added, it is defaulted to be placed to the far right relative to existing displays and to the top let screenPlan = UI.rfb.getScreenPlan(); - + console.log(e) // Now make adjustments to the screen plan, this is just an example // screenPlan.screens[1].y = 0; diff --git a/core/rfb.js b/core/rfb.js index cfaa9b98..69bd0964 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -1491,6 +1491,7 @@ export default class RFB extends EventTargetMixin { //re-register the secondary display with new resolution this._registerSecondaryDisplay(); } + this.dispatchEvent(new CustomEvent("screenregistered", {})); } // Gets the the size of the available screen @@ -1677,6 +1678,7 @@ export default class RFB extends EventTargetMixin { break; case 'unregister': if (this._display.removeScreen(event.data.screenID)) { + this.dispatchEvent(new CustomEvent("screenregistered", {})); Log.Info(`Secondary monitor (${event.data.screenID}) has been removed.`); const size = this._screenSize(); RFB.messages.setDesktopSize(this._sock, size, this._screenFlags); diff --git a/vnc.html b/vnc.html index 1ccc0354..024f4471 100644 --- a/vnc.html +++ b/vnc.html @@ -553,8 +553,8 @@ Add Monitor -