KASM-5523 change resize settings if admin prohibited on server (#93)

* KASM-5523 change resize settings if admin prohibited on server

* Fix local scaling aspect ratio

* fix exception on reconnect

* Always recalculate resolution on setting changes

---------

Co-authored-by: mattmcclaskey <matt@kasmweb.com>
This commit is contained in:
Matt McClaskey 2024-01-30 11:48:23 -05:00 committed by GitHub
parent 7ce3f140f5
commit 4c6127b47b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 7 deletions

View File

@ -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
}

View File

@ -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++) {

View File

@ -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,9 +2045,6 @@ export default class RFB extends EventTargetMixin {
}
}
} else {
Log.Debug("Mouse left Window");
Log.Debug(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";