gesture: Make threshold-trigger-edge public
When the threshold-trigger-edge property was introduced in GestureAction, it was late in the cycle and I elected to keep it private, given the fact that nobody was subclassing GestureAction outside of Clutter itself. These days, people are experimenting more with the GestureAction API, so they will need access to the various knobs that control the class default behaviour. https://bugzilla.gnome.org/show_bug.cgi?id=710227
This commit is contained in:
parent
b0227644ff
commit
ed2fdf85f6
@ -1357,6 +1357,29 @@ typedef enum { /*< prefix=CLUTTER_ZOOM >*/
|
|||||||
CLUTTER_ZOOM_BOTH
|
CLUTTER_ZOOM_BOTH
|
||||||
} ClutterZoomAxis;
|
} ClutterZoomAxis;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClutterGestureTriggerEdge:
|
||||||
|
* @CLUTTER_GESTURE_TRIGGER_EDGE_NONE: Tell #ClutterGestureAction that
|
||||||
|
* the gesture must begin immediately and there's no drag limit that
|
||||||
|
* will cause its cancellation;
|
||||||
|
* @CLUTTER_GESTURE_TRIGGER_EDGE_AFTER: Tell #ClutterGestureAction that
|
||||||
|
* it needs to wait until the drag threshold has been exceeded before
|
||||||
|
* considering that the gesture has begun;
|
||||||
|
* @CLUTTER_GESTURE_TRIGGER_EDGE_BEFORE: Tell #ClutterGestureAction that
|
||||||
|
* the gesture must begin immediately and that it must be cancelled
|
||||||
|
* once the drag exceed the configured threshold.
|
||||||
|
*
|
||||||
|
* Enum passed to the clutter_gesture_action_set_threshold_trigger_edge()
|
||||||
|
* function.
|
||||||
|
*
|
||||||
|
* Since: 1.18
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
CLUTTER_GESTURE_TRIGGER_EDGE_NONE = 0,
|
||||||
|
CLUTTER_GESTURE_TRIGGER_EDGE_AFTER,
|
||||||
|
CLUTTER_GESTURE_TRIGGER_EDGE_BEFORE
|
||||||
|
} ClutterGestureTriggerEdge;
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __CLUTTER_ENUMS_H__ */
|
#endif /* __CLUTTER_ENUMS_H__ */
|
||||||
|
@ -26,34 +26,6 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
/*< private >
|
|
||||||
* ClutterGestureTriggerEdge:
|
|
||||||
* @CLUTTER_GESTURE_TRIGGER_EDGE_NONE: Tell #ClutterGestureAction that
|
|
||||||
* the gesture must begin immediately and there's no drag limit that
|
|
||||||
* will cause its cancellation;
|
|
||||||
* @CLUTTER_GESTURE_TRIGGER_EDGE_AFTER: Tell #ClutterGestureAction that
|
|
||||||
* it needs to wait until the drag threshold has been exceeded before
|
|
||||||
* considering that the gesture has begun;
|
|
||||||
* @CLUTTER_GESTURE_TRIGGER_EDGE_BEFORE: Tell #ClutterGestureAction that
|
|
||||||
* the gesture must begin immediately and that it must be cancelled
|
|
||||||
* once the drag exceed the configured threshold.
|
|
||||||
*
|
|
||||||
* Enum passed to the clutter_gesture_action_set_threshold_trigger_edge()
|
|
||||||
* function.
|
|
||||||
*/
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
CLUTTER_GESTURE_TRIGGER_EDGE_NONE = 0,
|
|
||||||
CLUTTER_GESTURE_TRIGGER_EDGE_AFTER,
|
|
||||||
CLUTTER_GESTURE_TRIGGER_EDGE_BEFORE
|
|
||||||
} ClutterGestureTriggerEdge;
|
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
|
||||||
void clutter_gesture_action_set_threshold_trigger_edge (ClutterGestureAction *action,
|
|
||||||
ClutterGestureTriggerEdge edge);
|
|
||||||
G_GNUC_INTERNAL
|
|
||||||
ClutterGestureTriggerEdge clutter_gesture_action_get_threshold_trigger_egde (ClutterGestureAction *action);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __CLUTTER_GESTURE_ACTION_PRIVATE_H__ */
|
#endif /* __CLUTTER_GESTURE_ACTION_PRIVATE_H__ */
|
||||||
|
@ -133,6 +133,7 @@ enum
|
|||||||
PROP_0,
|
PROP_0,
|
||||||
|
|
||||||
PROP_N_TOUCH_POINTS,
|
PROP_N_TOUCH_POINTS,
|
||||||
|
PROP_THRESHOLD_TRIGGER_EDGE,
|
||||||
|
|
||||||
PROP_LAST
|
PROP_LAST
|
||||||
};
|
};
|
||||||
@ -552,40 +553,6 @@ default_event_handler (ClutterGestureAction *action,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*< private >
|
|
||||||
* clutter_gesture_action_set_threshold_trigger_edge:
|
|
||||||
* @action: a #ClutterGestureAction
|
|
||||||
* @edge: the %ClutterGestureTriggerEdge
|
|
||||||
*
|
|
||||||
* Sets the edge trigger for the gesture drag threshold, if any.
|
|
||||||
*
|
|
||||||
* This function can be called by #ClutterGestureAction subclasses that needs
|
|
||||||
* to change the %CLUTTER_GESTURE_TRIGGER_EDGE_AFTER default.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
clutter_gesture_action_set_threshold_trigger_edge (ClutterGestureAction *action,
|
|
||||||
ClutterGestureTriggerEdge edge)
|
|
||||||
{
|
|
||||||
if (action->priv->edge != edge)
|
|
||||||
action->priv->edge = edge;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*< private >
|
|
||||||
* clutter_gesture_action_get_threshold_trigger_egde:
|
|
||||||
* @action: a #ClutterGestureAction
|
|
||||||
*
|
|
||||||
* Retrieves the edge trigger of the gesture @action, as set using
|
|
||||||
* clutter_gesture_action_set_threshold_trigger_edge().
|
|
||||||
*
|
|
||||||
* Return value: the edge trigger
|
|
||||||
*/
|
|
||||||
ClutterGestureTriggerEdge
|
|
||||||
clutter_gesture_action_get_threshold_trigger_egde (ClutterGestureAction *action)
|
|
||||||
{
|
|
||||||
return action->priv->edge;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_gesture_action_set_property (GObject *gobject,
|
clutter_gesture_action_set_property (GObject *gobject,
|
||||||
guint prop_id,
|
guint prop_id,
|
||||||
@ -600,6 +567,10 @@ clutter_gesture_action_set_property (GObject *gobject,
|
|||||||
clutter_gesture_action_set_n_touch_points (self, g_value_get_int (value));
|
clutter_gesture_action_set_n_touch_points (self, g_value_get_int (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_THRESHOLD_TRIGGER_EDGE:
|
||||||
|
clutter_gesture_action_set_threshold_trigger_edge (self, g_value_get_enum (value));
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -620,6 +591,10 @@ clutter_gesture_action_get_property (GObject *gobject,
|
|||||||
g_value_set_int (value, self->priv->requested_nb_points);
|
g_value_set_int (value, self->priv->requested_nb_points);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_THRESHOLD_TRIGGER_EDGE:
|
||||||
|
g_value_set_enum (value, self->priv->edge);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -666,6 +641,24 @@ clutter_gesture_action_class_init (ClutterGestureActionClass *klass)
|
|||||||
1, G_MAXINT, 1,
|
1, G_MAXINT, 1,
|
||||||
CLUTTER_PARAM_READWRITE);
|
CLUTTER_PARAM_READWRITE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClutterGestureAction:threshold-trigger-edge:
|
||||||
|
*
|
||||||
|
* The trigger edge to be used by the action to either emit the
|
||||||
|
* #ClutterGestureAction::gesture-begin signal or to emit the
|
||||||
|
* #ClutterGestureAction::gesture-cancel signal.
|
||||||
|
*
|
||||||
|
* Since: 1.18
|
||||||
|
*/
|
||||||
|
gesture_props[PROP_THRESHOLD_TRIGGER_EDGE] =
|
||||||
|
g_param_spec_enum ("threshold-trigger-edge",
|
||||||
|
P_("Threshold Trigger Edge"),
|
||||||
|
P_("The trigger edge used by the action"),
|
||||||
|
CLUTTER_TYPE_GESTURE_TRIGGER_EDGE,
|
||||||
|
CLUTTER_GESTURE_TRIGGER_EDGE_NONE,
|
||||||
|
CLUTTER_PARAM_READWRITE |
|
||||||
|
G_PARAM_CONSTRUCT_ONLY);
|
||||||
|
|
||||||
g_object_class_install_properties (gobject_class,
|
g_object_class_install_properties (gobject_class,
|
||||||
PROP_LAST,
|
PROP_LAST,
|
||||||
gesture_props);
|
gesture_props);
|
||||||
@ -1161,3 +1154,49 @@ clutter_gesture_action_cancel (ClutterGestureAction *action)
|
|||||||
|
|
||||||
cancel_gesture (action);
|
cancel_gesture (action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_gesture_action_set_threshold_trigger_edge:
|
||||||
|
* @action: a #ClutterGestureAction
|
||||||
|
* @edge: the %ClutterGestureTriggerEdge
|
||||||
|
*
|
||||||
|
* Sets the edge trigger for the gesture drag threshold, if any.
|
||||||
|
*
|
||||||
|
* This function should only be called by sub-classes of
|
||||||
|
* #ClutterGestureAction during their construction phase.
|
||||||
|
*
|
||||||
|
* Since: 1.18
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
clutter_gesture_action_set_threshold_trigger_edge (ClutterGestureAction *action,
|
||||||
|
ClutterGestureTriggerEdge edge)
|
||||||
|
{
|
||||||
|
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
||||||
|
|
||||||
|
if (action->priv->edge == edge)
|
||||||
|
return;
|
||||||
|
|
||||||
|
action->priv->edge = edge;
|
||||||
|
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (action), gesture_props[PROP_THRESHOLD_TRIGGER_EDGE]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_gesture_action_get_threshold_trigger_egde:
|
||||||
|
* @action: a #ClutterGestureAction
|
||||||
|
*
|
||||||
|
* Retrieves the edge trigger of the gesture @action, as set using
|
||||||
|
* clutter_gesture_action_set_threshold_trigger_edge().
|
||||||
|
*
|
||||||
|
* Return value: the edge trigger
|
||||||
|
*
|
||||||
|
* Since: 1.18
|
||||||
|
*/
|
||||||
|
ClutterGestureTriggerEdge
|
||||||
|
clutter_gesture_action_get_threshold_trigger_egde (ClutterGestureAction *action)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action),
|
||||||
|
CLUTTER_GESTURE_TRIGGER_EDGE_NONE);
|
||||||
|
|
||||||
|
return action->priv->edge;
|
||||||
|
}
|
||||||
|
@ -149,6 +149,12 @@ const ClutterEvent * clutter_gesture_action_get_last_event (ClutterGestu
|
|||||||
CLUTTER_AVAILABLE_IN_1_12
|
CLUTTER_AVAILABLE_IN_1_12
|
||||||
void clutter_gesture_action_cancel (ClutterGestureAction *action);
|
void clutter_gesture_action_cancel (ClutterGestureAction *action);
|
||||||
|
|
||||||
|
CLUTTER_AVAILABLE_IN_1_18
|
||||||
|
void clutter_gesture_action_set_threshold_trigger_edge (ClutterGestureAction *action,
|
||||||
|
ClutterGestureTriggerEdge edge);
|
||||||
|
CLUTTER_AVAILABLE_IN_1_18
|
||||||
|
ClutterGestureTriggerEdge clutter_gesture_action_get_threshold_trigger_egde (ClutterGestureAction *action);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __CLUTTER_GESTURE_ACTION_H__ */
|
#endif /* __CLUTTER_GESTURE_ACTION_H__ */
|
||||||
|
@ -750,10 +750,13 @@ clutter_gesture_action_get_n_touch_points
|
|||||||
clutter_gesture_action_get_press_coords
|
clutter_gesture_action_get_press_coords
|
||||||
clutter_gesture_action_get_release_coords
|
clutter_gesture_action_get_release_coords
|
||||||
clutter_gesture_action_get_sequence
|
clutter_gesture_action_get_sequence
|
||||||
|
clutter_gesture_action_get_threshold_trigger_egde
|
||||||
clutter_gesture_action_get_type
|
clutter_gesture_action_get_type
|
||||||
clutter_gesture_action_get_velocity
|
clutter_gesture_action_get_velocity
|
||||||
clutter_gesture_action_set_n_touch_points
|
clutter_gesture_action_set_n_touch_points
|
||||||
|
clutter_gesture_action_set_threshold_trigger_edge
|
||||||
clutter_gesture_action_new
|
clutter_gesture_action_new
|
||||||
|
clutter_gesture_trigger_edge_get_type
|
||||||
clutter_get_accessibility_enabled
|
clutter_get_accessibility_enabled
|
||||||
clutter_get_actor_by_gid
|
clutter_get_actor_by_gid
|
||||||
clutter_get_current_event
|
clutter_get_current_event
|
||||||
|
@ -2989,6 +2989,8 @@ clutter_gesture_action_set_n_touch_points
|
|||||||
clutter_gesture_action_get_n_current_points
|
clutter_gesture_action_get_n_current_points
|
||||||
clutter_gesture_action_get_sequence
|
clutter_gesture_action_get_sequence
|
||||||
clutter_gesture_action_get_device
|
clutter_gesture_action_get_device
|
||||||
|
clutter_gesture_action_set_threshold_trigger_edge
|
||||||
|
clutter_gesture_action_get_threshold_trigger_egde
|
||||||
clutter_gesture_action_cancel
|
clutter_gesture_action_cancel
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
CLUTTER_GESTURE_ACTION
|
CLUTTER_GESTURE_ACTION
|
||||||
|
Loading…
Reference in New Issue
Block a user