click-action: Add a method to force a release
It can be useful to be able to forcibly break the grab set up by the ClickAction. The newly added release() method provides a mechanism to release the grab and unset the :held state of the ClickAction.
This commit is contained in:
parent
db7d821ef6
commit
459a6bb24c
3 changed files with 33 additions and 1 deletions
|
@ -302,3 +302,33 @@ clutter_click_action_new (void)
|
||||||
{
|
{
|
||||||
return g_object_new (CLUTTER_TYPE_CLICK_ACTION, NULL);
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -94,6 +94,7 @@ struct _ClutterClickActionClass
|
||||||
GType clutter_click_action_get_type (void) G_GNUC_CONST;
|
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
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -2346,6 +2346,7 @@ ClutterStatePrivate
|
||||||
ClutterClickAction
|
ClutterClickAction
|
||||||
ClutterClickActionClass
|
ClutterClickActionClass
|
||||||
clutter_click_action_new
|
clutter_click_action_new
|
||||||
|
clutter_click_action_release
|
||||||
|
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
CLUTTER_TYPE_CLICK_ACTION
|
CLUTTER_TYPE_CLICK_ACTION
|
||||||
|
|
Loading…
Add table
Reference in a new issue