[mutter/wip/mult-window-actors: 3/9] Fix up for latest Clutter deprecations



commit 15482e7fe0b20b1ffb7625e8abfd03d2c421a43a
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Jan 17 09:16:46 2012 -0500

    Fix up for latest Clutter deprecations

 src/compositor/compositor.c            |   70 ++++++++++++++++----------------
 src/compositor/meta-background-actor.c |    2 +-
 src/compositor/meta-window-actor.c     |   14 ++++---
 src/compositor/meta-window-group.c     |    8 ++--
 src/meta/meta-window-actor.h           |    4 +-
 5 files changed, 50 insertions(+), 48 deletions(-)
---
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index e0e9b71..404e5f4 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -542,18 +542,14 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
 
   info->window_group = meta_window_group_new (screen);
   info->background_actor = meta_background_actor_new_for_screen (screen);
-  info->overlay_group = clutter_group_new ();
-  info->hidden_group = clutter_group_new ();
+  info->overlay_group = clutter_actor_new ();
+  info->hidden_group = clutter_actor_new ();
 
-  clutter_container_add (CLUTTER_CONTAINER (info->window_group),
-                         info->background_actor,
-                         NULL);
+  clutter_actor_add_child (info->window_group, info->background_actor);
 
-  clutter_container_add (CLUTTER_CONTAINER (info->stage),
-                         info->window_group,
-                         info->overlay_group,
-			 info->hidden_group,
-                         NULL);
+  clutter_actor_add_child (info->stage, info->window_group);
+  clutter_actor_add_child (info->stage, info->overlay_group);
+  clutter_actor_add_child (info->stage, info->hidden_group);
 
   clutter_actor_hide (info->hidden_group);
 
@@ -921,7 +917,7 @@ sync_actor_stacking (MetaCompScreen *info)
    * little effort to make sure we actually need to restack before
    * we go ahead and do it */
 
-  children = clutter_container_get_children (CLUTTER_CONTAINER (info->window_group));
+  children = clutter_actor_get_children (info->window_group);
   reordered = FALSE;
 
   old = children;
@@ -969,12 +965,17 @@ sync_actor_stacking (MetaCompScreen *info)
 
   for (tmp = g_list_last (info->windows); tmp != NULL; tmp = tmp->prev)
     {
-      MetaWindowActor *window_actor = tmp->data;
+      ClutterActor *window_actor = tmp->data;
 
-      clutter_actor_lower_bottom (CLUTTER_ACTOR (window_actor));
+      if (clutter_actor_get_parent (window_actor) == info->window_group)
+        clutter_actor_set_child_below_sibling (info->window_group,
+                                               window_actor,
+                                               NULL);
     }
 
-  clutter_actor_lower_bottom (info->background_actor);
+  clutter_actor_set_child_below_sibling (info->window_group,
+                                         info->background_actor,
+                                         NULL);
 }
 
 void
@@ -1307,43 +1308,42 @@ meta_enable_unredirect_for_screen (MetaScreen *screen)
 #define FLASH_TIME_MS 50
 
 static void
-flash_out_completed (ClutterAnimation *animation,
-                     ClutterActor     *flash)
+flash_out_completed (ClutterTimeline *timeline,
+                     gpointer         user_data)
 {
+  ClutterActor *flash = CLUTTER_ACTOR (user_data);
   clutter_actor_destroy (flash);
 }
 
-static void
-flash_in_completed (ClutterAnimation *animation,
-                    ClutterActor     *flash)
-{
-  clutter_actor_animate (flash, CLUTTER_EASE_IN_QUAD,
-                         FLASH_TIME_MS,
-                         "opacity", 0,
-                         "signal-after::completed", flash_out_completed, flash,
-                         NULL);
-}
-
 void
 meta_compositor_flash_screen (MetaCompositor *compositor,
                               MetaScreen     *screen)
 {
   ClutterActor *stage;
   ClutterActor *flash;
-  ClutterColor black = { 0, 0, 0, 255 };
+  ClutterTransition *transition;
   gfloat width, height;
 
   stage = meta_get_stage_for_screen (screen);
   clutter_actor_get_size (stage, &width, &height);
 
-  flash = clutter_rectangle_new_with_color (&black);
+  flash = clutter_actor_new ();
+  clutter_actor_set_background_color (flash, CLUTTER_COLOR_Black);
   clutter_actor_set_size (flash, width, height);
   clutter_actor_set_opacity (flash, 0);
-  clutter_container_add_actor (CLUTTER_CONTAINER (stage), flash);
+  clutter_actor_add_child (stage, flash);
+
+  clutter_actor_save_easing_state (flash);
+  clutter_actor_set_easing_mode (flash, CLUTTER_EASE_IN_QUAD);
+  clutter_actor_set_easing_duration (flash, FLASH_TIME_MS);
+  clutter_actor_set_opacity (flash, 192);
+
+  transition = clutter_actor_get_transition (flash, "opacity");
+  clutter_timeline_set_auto_reverse (CLUTTER_TIMELINE (transition), TRUE);
+  clutter_timeline_set_repeat_count (CLUTTER_TIMELINE (transition), 2);
+
+  g_signal_connect (transition, "finished",
+                    G_CALLBACK (flash_out_completed), flash);
 
-  clutter_actor_animate (flash, CLUTTER_EASE_OUT_QUAD,
-                         FLASH_TIME_MS,
-                         "opacity", 192,
-                         "signal-after::completed", flash_in_completed, flash,
-                         NULL);
+  clutter_actor_restore_easing_state (flash);
 }
