[clutter/clutter-1.18] GestureActions: Set threshold-trigger-edge at right time



commit 54e2657cb0265c70f82249c83962901a6492d863
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Feb 12 17:36:43 2014 +0100

    GestureActions: Set threshold-trigger-edge at right time
    
    It was set during the _init(), and swiftly overridden with the
    default value in construct. Do it in constructed() instead.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=724242

 clutter/clutter-pan-action.c    |   15 ++++++++++-----
 clutter/clutter-rotate-action.c |   14 +++++++++++++-
 clutter/clutter-swipe-action.c  |   14 +++++++++++---
 clutter/clutter-tap-action.c    |   13 +++++++++++--
 clutter/clutter-zoom-action.c   |   11 ++++++++++-
 5 files changed, 55 insertions(+), 12 deletions(-)
---
diff --git a/clutter/clutter-pan-action.c b/clutter/clutter-pan-action.c
index 63c3118..a1f6124 100644
--- a/clutter/clutter-pan-action.c
+++ b/clutter/clutter-pan-action.c
@@ -387,6 +387,15 @@ clutter_pan_action_get_property (GObject    *gobject,
 }
 
 static void
+clutter_pan_action_constructed (GObject *gobject)
+{
+  ClutterGestureAction *gesture;
+
+  gesture = CLUTTER_GESTURE_ACTION (gobject);
+  clutter_gesture_action_set_threshold_trigger_edge (gesture, CLUTTER_GESTURE_TRIGGER_EDGE_AFTER);
+}
+
+static void
 clutter_pan_action_dispose (GObject *gobject)
 {
   ClutterPanActionPrivate *priv = CLUTTER_PAN_ACTION (gobject)->priv;
@@ -498,6 +507,7 @@ clutter_pan_action_class_init (ClutterPanActionClass *klass)
                          1.0, G_MAXDOUBLE, default_acceleration_factor,
                          CLUTTER_PARAM_READWRITE);
 
+  gobject_class->constructed = clutter_pan_action_constructed;
   gobject_class->set_property = clutter_pan_action_set_property;
   gobject_class->get_property = clutter_pan_action_get_property;
   gobject_class->dispose = clutter_pan_action_dispose;
