Skip to content

Commit d5cb0b4

Browse files
authored
Move clutter_actor_reparent to InternalUtils (#2223)
1 parent ff7c2cb commit d5cb0b4

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

src/InternalUtils.vala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,5 +369,16 @@ namespace Gala {
369369
}
370370
});
371371
}
372+
373+
public static void clutter_actor_reparent (Clutter.Actor actor, Clutter.Actor new_parent) {
374+
if (actor == new_parent) {
375+
return;
376+
}
377+
378+
actor.ref ();
379+
actor.get_parent ().remove_child (actor);
380+
new_parent.add_child (actor);
381+
actor.unref ();
382+
}
372383
}
373384
}

src/WindowManager.vala

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,7 +1439,7 @@ namespace Gala {
14391439
// Notifications are a special case and have to be always be handled
14401440
// (also regardless of the animation setting)
14411441
if (NotificationStack.is_notification (window)) {
1442-
clutter_actor_reparent (actor, notification_group);
1442+
InternalUtils.clutter_actor_reparent (actor, notification_group);
14431443
notification_stack.show_notification (actor);
14441444

14451445
map_completed (actor);
@@ -1945,7 +1945,7 @@ namespace Gala {
19451945
windows.append (actor);
19461946
parents.append (actor.get_parent ());
19471947

1948-
clutter_actor_reparent (actor, static_windows);
1948+
InternalUtils.clutter_actor_reparent (actor, static_windows);
19491949
actor.set_translation (-clone_offset_x, -clone_offset_y, 0);
19501950

19511951
// Don't fade docks and moving/grabbed windows they just stay where they are
@@ -1966,7 +1966,7 @@ namespace Gala {
19661966
windows.append (actor);
19671967
parents.append (actor.get_parent ());
19681968
actor.set_translation (-clone_offset_x, -clone_offset_y, 0);
1969-
clutter_actor_reparent (actor, out_group);
1969+
InternalUtils.clutter_actor_reparent (actor, out_group);
19701970

19711971
if (window.fullscreen)
19721972
from_has_fullscreened = true;
@@ -1975,7 +1975,7 @@ namespace Gala {
19751975
windows.append (actor);
19761976
parents.append (actor.get_parent ());
19771977
actor.set_translation (-clone_offset_x, -clone_offset_y, 0);
1978-
clutter_actor_reparent (actor, in_group);
1978+
InternalUtils.clutter_actor_reparent (actor, in_group);
19791979

19801980
if (window.fullscreen)
19811981
to_has_fullscreened = true;
@@ -2050,7 +2050,7 @@ namespace Gala {
20502050
switch_workspace_window_created_id = window_created.connect ((window) => {
20512051
if (NotificationStack.is_notification (window)) {
20522052
InternalUtils.wait_for_window_actor_visible (window, (actor) => {
2053-
clutter_actor_reparent (actor, notification_group);
2053+
InternalUtils.clutter_actor_reparent (actor, notification_group);
20542054
notification_stack.show_notification (actor);
20552055
});
20562056
}
@@ -2180,13 +2180,13 @@ namespace Gala {
21802180

21812181
unowned Meta.WindowActor? window = actor as Meta.WindowActor;
21822182
if (window == null) {
2183-
clutter_actor_reparent (actor, parents.nth_data (i));
2183+
InternalUtils.clutter_actor_reparent (actor, parents.nth_data (i));
21842184
continue;
21852185
}
21862186

21872187
unowned Meta.Window? meta_window = window.get_meta_window ();
21882188
if (!window.is_destroyed ()) {
2189-
clutter_actor_reparent (actor, parents.nth_data (i));
2189+
InternalUtils.clutter_actor_reparent (actor, parents.nth_data (i));
21902190
}
21912191

21922192
kill_window_effects (window);
@@ -2350,15 +2350,5 @@ namespace Gala {
23502350
// Ignore this error
23512351
}
23522352
}
2353-
2354-
private static void clutter_actor_reparent (Clutter.Actor actor, Clutter.Actor new_parent) {
2355-
if (actor == new_parent)
2356-
return;
2357-
2358-
actor.ref ();
2359-
actor.get_parent ().remove_child (actor);
2360-
new_parent.add_child (actor);
2361-
actor.unref ();
2362-
}
23632353
}
23642354
}

0 commit comments

Comments
 (0)