diff --git a/src/compositor/meta-background-actor.c b/src/compositor/meta-background-actor.c
index d70ae1b..f269a75 100644
--- a/src/compositor/meta-background-actor.c
+++ b/src/compositor/meta-background-actor.c
@@ -224,7 +224,7 @@ set_texture_to_stage_color (MetaScreenBackground *background)
   ClutterColor color;
   CoglHandle texture;
 
-  clutter_stage_get_color (CLUTTER_STAGE (stage), &color);
+  clutter_actor_get_background_color (stage, &color);
 
   /* Slicing will prevent COGL from using hardware texturing for
    * the tiled 1x1 pixmap, and will cause it to draw the window
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 70ec535..4325155 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -155,7 +155,7 @@ static void meta_window_actor_clear_shape_region    (MetaWindowActor *self);
 static void meta_window_actor_clear_bounding_region (MetaWindowActor *self);
 static void meta_window_actor_clear_shadow_clip     (MetaWindowActor *self);
 
-G_DEFINE_TYPE (MetaWindowActor, meta_window_actor, CLUTTER_TYPE_GROUP);
+G_DEFINE_TYPE (MetaWindowActor, meta_window_actor, CLUTTER_TYPE_ACTOR);
 
 static void
 meta_window_actor_class_init (MetaWindowActorClass *klass)
@@ -333,7 +333,7 @@ meta_window_actor_constructed (GObject *object)
     {
       priv->actor = meta_shaped_texture_new ();
 
-      clutter_container_add_actor (CLUTTER_CONTAINER (self), priv->actor);
+      clutter_actor_add_child (CLUTTER_ACTOR (self), priv->actor);
 
       /*
        * Since we are holding a pointer to this actor independently of the
@@ -355,11 +355,13 @@ meta_window_actor_constructed (GObject *object)
        * This is the case where existing window is gaining/loosing frame.
        * Just ensure the actor is top most (i.e., above shadow).
        */
-      clutter_actor_raise_top (priv->actor);
+      clutter_actor_set_child_above_sibling (CLUTTER_ACTOR (self), priv->actor, NULL);
     }
 
   meta_window_actor_update_opacity (self);
   meta_window_actor_update_shape (self);
+
+  G_OBJECT_CLASS (meta_window_actor_parent_class)->constructed(object);
 }
 
 static void
@@ -1365,7 +1367,7 @@ meta_window_actor_show (MetaWindowActor   *self,
       event == 0 ||
       !start_simple_effect (self, event))
     {
-      clutter_actor_show_all (CLUTTER_ACTOR (self));
+      clutter_actor_show (CLUTTER_ACTOR (self));
       priv->redecorating = FALSE;
     }
 }
@@ -1508,8 +1510,8 @@ meta_window_actor_new (MetaWindow *window)
   /* Hang our compositor window state off the MetaWindow for fast retrieval */
   meta_window_set_compositor_private (window, G_OBJECT (self));
 
-  clutter_container_add_actor (CLUTTER_CONTAINER (info->window_group),
-			       CLUTTER_ACTOR (self));
+  clutter_actor_add_child (info->window_group,
+                           CLUTTER_ACTOR (self));
   clutter_actor_hide (CLUTTER_ACTOR (self));
 
   /* Initial position in the stack is arbitrary; stacking will be synced
diff --git a/src/compositor/meta-window-group.c b/src/compositor/meta-window-group.c
index 4ec71f3..007819a 100644
--- a/src/compositor/meta-window-group.c
+++ b/src/compositor/meta-window-group.c
@@ -14,17 +14,17 @@
 
 struct _MetaWindowGroupClass
 {
-  ClutterGroupClass parent_class;
+  ClutterActorClass parent_class;
 };
 
 struct _MetaWindowGroup
 {
-  ClutterGroup parent;
+  ClutterActor parent;
 
   MetaScreen *screen;
 };
 
-G_DEFINE_TYPE (MetaWindowGroup, meta_window_group, CLUTTER_TYPE_GROUP);
+G_DEFINE_TYPE (MetaWindowGroup, meta_window_group, CLUTTER_TYPE_ACTOR);
 
 /* We want to find out if the window is "close enough" to
  * 1:1 transform. We do that by converting the transformed coordinates
@@ -122,7 +122,7 @@ meta_window_group_paint (ClutterActor *actor)
    * and subtract the opaque area of each window out of the visible
    * region that we pass to the windows below.
    */
-  children = clutter_container_get_children (CLUTTER_CONTAINER (actor));
+  children = clutter_actor_get_children (actor);
   children = g_list_reverse (children);
 
   /* Get the clipped redraw bounds from Clutter so that we can avoid
diff --git a/src/meta/meta-window-actor.h b/src/meta/meta-window-actor.h
index d32c029..68fb45f 100644
--- a/src/meta/meta-window-actor.h
+++ b/src/meta/meta-window-actor.h
@@ -46,12 +46,12 @@ typedef struct _MetaWindowActorPrivate MetaWindowActorPrivate;
 
 struct _MetaWindowActorClass
 {
-  ClutterGroupClass parent_class;
+  ClutterActorClass parent_class;
 };
 
 struct _MetaWindowActor
 {
-  ClutterGroup           parent;
+  ClutterActor           parent;
 
   MetaWindowActorPrivate *priv;
 };



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