[clutter/clutter-1.18] Explicitly set the trigger edge in GestureAction subclasses



commit 8cb326dc54e7b4abe33bf88874203d9e2729ec2b
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Thu Dec 5 11:51:07 2013 +0000

    Explicitly set the trigger edge in GestureAction subclasses
    
    Each GestureAction subclass has its own trigger edge handling, so we
    want to be resilient in case of changes in the super-class.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=710227

 clutter/clutter-pan-action.c    |    6 ++++++
 clutter/clutter-rotate-action.c |    7 ++++++-
 clutter/clutter-swipe-action.c  |    4 ++++
 clutter/clutter-zoom-action.c   |    7 ++++++-
 4 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/clutter/clutter-pan-action.c b/clutter/clutter-pan-action.c
index 14188be..63c3118 100644
--- a/clutter/clutter-pan-action.c
+++ b/clutter/clutter-pan-action.c
@@ -61,6 +61,7 @@
 
 #include "clutter-debug.h"
 #include "clutter-enum-types.h"
+#include "clutter-gesture-action-private.h"
 #include "clutter-marshal.h"
 #include "clutter-private.h"
 #include <math.h>
@@ -556,10 +557,15 @@ 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 7c155f0..d46d4ff 100644
--- a/clutter/clutter-rotate-action.c
+++ b/clutter/clutter-rotate-action.c
@@ -43,6 +43,7 @@
 
 #include "clutter-debug.h"
 #include "clutter-enum-types.h"
+#include "clutter-gesture-action-private.h"
 #include "clutter-marshal.h"
 #include "clutter-private.h"
 
@@ -214,9 +215,13 @@ clutter_rotate_action_class_init (ClutterRotateActionClass *klass)
 static void
 clutter_rotate_action_init (ClutterRotateAction *self)
 {
+  ClutterGestureAction *gesture;
+
   self->priv = clutter_rotate_action_get_instance_private (self);
 
-  clutter_gesture_action_set_n_touch_points (CLUTTER_GESTURE_ACTION (self), 2);
+  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 96b7c09..da1aab3 100644
--- a/clutter/clutter-swipe-action.c
+++ b/clutter/clutter-swipe-action.c
@@ -45,6 +45,7 @@
 
 #include "clutter-debug.h"
 #include "clutter-enum-types.h"
+#include "clutter-gesture-action-private.h"
 #include "clutter-marshal.h"
 #include "clutter-private.h"
 
@@ -245,6 +246,9 @@ 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-zoom-action.c b/clutter/clutter-zoom-action.c
index 3f4eb9a..36d2de0 100644
--- a/clutter/clutter-zoom-action.c
+++ b/clutter/clutter-zoom-action.c
@@ -56,6 +56,7 @@
 
 #include "clutter-debug.h"
 #include "clutter-enum-types.h"
+#include "clutter-gesture-action-private.h"
 #include "clutter-marshal.h"
 #include "clutter-private.h"
 #include "clutter-stage-private.h"
@@ -398,10 +399,14 @@ clutter_zoom_action_class_init (ClutterZoomActionClass *klass)
 static void
 clutter_zoom_action_init (ClutterZoomAction *self)
 {
+  ClutterGestureAction *gesture;
+
   self->priv = clutter_zoom_action_get_instance_private (self);
   self->priv->zoom_axis = CLUTTER_ZOOM_BOTH;
 
-  clutter_gesture_action_set_n_touch_points (CLUTTER_GESTURE_ACTION (self), 2);
+  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]