Skip to content

Commit c96a419

Browse files
committed
Introduce InternalUtils.wait_for_window_actor_visible
1 parent 84a1352 commit c96a419

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

src/InternalUtils.vala

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -340,25 +340,33 @@ 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 && window_actor.visible) {
343+
if (window_actor != null) {
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 && window_actor.visible) {
351+
if (window_actor != null) {
352352
callback (window_actor);
353-
} else if (window_actor != null) {
353+
}
354+
355+
return Source.REMOVE;
356+
});
357+
}
358+
359+
public static void wait_for_window_actor_visible (Meta.Window window, owned WindowActorReadyCallback callback) {
360+
wait_for_window_actor (window, (window_actor) => {
361+
if (window_actor.visible) {
362+
callback (window_actor);
363+
} else {
354364
ulong show_handler = 0;
355365
show_handler = window_actor.show.connect (() => {
356366
window_actor.disconnect (show_handler);
357367
callback (window_actor);
358368
});
359369
}
360-
361-
return Source.REMOVE;
362370
});
363371
}
364372
}

src/WindowManager.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2120,7 +2120,7 @@ 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-
InternalUtils.wait_for_window_actor (window, (actor) => {
2123+
InternalUtils.wait_for_window_actor_visible (window, (actor) => {
21242124
clutter_actor_reparent (actor, notification_group);
21252125
notification_stack.show_notification (actor);
21262126
});

0 commit comments

Comments
 (0)