[clutter/clutter-1.16] gesture-action: add n-touch-points property
- From: Lionel Landwerlin <llandwerlin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter/clutter-1.16] gesture-action: add n-touch-points property
- Date: Tue, 23 Apr 2013 16:38:20 +0000 (UTC)
commit fda406b4a810a59a2cbd5c7ffbf0c38fca8be40b
Author: Lionel Landwerlin <llandwerlin gmail com>
Date: Sun Apr 7 16:11:42 2013 +0100
gesture-action: add n-touch-points property
https://bugzilla.gnome.org/show_bug.cgi?id=698668
clutter/clutter-gesture-action.c | 89 ++++++++++++++++++++++++++++++++++++++
1 files changed, 89 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-gesture-action.c b/clutter/clutter-gesture-action.c
index 27eb1a5..64d1ac6 100644
--- a/clutter/clutter-gesture-action.c
+++ b/clutter/clutter-gesture-action.c
@@ -130,6 +130,15 @@ struct _ClutterGestureActionPrivate
enum
{
+ PROP_0,
+
+ PROP_N_TOUCH_POINTS,
+
+ PROP_LAST
+};
+
+enum
+{
GESTURE_BEGIN,
GESTURE_PROGRESS,
GESTURE_END,
@@ -138,6 +147,7 @@ enum
LAST_SIGNAL
};
+static GParamSpec *gesture_props[PROP_LAST];
static guint gesture_signals[LAST_SIGNAL] = { 0, };
G_DEFINE_TYPE (ClutterGestureAction, clutter_gesture_action, CLUTTER_TYPE_ACTION);
@@ -520,12 +530,67 @@ _clutter_gesture_action_set_threshold_trigger_edge (ClutterGestureAction *a
}
static void
+clutter_gesture_action_set_property (GObject *gobject,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ ClutterGestureAction *self = CLUTTER_GESTURE_ACTION (gobject);
+
+ switch (prop_id)
+ {
+ case PROP_N_TOUCH_POINTS:
+ clutter_gesture_action_set_n_touch_points (self, g_value_get_int (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+clutter_gesture_action_get_property (GObject *gobject,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ ClutterGestureAction *self = CLUTTER_GESTURE_ACTION (gobject);
+
+ switch (prop_id)
+ {
+ case PROP_N_TOUCH_POINTS:
+ g_value_set_int (value, self->priv->requested_nb_points);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+clutter_gesture_action_finalize (GObject *gobject)
+{
+ ClutterGestureActionPrivate *priv = CLUTTER_GESTURE_ACTION (gobject)->priv;
+
+ g_array_unref (priv->points);
+
+ G_OBJECT_CLASS (clutter_gesture_action_parent_class)->finalize (gobject);
+}
+
+static void
clutter_gesture_action_class_init (ClutterGestureActionClass *klass)
{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
g_type_class_add_private (klass, sizeof (ClutterGestureActionPrivate));
+ gobject_class->finalize = clutter_gesture_action_finalize;
+ gobject_class->set_property = clutter_gesture_action_set_property;
+ gobject_class->get_property = clutter_gesture_action_get_property;
+
meta_class->set_actor = clutter_gesture_action_set_actor;
klass->gesture_begin = default_event_handler;
@@ -533,6 +598,24 @@ clutter_gesture_action_class_init (ClutterGestureActionClass *klass)
klass->gesture_prepare = default_event_handler;
/**
+ * ClutterGestureAction:n-touch-points:
+ *
+ * Number of touch points to trigger a gesture action.
+ *
+ * Since: 1.16
+ */
+ gesture_props[PROP_N_TOUCH_POINTS] =
+ g_param_spec_int ("n-touch-points",
+ P_("Number touch points"),
+ P_("Number of touch points"),
+ 1, G_MAXINT, 1,
+ CLUTTER_PARAM_READWRITE);
+
+ g_object_class_install_properties (gobject_class,
+ PROP_LAST,
+ gesture_props);
+
+ /**
* ClutterGestureAction::gesture-begin:
* @action: the #ClutterGestureAction that emitted the signal
* @actor: the #ClutterActor attached to the @action
@@ -884,6 +967,9 @@ clutter_gesture_action_set_n_touch_points (ClutterGestureAction *action,
priv = action->priv;
+ if (priv->requested_nb_points == nb_points)
+ return;
+
priv->requested_nb_points = nb_points;
if (priv->in_gesture)
@@ -914,6 +1000,9 @@ clutter_gesture_action_set_n_touch_points (ClutterGestureAction *action,
}
}
}
+
+ g_object_notify_by_pspec (G_OBJECT (action),
+ gesture_props[PROP_N_TOUCH_POINTS]);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]