@@ -557,15 +567,10 @@ clutter_pan_action_class_init (ClutterPanActionClass *klass)
 static void
 clutter_pan_action_init (ClutterPanAction *self)
 {
-  ClutterGestureAction *gesture;
-
   self->priv = clutter_pan_action_get_instance_private (self);
   self->priv->deceleration_rate = default_deceleration_rate;
   self->priv->acceleration_factor = default_acceleration_factor;
   self->priv->state = PAN_STATE_INACTIVE;
-
-  gesture = CLUTTER_GESTURE_ACTION (self);
-  clutter_gesture_action_set_threshold_trigger_edge (gesture, CLUTTER_GESTURE_TRIGGER_EDGE_AFTER);
 }
 
 /**
diff --git a/clutter/clutter-rotate-action.c b/clutter/clutter-rotate-action.c
index d46d4ff..7286c2b 100644
--- a/clutter/clutter-rotate-action.c
+++ b/clutter/clutter-rotate-action.c
@@ -173,13 +173,26 @@ clutter_rotate_action_gesture_cancel (ClutterGestureAction *action,
 }
 
 static void
+clutter_rotate_action_constructed (GObject *gobject)
+{
+  ClutterGestureAction *gesture;
+
+  gesture = CLUTTER_GESTURE_ACTION (gobject);
+  clutter_gesture_action_set_threshold_trigger_edge (gesture, CLUTTER_GESTURE_TRIGGER_EDGE_NONE);
+}
+
+static void
 clutter_rotate_action_class_init (ClutterRotateActionClass *klass)
 {
   ClutterGestureActionClass *gesture_class =
     CLUTTER_GESTURE_ACTION_CLASS (klass);
+  GObjectClass *object_class =
+    G_OBJECT_CLASS (klass);
 
   klass->rotate = clutter_rotate_action_real_rotate;
 
+  object_class->constructed = clutter_rotate_action_constructed;
+
   gesture_class->gesture_begin = clutter_rotate_action_gesture_begin;
   gesture_class->gesture_progress = clutter_rotate_action_gesture_progress;
   gesture_class->gesture_cancel = clutter_rotate_action_gesture_cancel;
@@ -221,7 +234,6 @@ clutter_rotate_action_init (ClutterRotateAction *self)
 
   gesture = CLUTTER_GESTURE_ACTION (self);
   clutter_gesture_action_set_n_touch_points (gesture, 2);
-  clutter_gesture_action_set_threshold_trigger_edge (gesture, CLUTTER_GESTURE_TRIGGER_EDGE_NONE);
 }
 
 /**
diff --git a/clutter/clutter-swipe-action.c b/clutter/clutter-swipe-action.c
index da1aab3..cac6199 100644
--- a/clutter/clutter-swipe-action.c
+++ b/clutter/clutter-swipe-action.c
@@ -179,10 +179,21 @@ clutter_swipe_action_real_swipe (ClutterSwipeAction    *action,
 }
 
 static void
+clutter_swipe_action_constructed (GObject *object)
+{
+  clutter_gesture_action_set_threshold_trigger_edge (CLUTTER_GESTURE_ACTION (object),
+                                                     CLUTTER_GESTURE_TRIGGER_EDGE_AFTER);
+}
+
+static void
 clutter_swipe_action_class_init (ClutterSwipeActionClass *klass)
 {
   ClutterGestureActionClass *gesture_class =
       CLUTTER_GESTURE_ACTION_CLASS (klass);
+  GObjectClass *object_class =
+      G_OBJECT_CLASS (klass);
+
+  object_class->constructed = clutter_swipe_action_constructed;
 
   gesture_class->gesture_begin = gesture_begin;
   gesture_class->gesture_progress = gesture_progress;
@@ -246,9 +257,6 @@ static void
 clutter_swipe_action_init (ClutterSwipeAction *self)
 {
   self->priv = clutter_swipe_action_get_instance_private (self);
-
-  clutter_gesture_action_set_threshold_trigger_edge (CLUTTER_GESTURE_ACTION (self),
-                                                     CLUTTER_GESTURE_TRIGGER_EDGE_AFTER);
 }
 
 /**
diff --git a/clutter/clutter-tap-action.c b/clutter/clutter-tap-action.c
index d676980..4d30eb1 100644
--- a/clutter/clutter-tap-action.c
+++ b/clutter/clutter-tap-action.c
@@ -92,10 +92,21 @@ gesture_end (ClutterGestureAction *gesture,
 }
 
 static void
+clutter_tap_action_constructed (GObject *object)
+{
+  clutter_gesture_action_set_threshold_trigger_edge (CLUTTER_GESTURE_ACTION (object),
+                                                     CLUTTER_GESTURE_TRIGGER_EDGE_BEFORE);
+}
+
+static void
 clutter_tap_action_class_init (ClutterTapActionClass *klass)
 {
   ClutterGestureActionClass *gesture_class =
       CLUTTER_GESTURE_ACTION_CLASS (klass);
+  GObjectClass *object_class =
+      G_OBJECT_CLASS (klass);
+
+  object_class->constructed = clutter_tap_action_constructed;
 
   gesture_class->gesture_end = gesture_end;
 
@@ -122,8 +133,6 @@ clutter_tap_action_class_init (ClutterTapActionClass *klass)
 static void
 clutter_tap_action_init (ClutterTapAction *self)
 {
-  clutter_gesture_action_set_threshold_trigger_edge (CLUTTER_GESTURE_ACTION (self),
-                                                     CLUTTER_GESTURE_TRIGGER_EDGE_BEFORE);
 }
 
 /**
diff --git a/clutter/clutter-zoom-action.c b/clutter/clutter-zoom-action.c
index 36d2de0..4e844a9 100644
--- a/clutter/clutter-zoom-action.c
+++ b/clutter/clutter-zoom-action.c
@@ -327,12 +327,22 @@ clutter_zoom_action_dispose (GObject *gobject)
 }
 
 static void
+clutter_zoom_action_constructed (GObject *gobject)
+{
+  ClutterGestureAction *gesture;
+
+  gesture = CLUTTER_GESTURE_ACTION (gobject);
+  clutter_gesture_action_set_threshold_trigger_edge (gesture, CLUTTER_GESTURE_TRIGGER_EDGE_NONE);
+}
+
+static void
 clutter_zoom_action_class_init (ClutterZoomActionClass *klass)
 {
   ClutterGestureActionClass *gesture_class =
     CLUTTER_GESTURE_ACTION_CLASS (klass);
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
+  gobject_class->constructed = clutter_zoom_action_constructed;
   gobject_class->set_property = clutter_zoom_action_set_property;
   gobject_class->get_property = clutter_zoom_action_get_property;
   gobject_class->dispose = clutter_zoom_action_dispose;
@@ -406,7 +416,6 @@ clutter_zoom_action_init (ClutterZoomAction *self)
 
   gesture = CLUTTER_GESTURE_ACTION (self);
   clutter_gesture_action_set_n_touch_points (gesture, 2);
-  clutter_gesture_action_set_threshold_trigger_edge (gesture, CLUTTER_GESTURE_TRIGGER_EDGE_NONE);
 }
 
 /**


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]