1) fix restacking log warning 2) use connectObject API
This commit is contained in:
parent
f57f805dd5
commit
c33f18c4d5
@ -118,7 +118,8 @@ class WorkspaceGroup extends Clutter.Actor {
|
||||
|
||||
this._createWindows();
|
||||
this.connect('destroy', this._onDestroy.bind(this));
|
||||
this._restackedId = global.display.connect('restacked', this._syncStacking.bind(this));
|
||||
global.display.connectObject('restacked',
|
||||
this._syncStacking.bind(this), this);
|
||||
}
|
||||
|
||||
get workspace() {
|
||||
@ -144,10 +145,12 @@ class WorkspaceGroup extends Clutter.Actor {
|
||||
this._shouldShowWindow(w.meta_window));
|
||||
|
||||
let lastRecord;
|
||||
const bottomActor = this._background ?? null;
|
||||
|
||||
for (const windowActor of windowActors) {
|
||||
const record = this._windowRecords.find(r => r.windowActor === windowActor);
|
||||
this.set_child_above_sibling(record.clone, lastRecord ? lastRecord.clone : this._background);
|
||||
this.set_child_above_sibling(record.clone,
|
||||
lastRecord ? lastRecord.clone : bottomActor);
|
||||
lastRecord = record;
|
||||
}
|
||||
}
|
||||
@ -166,24 +169,22 @@ class WorkspaceGroup extends Clutter.Actor {
|
||||
});
|
||||
this.add_child(clone);
|
||||
const record = {windowActor, clone };
|
||||
record.windowDestroyId = windowActor.connect('destroy', () => {
|
||||
windowActor.connectObject('destroy', () => {
|
||||
clone.destroy();
|
||||
this._windowRecords.splice(this._windowRecords.indexOf(record), 1);
|
||||
});
|
||||
}, this);
|
||||
this._windowRecords.push(record);
|
||||
}
|
||||
}
|
||||
|
||||
_removeWindows() {
|
||||
for (const record of this._windowRecords) {
|
||||
record.windowActor.disconnect(record.windowDestroyId);
|
||||
record.clone.destroy();
|
||||
}
|
||||
this._windowRecords = [];
|
||||
}
|
||||
|
||||
_onDestroy() {
|
||||
global.display.disconnect(this._restackedId);
|
||||
this._removeWindows();
|
||||
this._bgManager.destroy();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user