CopyRect artifacts, fix unload detection on iframes

This commit is contained in:
matt 2023-10-30 15:32:35 -04:00
parent bc177da7eb
commit 2b7f938c6e
3 changed files with 10 additions and 6 deletions

View File

@ -166,8 +166,8 @@ const UI = {
UI.hideKeyboardControls();
}
});
window.addEventListener("beforeunload", (e) => {
window.addEventListener("unload", (e) => {
if (UI.rfb) {
UI.disconnect();
}

View File

@ -21,11 +21,10 @@ const UI = {
//Render default UI
start() {
console.log('start')
window.addEventListener("beforeunload", (e) => {
window.addEventListener("unload", (e) => {
if (UI.rfb) {
UI.disconnect();
}
console.log('beforeunload')
});
@ -312,4 +311,4 @@ const UI = {
UI.prime();
export default UI;
export default UI;

View File

@ -1685,6 +1685,7 @@ export default class RFB extends EventTargetMixin {
this._display.addScreen(event.data.screenID, event.data.width, event.data.height, event.data.pixelRatio, event.data.containerHeight, event.data.containerWidth);
const size = this._screenSize();
RFB.messages.setDesktopSize(this._sock, size, this._screenFlags);
this._sendEncodings();
this._updateContinuousUpdates();
this.dispatchEvent(new CustomEvent("screenregistered", {}));
Log.Info(`Secondary monitor (${event.data.screenID}) has been registered.`);
@ -1702,6 +1703,7 @@ export default class RFB extends EventTargetMixin {
Log.Info(`Secondary monitor (${event.data.screenID}) has been removed.`);
const size = this._screenSize();
RFB.messages.setDesktopSize(this._sock, size, this._screenFlags);
this._sendEncodings();
this._updateContinuousUpdates();
this.dispatchEvent(new CustomEvent("screenregistered", {}));
} else {
@ -2859,7 +2861,10 @@ export default class RFB extends EventTargetMixin {
const encs = [];
// In preference order
encs.push(encodings.encodingCopyRect);
// Disable copyrect when using multiple displays
if (this._display.screens.length === 1) {
encs.push(encodings.encodingCopyRect);
}
// Only supported with full depth support
if (this._fbDepth == 24) {
encs.push(encodings.encodingTight);