[mutter] Fix up for latest Clutter deprecations



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

    Fix up for latest Clutter deprecations
    
    https://bugzilla.gnome.org/show_bug.cgi?id=678917

 src/compositor/compositor.c        |   61 +++++++++++++++++------------------
 src/compositor/meta-window-actor.c |   11 +++---
 src/compositor/meta-window-group.c |    8 ++--
 src/meta/meta-window-actor.h       |    4 +-
 4 files changed, 41 insertions(+), 43 deletions(-)
---
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index 9771b1c..3758a5e 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -575,13 +575,11 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
 
   info->window_group = meta_window_group_new (screen);
   info->top_window_group = meta_window_group_new (screen);
-  info->overlay_group = clutter_group_new ();
+  info->overlay_group = clutter_actor_new ();
 
-  clutter_container_add (CLUTTER_CONTAINER (info->stage),
-                         info->window_group,
-                         info->top_window_group,
-                         info->overlay_group,
-                         NULL);
+  clutter_actor_add_child (info->stage, info->window_group);
+  clutter_actor_add_child (info->stage, info->top_window_group);
+  clutter_actor_add_child (info->stage, info->overlay_group);
 
   info->plugin_mgr = meta_plugin_manager_new (screen);
 
@@ -1039,7 +1037,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;
 
   /* We allow for actors in the window group other than the actors we
@@ -1086,9 +1084,10 @@ sync_actor_stacking (MetaCompScreen *info)
    * windows first, then background */
   for (tmp = g_list_last (info->windows); tmp != NULL; tmp = tmp->prev)
     {
-      MetaWindowActor *window_actor = tmp->data;
+      ClutterActor *actor = tmp->data;
 
-      clutter_actor_lower_bottom (CLUTTER_ACTOR (window_actor));
+      if (clutter_actor_get_parent (actor) == info->window_group)
+        clutter_actor_set_child_below_sibling (info->window_group, actor, NULL);
     }
 
   /* we prepended the backgrounds above so the last actor in the list
@@ -1098,7 +1097,8 @@ sync_actor_stacking (MetaCompScreen *info)
     {
       ClutterActor *actor = tmp->data;
 
-      clutter_actor_lower_bottom (CLUTTER_ACTOR (actor));
+      if (clutter_actor_get_parent (actor) == info->window_group)
+        clutter_actor_set_child_below_sibling (info->window_group, actor, NULL);
     }
   g_list_free (backgrounds);
 }
@@ -1481,45 +1481,44 @@ 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-window-actor.c b/src/compositor/meta-window-actor.c
index 1c57d73..f9222ef 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -176,7 +176,7 @@ static void meta_window_actor_handle_updates (MetaWindowActor *self);
 
 static void check_needs_reshape (MetaWindowActor *self);
 
-G_DEFINE_TYPE (MetaWindowActor, meta_window_actor, CLUTTER_TYPE_GROUP);
+G_DEFINE_TYPE (MetaWindowActor, meta_window_actor, CLUTTER_TYPE_ACTOR);
 
 static void
 frame_data_free (FrameData *frame)
@@ -360,7 +360,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
@@ -382,7 +382,7 @@ 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);
@@ -1419,7 +1419,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;
     }
 }
@@ -1571,8 +1571,7 @@ meta_window_actor_new (MetaWindow *window)
   else
     window_group = info->window_group;
 
-  clutter_container_add_actor (CLUTTER_CONTAINER (window_group),
-                               CLUTTER_ACTOR (self));
+  clutter_actor_add_child (window_group, CLUTTER_ACTOR (self));
 
   clutter_actor_hide (CLUTTER_ACTOR (self));
 
diff --git a/src/compositor/meta-window-group.c b/src/compositor/meta-window-group.c
index f499cb7..fedae95 100644
--- a/src/compositor/meta-window-group.c
+++ b/src/compositor/meta-window-group.c
@@ -16,17 +16,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);
 
 /* Help macros to scale from OpenGL <-1,1> coordinates system to
  * window coordinates ranging [0,window-size]. Borrowed from clutter-utils.c
@@ -127,7 +127,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]