Fix up for latest Clutter deprecations

https://bugzilla.gnome.org/show_bug.cgi?id=678917
This commit is contained in:
Jasper St. Pierre 2012-01-17 09:16:46 -05:00
parent 2aea49a8d0
commit d395d75e26
4 changed files with 41 additions and 43 deletions

View File

@ -575,13 +575,11 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
info->window_group = meta_window_group_new (screen); info->window_group = meta_window_group_new (screen);
info->top_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), clutter_actor_add_child (info->stage, info->window_group);
info->window_group, clutter_actor_add_child (info->stage, info->top_window_group);
info->top_window_group, clutter_actor_add_child (info->stage, info->overlay_group);
info->overlay_group,
NULL);
info->plugin_mgr = meta_plugin_manager_new (screen); 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 * little effort to make sure we actually need to restack before
* we go ahead and do it */ * 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; reordered = FALSE;
/* We allow for actors in the window group other than the actors we /* 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 */ * windows first, then background */
for (tmp = g_list_last (info->windows); tmp != NULL; tmp = tmp->prev) 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 /* 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; 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); g_list_free (backgrounds);
} }
@ -1481,45 +1481,44 @@ meta_enable_unredirect_for_screen (MetaScreen *screen)
#define FLASH_TIME_MS 50 #define FLASH_TIME_MS 50
static void static void
flash_out_completed (ClutterAnimation *animation, flash_out_completed (ClutterTimeline *timeline,
ClutterActor *flash) gpointer user_data)
{ {
ClutterActor *flash = CLUTTER_ACTOR (user_data);
clutter_actor_destroy (flash); 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 void
meta_compositor_flash_screen (MetaCompositor *compositor, meta_compositor_flash_screen (MetaCompositor *compositor,
MetaScreen *screen) MetaScreen *screen)
{ {
ClutterActor *stage; ClutterActor *stage;
ClutterActor *flash; ClutterActor *flash;
ClutterColor black = { 0, 0, 0, 255 }; ClutterTransition *transition;
gfloat width, height; gfloat width, height;
stage = meta_get_stage_for_screen (screen); stage = meta_get_stage_for_screen (screen);
clutter_actor_get_size (stage, &width, &height); 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_size (flash, width, height);
clutter_actor_set_opacity (flash, 0); clutter_actor_set_opacity (flash, 0);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), flash); clutter_actor_add_child (stage, flash);
clutter_actor_animate (flash, CLUTTER_EASE_OUT_QUAD, clutter_actor_save_easing_state (flash);
FLASH_TIME_MS, clutter_actor_set_easing_mode (flash, CLUTTER_EASE_IN_QUAD);
"opacity", 192, clutter_actor_set_easing_duration (flash, FLASH_TIME_MS);
"signal-after::completed", flash_in_completed, flash, clutter_actor_set_opacity (flash, 192);
NULL);
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_restore_easing_state (flash);
} }
/** /**

View File

@ -176,7 +176,7 @@ static void meta_window_actor_handle_updates (MetaWindowActor *self);
static void check_needs_reshape (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 static void
frame_data_free (FrameData *frame) frame_data_free (FrameData *frame)
@ -360,7 +360,7 @@ meta_window_actor_constructed (GObject *object)
{ {
priv->actor = meta_shaped_texture_new (); 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 * 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. * This is the case where existing window is gaining/loosing frame.
* Just ensure the actor is top most (i.e., above shadow). * 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_opacity (self);
@ -1419,7 +1419,7 @@ meta_window_actor_show (MetaWindowActor *self,
event == 0 || event == 0 ||
!start_simple_effect (self, event)) !start_simple_effect (self, event))
{ {
clutter_actor_show_all (CLUTTER_ACTOR (self)); clutter_actor_show (CLUTTER_ACTOR (self));
priv->redecorating = FALSE; priv->redecorating = FALSE;
} }
} }
@ -1571,8 +1571,7 @@ meta_window_actor_new (MetaWindow *window)
else else
window_group = info->window_group; window_group = info->window_group;
clutter_container_add_actor (CLUTTER_CONTAINER (window_group), clutter_actor_add_child (window_group, CLUTTER_ACTOR (self));
CLUTTER_ACTOR (self));
clutter_actor_hide (CLUTTER_ACTOR (self)); clutter_actor_hide (CLUTTER_ACTOR (self));

View File

@ -16,17 +16,17 @@
struct _MetaWindowGroupClass struct _MetaWindowGroupClass
{ {
ClutterGroupClass parent_class; ClutterActorClass parent_class;
}; };
struct _MetaWindowGroup struct _MetaWindowGroup
{ {
ClutterGroup parent; ClutterActor parent;
MetaScreen *screen; 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 /* Help macros to scale from OpenGL <-1,1> coordinates system to
* window coordinates ranging [0,window-size]. Borrowed from clutter-utils.c * 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 * and subtract the opaque area of each window out of the visible
* region that we pass to the windows below. * 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); children = g_list_reverse (children);
/* Get the clipped redraw bounds from Clutter so that we can avoid /* Get the clipped redraw bounds from Clutter so that we can avoid

View File

@ -46,12 +46,12 @@ typedef struct _MetaWindowActorPrivate MetaWindowActorPrivate;
struct _MetaWindowActorClass struct _MetaWindowActorClass
{ {
ClutterGroupClass parent_class; ClutterActorClass parent_class;
}; };
struct _MetaWindowActor struct _MetaWindowActor
{ {
ClutterGroup parent; ClutterActor parent;
MetaWindowActorPrivate *priv; MetaWindowActorPrivate *priv;
}; };