(metaWindow)
| 979 | } |
| 980 | |
| 981 | removeWindow(metaWindow) { |
| 982 | const index = this.indexOf(metaWindow); |
| 983 | if (index === -1) |
| 984 | return this.removeFloating(metaWindow); |
| 985 | |
| 986 | this.signals.disconnect(metaWindow); |
| 987 | |
| 988 | if (this.selectedWindow === metaWindow) { |
| 989 | // Select a new window using the stack ordering; |
| 990 | let windows = this.getWindows(); |
| 991 | let i = windows.indexOf(metaWindow); |
| 992 | let neighbours = [windows[i - 1], windows[i + 1]].filter(w => w); |
| 993 | let stack = sortWindows(this, neighbours); |
| 994 | this.selectedWindow = stack[stack.length - 1]; |
| 995 | } |
| 996 | |
| 997 | const column = this[index]; |
| 998 | const row = column.indexOf(metaWindow); |
| 999 | column.splice(row, 1); |
| 1000 | if (column.length === 0) { |
| 1001 | this.splice(index, 1); |
| 1002 | } |
| 1003 | |
| 1004 | this.visible.splice(this.visible.indexOf(metaWindow), 1); |
| 1005 | |
| 1006 | const clone = metaWindow.clone; |
| 1007 | // this.cloneContainer.remove_child(clone); |
| 1008 | Utils.actor_remove_child(this.cloneContainer, clone); |
| 1009 | |
| 1010 | // Don't destroy the selection highlight widget |
| 1011 | if (clone.first_child.name === 'selection') { |
| 1012 | // clone.remove_child(clone.first_child); |
| 1013 | Utils.actor_remove_child(clone, clone.first_child); |
| 1014 | } |
| 1015 | |
| 1016 | const actor = metaWindow.get_compositor_private(); |
| 1017 | if (actor) |
| 1018 | actor.remove_clip(); |
| 1019 | |
| 1020 | this.layout(); |
| 1021 | if (this.selectedWindow) { |
| 1022 | ensureViewport(this.selectedWindow, this); |
| 1023 | } else { |
| 1024 | // can also be undefined here, will set to null explicitly |
| 1025 | this.selectedWindow = null; |
| 1026 | } |
| 1027 | |
| 1028 | this.emit('window-removed', metaWindow, index, row); |
| 1029 | return true; |
| 1030 | } |
| 1031 | |
| 1032 | isFloating(metaWindow) { |
| 1033 | return this._floating.indexOf(metaWindow) !== -1; |
no test coverage detected