diff --git a/app/ui.js b/app/ui.js index d2a4ad9e..f17aca15 100644 --- a/app/ui.js +++ b/app/ui.js @@ -2922,7 +2922,7 @@ const UI = { if (e && e.detail) { const { left, top, screenID } = e.detail const current = screenPlan.screens.findIndex(el => el.screenID === screenID) - if (current) { + if (current > -1) { screenPlan.screens[current].x = left screenPlan.screens[current].y = top } diff --git a/core/display.js b/core/display.js index 3b100378..4f1c75fd 100644 --- a/core/display.js +++ b/core/display.js @@ -304,7 +304,7 @@ export default class Display { this._screens[i].width = Math.floor(width * clientServerRatioW); this._screens[i].serverWidth = width; this._screens[i].serverHeight = height; - this._screens[i].scale = this._screens[i].width / this._screens[i].serverWidth; + this._screens[i].scale = Math.min(clientServerRatioH, clientServerRatioW); for (i = 0; i < this._screens.length; i++) { diff --git a/core/rfb.js b/core/rfb.js index 8d4329c3..3b597347 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -845,6 +845,7 @@ export default class RFB extends EventTargetMixin { } if (this._pendingApplyResolutionChange) { + this._screenSize(); // Scaling trumps clipping, so we may need to adjust // clipping when enabling or disabling scaling if (this._scaleViewport && this._clipViewport) { @@ -860,7 +861,6 @@ export default class RFB extends EventTargetMixin { } if (this._resizeSession || (this._forcedResolutionX && this._forcedResolutionY)) { - this._screenSize(); this.dispatchEvent(new CustomEvent("screenregistered", {})); clearTimeout(this._resizeTimeout); this._resizeTimeout = setTimeout(this._requestRemoteResize.bind(this), 500); @@ -2045,10 +2045,7 @@ export default class RFB extends EventTargetMixin { } } - } else { - Log.Debug("Mouse left Window"); - Log.Debug(ev); - } + } } _handleMouse(ev) { @@ -4124,6 +4121,10 @@ export default class RFB extends EventTargetMixin { switch (this._FBU.y) { case 1: msg = "Resize is administratively prohibited"; + this._resizeSession = false; + this._clipViewport = false; + this._scaleViewport = false; + this.updateConnectionSettings(); break; case 2: msg = "Out of resources";