[totem] backend: prevent excessive relayouts stopping animations



commit 4daca1c359120738994f45ccf180f48b3cbd3052
Author: Lionel Landwerlin <llandwerlin gmail com>
Date:   Tue Jul 2 18:19:40 2013 +0100

    backend: prevent excessive relayouts stopping animations
    
    Every time the elapsed time widget is updating its content, this
    triggers a relayout that propagates to the toplevel actor (ie the
    stage). Because of the way constraints work, when a relayout is queued
    on an actor that is the source of a constraint, it will automatically
    queue a relayout on the destination of the constraint too. And because
    of the constraints applied between the stage and some of the children,
    any relayout triggered by any actor within the scene was relayouting
    almost everything, and therefore stopping animations.
    
    This patch removes the usage of constraints in favor of layout
    managers that don't have the annoying property of triggering relayouts
    on everything.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=700051

 src/backend/bacon-video-widget.c |   17 ++++-------------
 1 files changed, 4 insertions(+), 13 deletions(-)
---
diff --git a/src/backend/bacon-video-widget.c b/src/backend/bacon-video-widget.c
index ac49b6a..aaf14fb 100644
--- a/src/backend/bacon-video-widget.c
+++ b/src/backend/bacon-video-widget.c
@@ -6017,7 +6017,6 @@ bacon_video_widget_initable_init (GInitable     *initable,
   GstElement *audio_sink = NULL, *video_sink = NULL;
   gchar *version_str;
   GstPlayFlags flags;
-  ClutterConstraint *constraint;
   ClutterActor *layout;
   GstElement *audio_bin, *audio_converter;
   GstPad *audio_pad;
@@ -6089,8 +6088,10 @@ bacon_video_widget_initable_init (GInitable     *initable,
   bvw->priv->logo_mode = FALSE;
 
   bvw->priv->stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (bvw));
+  clutter_actor_set_layout_manager (bvw->priv->stage,
+                                    clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_FILL, 
CLUTTER_BIN_ALIGNMENT_FILL));
   clutter_actor_set_name (bvw->priv->stage, "stage");
-  clutter_actor_set_background_color (CLUTTER_ACTOR (bvw->priv->stage), CLUTTER_COLOR_Black);
+  clutter_actor_set_background_color (bvw->priv->stage, CLUTTER_COLOR_Black);
 
   /* Video sink, with aspect frame */
   bvw->priv->texture = g_object_new (CLUTTER_TYPE_TEXTURE,
@@ -6106,9 +6107,7 @@ bacon_video_widget_initable_init (GInitable     *initable,
   bvw->priv->logo = clutter_image_new ();
   clutter_actor_set_content (bvw->priv->logo_frame, bvw->priv->logo);
   clutter_actor_set_content_gravity (bvw->priv->logo_frame, CLUTTER_CONTENT_GRAVITY_RESIZE_ASPECT);
-  clutter_actor_add_child (CLUTTER_ACTOR (bvw->priv->stage), bvw->priv->logo_frame);
-  constraint = clutter_bind_constraint_new (bvw->priv->stage, CLUTTER_BIND_SIZE, 0.0);
-  clutter_actor_add_constraint_with_name (bvw->priv->logo_frame, "size", constraint);
+  clutter_actor_add_child (bvw->priv->stage, bvw->priv->logo_frame);
   clutter_actor_hide (CLUTTER_ACTOR (bvw->priv->logo_frame));
 
   /* The video */
@@ -6117,8 +6116,6 @@ bacon_video_widget_initable_init (GInitable     *initable,
   totem_aspect_frame_set_child (TOTEM_ASPECT_FRAME (bvw->priv->frame), bvw->priv->texture);
 
   clutter_actor_add_child (bvw->priv->stage, bvw->priv->frame);
-  constraint = clutter_bind_constraint_new (bvw->priv->stage, CLUTTER_BIND_SIZE, 0.0);
-  clutter_actor_add_constraint_with_name (bvw->priv->frame, "size", constraint);
 
   clutter_actor_set_child_above_sibling (bvw->priv->stage,
                                         bvw->priv->logo_frame,
@@ -6128,8 +6125,6 @@ bacon_video_widget_initable_init (GInitable     *initable,
   bvw->priv->spinner = bacon_video_spinner_actor_new ();
   clutter_actor_set_name (bvw->priv->spinner, "spinner");
   clutter_actor_add_child (bvw->priv->stage, bvw->priv->spinner);
-  constraint = clutter_bind_constraint_new (bvw->priv->stage, CLUTTER_BIND_SIZE, 0.0);
-  clutter_actor_add_constraint_with_name (bvw->priv->spinner, "size", constraint);
   clutter_actor_set_child_above_sibling (bvw->priv->stage,
                                         bvw->priv->spinner,
                                         bvw->priv->frame);
@@ -6165,8 +6160,6 @@ bacon_video_widget_initable_init (GInitable     *initable,
   clutter_actor_set_child_above_sibling (bvw->priv->stage,
                                         layout,
                                         bvw->priv->logo_frame);
-  constraint = clutter_bind_constraint_new (bvw->priv->stage, CLUTTER_BIND_SIZE, 0.0);
-  clutter_actor_add_constraint_with_name (layout, "size", constraint);
 
   /* The header bar */
   bvw->priv->header = bacon_video_header_actor_new ();
@@ -6182,8 +6175,6 @@ bacon_video_widget_initable_init (GInitable     *initable,
   clutter_actor_set_child_above_sibling (bvw->priv->stage,
                                         layout,
                                         bvw->priv->logo_frame);
-  constraint = clutter_bind_constraint_new (bvw->priv->stage, CLUTTER_BIND_SIZE, 0.0);
-  clutter_actor_add_constraint_with_name (layout, "size", constraint);
 
   /* And tell playbin */
   g_object_set (bvw->priv->play, "video-sink", video_sink, NULL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]