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
This commit is contained in:
Emmanuele Bassi 2013-12-05 11:51:07 +00:00
parent 154ca6ef99
commit 8cb326dc54
4 changed files with 22 additions and 2 deletions

View File

@ -61,6 +61,7 @@
#include "clutter-debug.h" #include "clutter-debug.h"
#include "clutter-enum-types.h" #include "clutter-enum-types.h"
#include "clutter-gesture-action-private.h"
#include "clutter-marshal.h" #include "clutter-marshal.h"
#include "clutter-private.h" #include "clutter-private.h"
#include <math.h> #include <math.h>
@ -556,10 +557,15 @@ clutter_pan_action_class_init (ClutterPanActionClass *klass)
static void static void
clutter_pan_action_init (ClutterPanAction *self) clutter_pan_action_init (ClutterPanAction *self)
{ {
ClutterGestureAction *gesture;
self->priv = clutter_pan_action_get_instance_private (self); self->priv = clutter_pan_action_get_instance_private (self);
self->priv->deceleration_rate = default_deceleration_rate; self->priv->deceleration_rate = default_deceleration_rate;
self->priv->acceleration_factor = default_acceleration_factor; self->priv->acceleration_factor = default_acceleration_factor;
self->priv->state = PAN_STATE_INACTIVE; self->priv->state = PAN_STATE_INACTIVE;
gesture = CLUTTER_GESTURE_ACTION (self);
clutter_gesture_action_set_threshold_trigger_edge (gesture, CLUTTER_GESTURE_TRIGGER_EDGE_AFTER);
} }
/** /**

View File

@ -43,6 +43,7 @@
#include "clutter-debug.h" #include "clutter-debug.h"
#include "clutter-enum-types.h" #include "clutter-enum-types.h"
#include "clutter-gesture-action-private.h"
#include "clutter-marshal.h" #include "clutter-marshal.h"
#include "clutter-private.h" #include "clutter-private.h"
@ -214,9 +215,13 @@ clutter_rotate_action_class_init (ClutterRotateActionClass *klass)
static void static void
clutter_rotate_action_init (ClutterRotateAction *self) clutter_rotate_action_init (ClutterRotateAction *self)
{ {
ClutterGestureAction *gesture;
self->priv = clutter_rotate_action_get_instance_private (self); 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);
} }
/** /**

View File

@ -45,6 +45,7 @@
#include "clutter-debug.h" #include "clutter-debug.h"
#include "clutter-enum-types.h" #include "clutter-enum-types.h"
#include "clutter-gesture-action-private.h"
#include "clutter-marshal.h" #include "clutter-marshal.h"
#include "clutter-private.h" #include "clutter-private.h"
@ -245,6 +246,9 @@ static void
clutter_swipe_action_init (ClutterSwipeAction *self) clutter_swipe_action_init (ClutterSwipeAction *self)
{ {
self->priv = clutter_swipe_action_get_instance_private (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);
} }
/** /**

View File

@ -56,6 +56,7 @@
#include "clutter-debug.h" #include "clutter-debug.h"
#include "clutter-enum-types.h" #include "clutter-enum-types.h"
#include "clutter-gesture-action-private.h"
#include "clutter-marshal.h" #include "clutter-marshal.h"
#include "clutter-private.h" #include "clutter-private.h"
#include "clutter-stage-private.h" #include "clutter-stage-private.h"
@ -398,10 +399,14 @@ clutter_zoom_action_class_init (ClutterZoomActionClass *klass)
static void static void
clutter_zoom_action_init (ClutterZoomAction *self) clutter_zoom_action_init (ClutterZoomAction *self)
{ {
ClutterGestureAction *gesture;
self->priv = clutter_zoom_action_get_instance_private (self); self->priv = clutter_zoom_action_get_instance_private (self);
self->priv->zoom_axis = CLUTTER_ZOOM_BOTH; 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);
} }
/** /**