mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 12:02:04 +00:00
state: documented data structures
This commit is contained in:
parent
84f165b460
commit
9c4467707f
@ -48,33 +48,37 @@
|
|||||||
G_DEFINE_TYPE (ClutterState, clutter_state, G_TYPE_OBJECT);
|
G_DEFINE_TYPE (ClutterState, clutter_state, G_TYPE_OBJECT);
|
||||||
|
|
||||||
typedef struct StateAnimator {
|
typedef struct StateAnimator {
|
||||||
const gchar *source_state_name;
|
const gchar *source_state_name; /* interned string identifying entry */
|
||||||
ClutterAnimator *animator;
|
ClutterAnimator *animator; /* pointer to animator itself */
|
||||||
} StateAnimator;
|
} StateAnimator;
|
||||||
|
|
||||||
typedef struct State {
|
typedef struct State
|
||||||
ClutterState *state;
|
{
|
||||||
const gchar *name;
|
const gchar *name; /* interned string for this state name */
|
||||||
GHashTable *durations; /* contains state objects */
|
GHashTable *durations; /* durations for transitions from various state
|
||||||
GList *keys; /* list of all keys pertaining to transitions
|
names */
|
||||||
from other states to this one */
|
GList *keys; /* list of all keys pertaining to transitions
|
||||||
GArray *animators; /* list of animators for transitioning from
|
from other states to this one */
|
||||||
* specific source states
|
GArray *animators; /* list of animators for transitioning from
|
||||||
*/
|
* specific source states */
|
||||||
|
ClutterState *clutter_state; /* the ClutterState object this state belongs to
|
||||||
|
*/
|
||||||
} State;
|
} State;
|
||||||
|
|
||||||
struct _ClutterStatePrivate
|
struct _ClutterStatePrivate
|
||||||
{
|
{
|
||||||
ClutterTimeline *timeline;
|
GHashTable *states; /* contains state objects */
|
||||||
ClutterTimeline *slave_timeline;
|
guint duration; /* global fallback duration */
|
||||||
const gchar *source_state_name;
|
ClutterTimeline *timeline; /* The timeline used for doing the
|
||||||
const gchar *target_state_name;
|
progress */
|
||||||
State *source_state;
|
ClutterTimeline *slave_timeline; /* a slave timeline used to compute
|
||||||
State *target_state;
|
alphas */
|
||||||
GHashTable *states; /* contains state objects */
|
const gchar *source_state_name; /* current source state */
|
||||||
|
State *source_state; /* current source_state */
|
||||||
ClutterAnimator *current_animator;
|
const gchar *target_state_name; /* current target state */
|
||||||
guint duration; /* global fallback duration */
|
State *target_state; /* target state name */
|
||||||
|
ClutterAnimator *current_animator; /* !NULL if the current transition is
|
||||||
|
overriden by an animator */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SLAVE_TIMELINE_LENGTH 10000
|
#define SLAVE_TIMELINE_LENGTH 10000
|
||||||
@ -87,22 +91,24 @@ struct _ClutterStatePrivate
|
|||||||
*/
|
*/
|
||||||
typedef struct _ClutterStateKey
|
typedef struct _ClutterStateKey
|
||||||
{
|
{
|
||||||
GObject *object;
|
GObject *object; /* an Gobject */
|
||||||
const gchar *property_name;
|
const gchar *property_name;/* the name of a property */
|
||||||
gulong mode;
|
gulong mode; /* alpha to use */
|
||||||
GValue value;
|
GValue value; /* target value */
|
||||||
gdouble pre_delay;
|
gdouble pre_delay; /* fraction of duration to delay before
|
||||||
gdouble post_delay;
|
starting */
|
||||||
|
gdouble post_delay; /* fraction of duration to be done in */
|
||||||
|
|
||||||
State *source_state;
|
State *source_state; /* source state */
|
||||||
State *target_state;
|
State *target_state; /* target state */
|
||||||
ClutterAlpha *alpha;
|
|
||||||
ClutterInterval *interval;
|
|
||||||
|
|
||||||
ClutterState *state;
|
ClutterAlpha *alpha; /* The alpha this key uses for interpolation */
|
||||||
|
ClutterInterval *interval; /* The interval this key uses for
|
||||||
|
interpolation */
|
||||||
|
|
||||||
guint is_inert : 1;
|
guint is_inert : 1; /* set if the key is being destroyed due to
|
||||||
gint ref_count;
|
weak reference */
|
||||||
|
gint ref_count; /* reference count for boxed life time */
|
||||||
} _ClutterStateKey;
|
} _ClutterStateKey;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
@ -174,7 +180,7 @@ clutter_state_key_new (State *state,
|
|||||||
g_object_ref_sink (state_key->alpha);
|
g_object_ref_sink (state_key->alpha);
|
||||||
clutter_alpha_set_mode (state_key->alpha, mode);
|
clutter_alpha_set_mode (state_key->alpha, mode);
|
||||||
clutter_alpha_set_timeline (state_key->alpha,
|
clutter_alpha_set_timeline (state_key->alpha,
|
||||||
state->state->priv->slave_timeline);
|
state->clutter_state->priv->slave_timeline);
|
||||||
|
|
||||||
state_key->interval =
|
state_key->interval =
|
||||||
g_object_new (CLUTTER_TYPE_INTERVAL,
|
g_object_new (CLUTTER_TYPE_INTERVAL,
|
||||||
@ -188,7 +194,7 @@ clutter_state_key_new (State *state,
|
|||||||
g_value_unset (&value);
|
g_value_unset (&value);
|
||||||
|
|
||||||
g_object_weak_ref (object, object_disappeared,
|
g_object_weak_ref (object, object_disappeared,
|
||||||
state_key->target_state->state);
|
state_key->target_state->clutter_state);
|
||||||
|
|
||||||
return state_key;
|
return state_key;
|
||||||
}
|
}
|
||||||
@ -208,7 +214,7 @@ clutter_state_key_free (gpointer clutter_state_key)
|
|||||||
|
|
||||||
if (!key->is_inert)
|
if (!key->is_inert)
|
||||||
g_object_weak_unref (key->object, object_disappeared,
|
g_object_weak_unref (key->object, object_disappeared,
|
||||||
key->target_state->state);
|
key->target_state->clutter_state);
|
||||||
g_object_unref (key->alpha);
|
g_object_unref (key->alpha);
|
||||||
g_object_unref (key->interval);
|
g_object_unref (key->interval);
|
||||||
|
|
||||||
@ -298,13 +304,13 @@ state_free (gpointer data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static State *
|
static State *
|
||||||
state_new (ClutterState *this,
|
state_new (ClutterState *clutter_state,
|
||||||
const gchar *name)
|
const gchar *name)
|
||||||
{
|
{
|
||||||
State *state;
|
State *state;
|
||||||
|
|
||||||
state = g_new0 (State, 1);
|
state = g_new0 (State, 1);
|
||||||
state->state = this;
|
state->clutter_state = clutter_state;
|
||||||
state->name = name;
|
state->name = name;
|
||||||
state->animators = g_array_new (TRUE, TRUE, sizeof (StateAnimator));
|
state->animators = g_array_new (TRUE, TRUE, sizeof (StateAnimator));
|
||||||
state->durations = g_hash_table_new (g_direct_hash, g_direct_equal);
|
state->durations = g_hash_table_new (g_direct_hash, g_direct_equal);
|
||||||
|
Loading…
Reference in New Issue
Block a user