mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
layout: Let begin_animation() return the Alpha
When beginning a new animation for a LayoutManager, the implementation should return the ClutterAlpha used. This allows controlling the timeline and/or modifying the animation parameters on the fly.
This commit is contained in:
parent
2e6397c391
commit
4a21425f48
@ -967,7 +967,7 @@ clutter_box_layout_allocate (ClutterLayoutManager *layout,
|
||||
g_list_free (children);
|
||||
}
|
||||
|
||||
static void
|
||||
static ClutterAlpha *
|
||||
clutter_box_layout_begin_animation (ClutterLayoutManager *manager,
|
||||
guint duration,
|
||||
gulong easing)
|
||||
@ -982,7 +982,8 @@ clutter_box_layout_begin_animation (ClutterLayoutManager *manager,
|
||||
|
||||
/* we want the default implementation */
|
||||
parent_class = CLUTTER_LAYOUT_MANAGER_CLASS (clutter_box_layout_parent_class);
|
||||
parent_class->begin_animation (manager, duration, easing);
|
||||
|
||||
return parent_class->begin_animation (manager, duration, easing);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -226,7 +226,7 @@ layout_manager_real_get_child_meta_type (ClutterLayoutManager *manager)
|
||||
return G_TYPE_INVALID;
|
||||
}
|
||||
|
||||
static void
|
||||
static ClutterAlpha *
|
||||
layout_manager_real_begin_animation (ClutterLayoutManager *manager,
|
||||
guint duration,
|
||||
gulong mode)
|
||||
@ -236,7 +236,14 @@ layout_manager_real_begin_animation (ClutterLayoutManager *manager,
|
||||
|
||||
alpha = g_object_get_qdata (G_OBJECT (manager), quark_layout_alpha);
|
||||
if (alpha != NULL)
|
||||
return;
|
||||
{
|
||||
timeline = clutter_alpha_get_timeline (alpha);
|
||||
clutter_timeline_set_duration (timeline, duration);
|
||||
|
||||
clutter_alpha_set_mode (alpha, mode);
|
||||
|
||||
return alpha;
|
||||
};
|
||||
|
||||
timeline = clutter_timeline_new (duration);
|
||||
alpha = clutter_alpha_new_full (timeline, mode);
|
||||
@ -254,6 +261,8 @@ layout_manager_real_begin_animation (ClutterLayoutManager *manager,
|
||||
(GDestroyNotify) g_object_unref);
|
||||
|
||||
clutter_timeline_start (timeline);
|
||||
|
||||
return alpha;
|
||||
}
|
||||
|
||||
static gdouble
|
||||
@ -1004,19 +1013,24 @@ clutter_layout_manager_list_child_properties (ClutterLayoutManager *manager,
|
||||
*
|
||||
* The result of this function depends on the @manager implementation
|
||||
*
|
||||
* Return value: (transfer none): The #ClutterAlpha created by the
|
||||
* layout manager; the returned instance is owned by the layout
|
||||
* manager and should not be unreferenced
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
void
|
||||
ClutterAlpha *
|
||||
clutter_layout_manager_begin_animation (ClutterLayoutManager *manager,
|
||||
guint duration,
|
||||
gulong mode)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager));
|
||||
g_return_if_fail (duration > 0 && duration < 1000);
|
||||
ClutterLayoutManagerClass *klass;
|
||||
|
||||
CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager)->begin_animation (manager,
|
||||
duration,
|
||||
mode);
|
||||
g_return_val_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager), NULL);
|
||||
|
||||
klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
|
||||
|
||||
return klass->begin_animation (manager, duration, mode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,6 +30,7 @@
|
||||
#define __CLUTTER_LAYOUT_MANAGER_H__
|
||||
|
||||
#include <clutter/clutter-actor.h>
|
||||
#include <clutter/clutter-alpha.h>
|
||||
#include <clutter/clutter-container.h>
|
||||
#include <clutter/clutter-types.h>
|
||||
|
||||
@ -126,7 +127,7 @@ struct _ClutterLayoutManagerClass
|
||||
ClutterContainer *container,
|
||||
ClutterActor *actor);
|
||||
|
||||
void (* begin_animation) (ClutterLayoutManager *manager,
|
||||
ClutterAlpha * (* begin_animation) (ClutterLayoutManager *manager,
|
||||
guint duration,
|
||||
gulong mode);
|
||||
gdouble (* get_animation_progress) (ClutterLayoutManager *manager);
|
||||
@ -198,7 +199,7 @@ void clutter_layout_manager_child_get_property (ClutterLayoutMa
|
||||
const gchar *property_name,
|
||||
GValue *value);
|
||||
|
||||
void clutter_layout_manager_begin_animation (ClutterLayoutManager *manager,
|
||||
ClutterAlpha * clutter_layout_manager_begin_animation (ClutterLayoutManager *manager,
|
||||
guint duration,
|
||||
gulong mode);
|
||||
void clutter_layout_manager_end_animation (ClutterLayoutManager *manager);
|
||||
|
Loading…
Reference in New Issue
Block a user