Skip to content

Commit 0300bd6

Browse files
committed
Guarantee window actor while window is in the model
1 parent 9c3bc71 commit 0300bd6

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/WindowListModel.vala

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
* Authored by: Leonhard Kargl <[email protected]>
66
*/
77

8+
/**
9+
* A list model that provides all current windows optionally filtered and sorted.
10+
* While a window is in the model it is guaranteed to have an associated actor, i.e.
11+
* {@link Meta.Window.get_compositor_private} will not return null.
12+
*/
813
public class Gala.WindowListModel : Object, ListModel {
914
public enum SortMode {
1015
NONE,
@@ -69,11 +74,11 @@ public class Gala.WindowListModel : Object, ListModel {
6974
}
7075

7176
private void on_window_created (Meta.Window window) {
72-
window.unmanaged.connect (on_window_unmanaged);
73-
check_window (window);
77+
window.unmanaging.connect (on_window_unmanaging);
78+
InternalUtils.wait_for_window_actor (window, (actor) => check_window (actor.meta_window));
7479
}
7580

76-
private void on_window_unmanaged (Meta.Window window) {
81+
private void on_window_unmanaging (Meta.Window window) {
7782
var pos = windows.index_of (window);
7883
if (pos >= 0) {
7984
windows.remove_at (pos);

0 commit comments

Comments
 (0)