Skip to content

Commit

Permalink
Introduce InternalUtils.wait_for_window_actor_visible (#2188)
Browse files Browse the repository at this point in the history
  • Loading branch information
leolost2605 authored Dec 21, 2024
1 parent 84a1352 commit ae33e82
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
18 changes: 13 additions & 5 deletions src/InternalUtils.vala
Original file line number Diff line number Diff line change
Expand Up @@ -340,25 +340,33 @@ 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 && window_actor.visible) {
if (window_actor != null) {
callback (window_actor);
return;
}

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

if (window_actor != null && window_actor.visible) {
if (window_actor != null) {
callback (window_actor);
} else if (window_actor != null) {
}

return Source.REMOVE;
});
}

public static void wait_for_window_actor_visible (Meta.Window window, owned WindowActorReadyCallback callback) {
wait_for_window_actor (window, (window_actor) => {
if (window_actor.visible) {
callback (window_actor);
} else {
ulong show_handler = 0;
show_handler = window_actor.show.connect (() => {
window_actor.disconnect (show_handler);
callback (window_actor);
});
}

return Source.REMOVE;
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/WindowManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -2120,7 +2120,7 @@ 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)) {
InternalUtils.wait_for_window_actor (window, (actor) => {
InternalUtils.wait_for_window_actor_visible (window, (actor) => {
clutter_actor_reparent (actor, notification_group);
notification_stack.show_notification (actor);
});
Expand Down

0 comments on commit ae33e82

Please sign in to comment.