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