Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/InternalUtils.vala
Original file line number Diff line number Diff line change
Expand Up @@ -348,5 +348,25 @@ namespace Gala {

return actor_box;
}

public delegate void WindowActorReadyCallback (Meta.WindowActor window_actor);

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) {
callback (window_actor);
return;
}

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

if (window_actor != null) {
callback (window_actor);
}

return Source.REMOVE;
});
}
}
}
16 changes: 2 additions & 14 deletions src/Widgets/WindowClone.vala
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public class Gala.WindowClone : Clutter.Actor {

reallocate ();

load_clone ();
InternalUtils.wait_for_window_actor (window, load_clone);

window.notify["title"].connect (() => window_title.set_text (window.get_title () ?? ""));
window_title.set_text (window.get_title () ?? "");
Expand Down Expand Up @@ -182,19 +182,7 @@ public class Gala.WindowClone : Clutter.Actor {
* itself at the location of the original window. Also adds the shadow
* effect and makes sure the shadow is updated on size changes.
*/
private void load_clone () {
var actor = (Meta.WindowActor) window.get_compositor_private ();
if (actor == null) {
Idle.add (() => {
if (window.get_compositor_private () != null) {
load_clone ();
}
return Source.REMOVE;
});

return;
}

private void load_clone (Meta.WindowActor actor) {
if (overview_mode) {
actor.hide ();
}
Expand Down
Loading