diff --git a/clutter/clutter-click-action.c b/clutter/clutter-click-action.c index 019df8d3f..4cde0fc32 100644 --- a/clutter/clutter-click-action.c +++ b/clutter/clutter-click-action.c @@ -302,3 +302,33 @@ clutter_click_action_new (void) { return g_object_new (CLUTTER_TYPE_CLICK_ACTION, NULL); } + +/** + * clutter_click_action_release: + * @action: a #ClutterClickAction + * + * Emulates a release of the pointer button, which ungrabs the pointer + * and unsets the #ClutterClickAction:pressed state. + * + * This function is useful to break a grab, for instance after a certain + * amount of time has passed. + * + * Since: 1.4 + */ +void +clutter_click_action_force_release (ClutterClickAction *action) +{ + ClutterClickActionPrivate *priv; + + g_return_if_fail (CLUTTER_IS_CLICK_ACTION (action)); + + priv = action->priv; + + if (!priv->is_held) + return; + + priv->is_held = FALSE; + clutter_ungrab_pointer (); + + click_action_set_pressed (action, FALSE); +} diff --git a/clutter/clutter-click-action.h b/clutter/clutter-click-action.h index e09ed03bb..1735bf711 100644 --- a/clutter/clutter-click-action.h +++ b/clutter/clutter-click-action.h @@ -93,7 +93,8 @@ struct _ClutterClickActionClass GType clutter_click_action_get_type (void) G_GNUC_CONST; -ClutterAction *clutter_click_action_new (void); +ClutterAction *clutter_click_action_new (void); +void clutter_click_action_release (ClutterClickAction *action); G_END_DECLS diff --git a/doc/reference/clutter/clutter-sections.txt b/doc/reference/clutter/clutter-sections.txt index e7859011c..1de42ca16 100644 --- a/doc/reference/clutter/clutter-sections.txt +++ b/doc/reference/clutter/clutter-sections.txt @@ -2346,6 +2346,7 @@ ClutterStatePrivate ClutterClickAction ClutterClickActionClass clutter_click_action_new +clutter_click_action_release CLUTTER_TYPE_CLICK_ACTION