summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2012-11-26 13:09:23 -0500
committerJasper St. Pierre <jstpierre@mecheye.net>2012-11-30 18:13:54 -0500
commit3e671f9c1b542f6b843c28e80c174bfaa93bc2a5 (patch)
treed1d74eb942b90c16a987eff88a283ec378eb75fb
parent15b811840c81a990ff0d09eba05952fd34277c63 (diff)
downloadclutter-3e671f9c1b542f6b843c28e80c174bfaa93bc2a5.tar.gz
swipe-action: Introduce new ::swipe signal
This deprecates the old ::swept signal, which didn't have a handled boolean parameter.
-rw-r--r--clutter/clutter-marshal.list1
-rw-r--r--clutter/clutter-swipe-action.c35
-rw-r--r--clutter/clutter-swipe-action.h4
3 files changed, 39 insertions, 1 deletions
diff --git a/clutter/clutter-marshal.list b/clutter/clutter-marshal.list
index 7eff755a9..fc7680db6 100644
--- a/clutter/clutter-marshal.list
+++ b/clutter/clutter-marshal.list
@@ -4,6 +4,7 @@ BOOLEAN:OBJECT,BOOLEAN
BOOLEAN:OBJECT,BOXED,DOUBLE
BOOLEAN:OBJECT,DOUBLE
BOOLEAN:OBJECT,ENUM
+BOOLEAN:OBJECT,FLAGS
BOOLEAN:STRING,UINT,FLAGS
BOOLEAN:OBJECT
BOOLEAN:OBJECT,FLOAT,FLOAT
diff --git a/clutter/clutter-swipe-action.c b/clutter/clutter-swipe-action.c
index 7ccf37ab7..4b41bb66a 100644
--- a/clutter/clutter-swipe-action.c
+++ b/clutter/clutter-swipe-action.c
@@ -59,6 +59,7 @@ struct _ClutterSwipeActionPrivate
enum
{
SWEPT,
+ SWIPE,
LAST_SIGNAL
};
@@ -141,6 +142,7 @@ gesture_end (ClutterGestureAction *action,
gfloat press_x, press_y;
gfloat release_x, release_y;
ClutterSwipeDirection direction = 0;
+ gboolean can_emit_swipe;
clutter_gesture_action_get_press_coords (action,
0,
@@ -160,7 +162,11 @@ gesture_end (ClutterGestureAction *action,
else if (press_y - release_y > priv->threshold)
direction |= CLUTTER_SWIPE_DIRECTION_UP;
- g_signal_emit (action, swipe_signals[SWEPT], 0, actor, direction);
+ /* XXX:2.0 remove */
+ g_signal_emit (action, swipe_signals[SWIPE], 0, actor, direction,
+ &can_emit_swipe);
+ if (can_emit_swipe)
+ g_signal_emit (action, swipe_signals[SWEPT], 0, actor, direction);
}
static void
@@ -184,6 +190,8 @@ clutter_swipe_action_class_init (ClutterSwipeActionClass *klass)
* The ::swept signal is emitted when a swipe gesture is recognized on the
* attached actor.
*
+ * Deprecated: 1.14: Use the ::swipe signal instead.
+ *
* Since: 1.8
*/
swipe_signals[SWEPT] =
@@ -196,6 +204,31 @@ clutter_swipe_action_class_init (ClutterSwipeActionClass *klass)
G_TYPE_NONE, 2,
CLUTTER_TYPE_ACTOR,
CLUTTER_TYPE_SWIPE_DIRECTION);
+
+ /**
+ * ClutterSwipeAction::swipe:
+ * @action: the #ClutterSwipeAction that emitted the signal
+ * @actor: the #ClutterActor attached to the @action
+ * @direction: the main direction of the swipe gesture
+ *
+ * The ::swipe signal is emitted when a swipe gesture is recognized on the
+ * attached actor.
+ *
+ * Return value: %TRUE if the pan should continue, and %FALSE if
+ * the pan should be cancelled.
+ *
+ * Since: 1.14
+ */
+ swipe_signals[SWIPE] =
+ g_signal_new (I_("swipe"),
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ClutterSwipeActionClass, swipe),
+ _clutter_boolean_continue_accumulator, NULL,
+ _clutter_marshal_BOOLEAN__OBJECT_FLAGS,
+ G_TYPE_BOOLEAN, 2,
+ CLUTTER_TYPE_ACTOR,
+ CLUTTER_TYPE_SWIPE_DIRECTION);
}
static void
diff --git a/clutter/clutter-swipe-action.h b/clutter/clutter-swipe-action.h
index 4356d9182..395c8170c 100644
--- a/clutter/clutter-swipe-action.h
+++ b/clutter/clutter-swipe-action.h
@@ -83,6 +83,10 @@ struct _ClutterSwipeActionClass
ClutterActor *actor,
ClutterSwipeDirection direction);
+ gboolean (* swipe) (ClutterSwipeAction *action,
+ ClutterActor *actor,
+ ClutterSwipeDirection direction);
+
/*< private >*/
void (* _clutter_swipe_action1) (void);
void (* _clutter_swipe_action2) (void);