Skip to content

Commit

Permalink
WindowManager: Only show notifications after their window was shown (#…
Browse files Browse the repository at this point in the history
…2183)

Co-authored-by: Leonhard <[email protected]>
  • Loading branch information
lenemter and leolost2605 authored Dec 21, 2024
1 parent 6d6f4b0 commit 84a1352
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
10 changes: 8 additions & 2 deletions src/InternalUtils.vala
Original file line number Diff line number Diff line change
Expand Up @@ -340,16 +340,22 @@ namespace Gala {

public static void wait_for_window_actor (Meta.Window window, owned WindowActorReadyCallback callback) {
unowned var window_actor = (Meta.WindowActor) window.get_compositor_private ();
if (window_actor != null) {
if (window_actor != null && window_actor.visible) {
callback (window_actor);
return;
}

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

if (window_actor != null) {
if (window_actor != null && window_actor.visible) {
callback (window_actor);
} else if (window_actor != null) {
ulong show_handler = 0;
show_handler = window_actor.show.connect (() => {
window_actor.disconnect (show_handler);
callback (window_actor);
});
}

return Source.REMOVE;
Expand Down
7 changes: 4 additions & 3 deletions src/WindowManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -2120,9 +2120,10 @@ namespace Gala {
// TODO: currently only notifications are handled here, other windows should be too
switch_workspace_window_created_id = window_created.connect ((window) => {
if (NotificationStack.is_notification (window)) {
unowned var actor = (Meta.WindowActor) window.get_compositor_private ();
clutter_actor_reparent (actor, notification_group);
notification_stack.show_notification (actor);
InternalUtils.wait_for_window_actor (window, (actor) => {
clutter_actor_reparent (actor, notification_group);
notification_stack.show_notification (actor);
});
}
});

Expand Down

0 comments on commit 84a1352

Please sign in to comment.