summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Mader <robert.mader@posteo.de>2022-07-09 14:27:35 +0200
committerRobert Mader <robert.mader@posteo.de>2022-07-20 20:57:05 +0200
commitfddc87a48edf0ec7c9989fa96bb8ec768f6af707 (patch)
treeea61b8b837ff950e42688472bf0150c0668985ea /src
parent842d1ffabc092ed0695f1dfe6185739fbcc3290e (diff)
downloadmutter-fddc87a48edf0ec7c9989fa96bb8ec768f6af707.tar.gz
window-actor/wayland: Skip unnecessary set_child_at_index() calls
`clutter_actor_set_child_at_index()` is far from a no-op, even if the current index is equal to the new one - presumably for good reasons. For the use-case here we want it to be a no-op though, so skip calling it if the index already matches. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2501> (cherry picked from commit 0f8f30c93f7a24cbbfbd40d2981347994e300afb)
Diffstat (limited to 'src')
-rw-r--r--src/compositor/meta-window-actor-wayland.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/compositor/meta-window-actor-wayland.c b/src/compositor/meta-window-actor-wayland.c
index 09205de5e..f1ac2eab2 100644
--- a/src/compositor/meta-window-actor-wayland.c
+++ b/src/compositor/meta-window-actor-wayland.c
@@ -55,23 +55,26 @@ set_surface_actor_index (GNode *node,
gpointer data)
{
MetaWaylandSurface *surface = node->data;
- MetaSurfaceActor *surface_actor = meta_wayland_surface_get_actor (surface);
SurfaceTreeTraverseData *traverse_data = data;
+ ClutterActor *window_actor = CLUTTER_ACTOR (traverse_data->window_actor);
+ ClutterActor *surface_actor =
+ CLUTTER_ACTOR (meta_wayland_surface_get_actor (surface));
- if (clutter_actor_contains (CLUTTER_ACTOR (traverse_data->window_actor),
- CLUTTER_ACTOR (surface_actor)))
+ if (clutter_actor_contains (window_actor, surface_actor))
{
- clutter_actor_set_child_at_index (
- CLUTTER_ACTOR (traverse_data->window_actor),
- CLUTTER_ACTOR (surface_actor),
- traverse_data->index);
+ if (clutter_actor_get_child_at_index (window_actor, traverse_data->index) !=
+ surface_actor)
+ {
+ clutter_actor_set_child_at_index (window_actor,
+ surface_actor,
+ traverse_data->index);
+ }
}
else
{
- clutter_actor_insert_child_at_index (
- CLUTTER_ACTOR (traverse_data->window_actor),
- CLUTTER_ACTOR (surface_actor),
- traverse_data->index);
+ clutter_actor_insert_child_at_index (window_actor,
+ surface_actor,
+ traverse_data->index);
}
traverse_data->index++;