Skip to content

Commit 84a1352

Browse files
WindowManager: Only show notifications after their window was shown (#2183)
Co-authored-by: Leonhard <[email protected]>
1 parent 6d6f4b0 commit 84a1352

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/InternalUtils.vala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,16 +340,22 @@ namespace Gala {
340340

341341
public static void wait_for_window_actor (Meta.Window window, owned WindowActorReadyCallback callback) {
342342
unowned var window_actor = (Meta.WindowActor) window.get_compositor_private ();
343-
if (window_actor != null) {
343+
if (window_actor != null && window_actor.visible) {
344344
callback (window_actor);
345345
return;
346346
}
347347

348348
Idle.add (() => {
349349
window_actor = (Meta.WindowActor) window.get_compositor_private ();
350350

351-
if (window_actor != null) {
351+
if (window_actor != null && window_actor.visible) {
352352
callback (window_actor);
353+
} else if (window_actor != null) {
354+
ulong show_handler = 0;
355+
show_handler = window_actor.show.connect (() => {
356+
window_actor.disconnect (show_handler);
357+
callback (window_actor);
358+
});
353359
}
354360

355361
return Source.REMOVE;

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 (window, (actor) => {
2124+
clutter_actor_reparent (actor, notification_group);
2125+
notification_stack.show_notification (actor);
2126+
});
21262127
}
21272128
});
21282129

0 commit comments

Comments
 (0)