unregister a display if window closes
This commit is contained in:
parent
c35b8c68f3
commit
23076cdc7c
|
@ -220,7 +220,9 @@ const UI = {
|
||||||
},
|
},
|
||||||
|
|
||||||
disconnect() {
|
disconnect() {
|
||||||
|
if (UI.rfb) {
|
||||||
|
UI.rfb.disconnect();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
connectFinished(e) {
|
connectFinished(e) {
|
||||||
|
|
|
@ -418,9 +418,10 @@ export default class Display {
|
||||||
}
|
}
|
||||||
|
|
||||||
removeScreen(screenID) {
|
removeScreen(screenID) {
|
||||||
if (this.isPrimaryDisplay) {
|
if (this._isPrimaryDisplay) {
|
||||||
for (let i=1; i<this._screens.length; i++) {
|
for (let i=1; i<this._screens.length; i++) {
|
||||||
if (this._screens[i].screenID == screenID) {
|
if (this._screens[i].screenID == screenID) {
|
||||||
|
this._screens[i].channel.close();
|
||||||
this._screens.splice(i, 1);
|
this._screens.splice(i, 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
16
core/rfb.js
16
core/rfb.js
|
@ -770,11 +770,14 @@ export default class RFB extends EventTargetMixin {
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnect() {
|
disconnect() {
|
||||||
if (this._rfbConnectionState !== 'proxied') {
|
if (this._isPrimaryDisplay) {
|
||||||
this._updateConnectionState('disconnecting');
|
this._updateConnectionState('disconnecting');
|
||||||
this._sock.off('error');
|
this._sock.off('error');
|
||||||
this._sock.off('message');
|
this._sock.off('message');
|
||||||
this._sock.off('open');
|
this._sock.off('open');
|
||||||
|
} else {
|
||||||
|
this._updateConnectionState('disconnecting');
|
||||||
|
this._unregisterSecondaryDisplay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1676,6 +1679,17 @@ export default class RFB extends EventTargetMixin {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_unregisterSecondaryDisplay() {
|
||||||
|
if (!this._isPrimaryDisplay){
|
||||||
|
let message = {
|
||||||
|
eventType: 'unregister',
|
||||||
|
screenID: this._display.screenId
|
||||||
|
}
|
||||||
|
this._controlChannel.postMessage(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
_registerSecondaryDisplay() {
|
_registerSecondaryDisplay() {
|
||||||
if (!this._isPrimaryDisplay) {
|
if (!this._isPrimaryDisplay) {
|
||||||
//let screen = this._screenSize().screens[0];
|
//let screen = this._screenSize().screens[0];
|
||||||
|
|
Loading…
Reference in New Issue