[mutter/gnome-42] window-actor/wayland: Skip unnecessary set_child_at_index() calls
- From: Robert Mader <rmader src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gnome-42] window-actor/wayland: Skip unnecessary set_child_at_index() calls
- Date: Wed, 20 Jul 2022 19:40:52 +0000 (UTC)
commit fddc87a48edf0ec7c9989fa96bb8ec768f6af707
Author: Robert Mader <robert mader posteo de>
Date: Sat Jul 9 14:27:35 2022 +0200
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)
src/compositor/meta-window-actor-wayland.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/src/compositor/meta-window-actor-wayland.c b/src/compositor/meta-window-actor-wayland.c
index 09205de5e4..f1ac2eab24 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++;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]