Skip to content

Commit bad84a6

Browse files
committed
WindowManager: Only show notifications after their window was shown
1 parent c7d14d6 commit bad84a6

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

src/InternalUtils.vala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,5 +355,17 @@ namespace Gala {
355355
return Source.REMOVE;
356356
});
357357
}
358+
359+
public static void wait_for_window_actor_to_show (Meta.Window window, owned WindowActorReadyCallback callback) {
360+
unowned var window_actor = (Meta.WindowActor) window.get_compositor_private ();
361+
if (window_actor.visible) {
362+
callback (window_actor);
363+
return;
364+
}
365+
366+
InternalUtils.wait_for_window_actor (window, (actor) => {
367+
actor.show.connect (() => callback (actor));
368+
});
369+
}
358370
}
359371
}

src/WindowManager.vala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2120,9 +2120,10 @@ namespace Gala {
21202120
// TODO: currently only notifications are handled here, other windows should be too
21212121
switch_workspace_window_created_id = window_created.connect ((window) => {
21222122
if (NotificationStack.is_notification (window)) {
2123-
unowned var actor = (Meta.WindowActor) window.get_compositor_private ();
2124-
clutter_actor_reparent (actor, notification_group);
2125-
notification_stack.show_notification (actor);
2123+
InternalUtils.wait_for_window_actor_to_show (window, (actor) => {
2124+
clutter_actor_reparent (actor, notification_group);
2125+
notification_stack.show_notification (actor);
2126+
});
21262127
}
21272128
});
21282129

0 commit comments

Comments
 (0)