}
-/**
- * clutter_state_change:
- * @state: a #ClutterState
- * @target_state_name: the state to transition to
- * @animate: whether we should animate the transition or not
- *
- * Change the current state of #ClutterState to @target_state_name
- *
- * If @animate is %FALSE, the state transition will happen immediately;
- * otherwise, the state transition will be animated over the duration
- * set using clutter_state_set_duration()
- *
- * Return value: the #ClutterTimeline that drives the state transition
- *
- * Since: 1.4
- */
-ClutterTimeline *
+static ClutterTimeline *
clutter_state_change (ClutterState *state,
const gchar *target_state_name,
gboolean animate)
return priv->timeline;
}
+/**
+ * clutter_state_set_state:
+ * @state: a #ClutterState
+ * @target_state_name: the state to transition to
+ *
+ * Change the current state of #ClutterState to @target_state_name
+ *
+ * The state will animate during its transition, see
+ * #clutter_state_warp_to_state for animation-free state switching.
+ *
+ * Return value: the #ClutterTimeline that drives the state transition
+ *
+ * Since: 1.4
+ */
+ClutterTimeline *
+clutter_state_set_state (ClutterState *state,
+ const gchar *target_state_name)
+{
+ return clutter_state_change (state, target_state_name, FALSE);
+}
+
+/**
+ * clutter_state_warp_to_state:
+ * @state: a #ClutterState
+ * @target_state_name: the state to transition to
+ *
+ * Change the current state of #ClutterState to @target_state_name
+ *
+ * Change to the specified target state immediately with no animation.
+ *
+ * Return value: the #ClutterTimeline that drives the state transition
+ *
+ * Since: 1.4
+ */
+ClutterTimeline *
+clutter_state_warp_to_state (ClutterState *state,
+ const gchar *target_state_name)
+{
+ return clutter_state_change (state, target_state_name, TRUE);
+}
+
static GParamSpec *
get_property_from_object (GObject *gobject,
const gchar *property_name)
switch (prop_id)
{
case PROP_STATE:
- clutter_state_change (state, g_value_get_string (value), TRUE);
+ clutter_state_set_state (state, g_value_get_string (value));
break;
case PROP_DURATION:
state->priv->duration = g_value_get_uint (value);
ClutterState *clutter_state_new (void);
-ClutterTimeline * clutter_state_change (ClutterState *state,
- const gchar *target_state_name,
- gboolean animate);
+ClutterTimeline * clutter_state_set_state (ClutterState *state,
+ const gchar *target_state_name);
+ClutterTimeline * clutter_state_warp_to_state (ClutterState *state,
+ const gchar *target_state_name);
ClutterState * clutter_state_set_key (ClutterState *state,
const gchar *source_state_name,
const gchar *target_state_name,
ClutterState
ClutterStateClass
clutter_state_new
-clutter_state_change
+clutter_state_set_state
clutter_state_get_state
+clutter_state_warp_to_state
clutter_state_set
clutter_state_set_key
clutter_state_set_duration
gpointer user_data)
{
clutter_grab_pointer (actor);
- clutter_state_change (state, "end", TRUE);
+ clutter_state_set_state (state, "end");
return TRUE;
}
ClutterEvent *event,
gpointer user_data)
{
- clutter_state_change (state, "start", TRUE);
+ clutter_state_set_state (state, "start");
clutter_ungrab_pointer ();
return TRUE;
}
g_object_unref (animator);
clutter_actor_show (stage);
- clutter_state_change (state, "start", TRUE);
+ clutter_state_set_state (state, "start");
clutter_main ();
g_object_unref (state);
gpointer user_data)
{
ClutterState *state = CLUTTER_STATE (user_data);
- clutter_state_change (state, "right", TRUE);
+ clutter_state_set_state (state, "right");
return TRUE;
}
gpointer user_data)
{
ClutterState *state = CLUTTER_STATE (user_data);
- clutter_state_change (state, "active", TRUE);
+ clutter_state_set_state (state, "active");
return TRUE;
}
gpointer user_data)
{
ClutterState *state = CLUTTER_STATE (user_data);
- clutter_state_change (state, "hover", TRUE);
+ clutter_state_set_state (state, "hover");
return TRUE;
}
gpointer user_data)
{
ClutterState *state = CLUTTER_STATE (user_data);
- clutter_state_change (state, "normal", TRUE);
+ clutter_state_set_state (state, "normal");
return TRUE;
}
if (g_str_equal (clutter_state_get_state (state), "right"))
{
/* skip straight to left state when reaching right */
- clutter_state_change (state, "left", FALSE);
+ clutter_state_warp_to_state (state, "left");
}
}
g_signal_connect (layout_state, "completed", G_CALLBACK (completed), NULL);
clutter_actor_show (stage);
- clutter_state_change (layout_state, "left", FALSE);
- clutter_state_change (layout_state, "active", TRUE);
+
+ clutter_state_warp_to_state (layout_state, "left");
+ clutter_state_set_state (layout_state, "active");
clutter_main ();
g_object_unref (layout_state);