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
This commit is contained in:
Bastien Nocera 2014-02-12 17:36:43 +01:00
parent 094f196bb5
commit 54e2657cb0
5 changed files with 55 additions and 12 deletions

View File

@ -386,6 +386,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 static void
clutter_pan_action_dispose (GObject *gobject) clutter_pan_action_dispose (GObject *gobject)
{ {
@ -498,6 +507,7 @@ clutter_pan_action_class_init (ClutterPanActionClass *klass)
1.0, G_MAXDOUBLE, default_acceleration_factor, 1.0, G_MAXDOUBLE, default_acceleration_factor,
CLUTTER_PARAM_READWRITE); CLUTTER_PARAM_READWRITE);
gobject_class->constructed = clutter_pan_action_constructed;
gobject_class->set_property = clutter_pan_action_set_property; gobject_class->set_property = clutter_pan_action_set_property;
gobject_class->get_property = clutter_pan_action_get_property; gobject_class->get_property = clutter_pan_action_get_property;
gobject_class->dispose = clutter_pan_action_dispose; gobject_class->dispose = clutter_pan_action_dispose;
@ -557,15 +567,10 @@ 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

@ -172,14 +172,27 @@ clutter_rotate_action_gesture_cancel (ClutterGestureAction *action,
&retval); &retval);
} }
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 static void
clutter_rotate_action_class_init (ClutterRotateActionClass *klass) clutter_rotate_action_class_init (ClutterRotateActionClass *klass)
{ {
ClutterGestureActionClass *gesture_class = ClutterGestureActionClass *gesture_class =
CLUTTER_GESTURE_ACTION_CLASS (klass); CLUTTER_GESTURE_ACTION_CLASS (klass);
GObjectClass *object_class =
G_OBJECT_CLASS (klass);
klass->rotate = clutter_rotate_action_real_rotate; 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_begin = clutter_rotate_action_gesture_begin;
gesture_class->gesture_progress = clutter_rotate_action_gesture_progress; gesture_class->gesture_progress = clutter_rotate_action_gesture_progress;
gesture_class->gesture_cancel = clutter_rotate_action_gesture_cancel; gesture_class->gesture_cancel = clutter_rotate_action_gesture_cancel;
@ -221,7 +234,6 @@ clutter_rotate_action_init (ClutterRotateAction *self)
gesture = CLUTTER_GESTURE_ACTION (self); gesture = CLUTTER_GESTURE_ACTION (self);
clutter_gesture_action_set_n_touch_points (gesture, 2); clutter_gesture_action_set_n_touch_points (gesture, 2);
clutter_gesture_action_set_threshold_trigger_edge (gesture, CLUTTER_GESTURE_TRIGGER_EDGE_NONE);
} }
/** /**

View File

@ -178,11 +178,22 @@ clutter_swipe_action_real_swipe (ClutterSwipeAction *action,
return TRUE; return TRUE;
} }
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 static void
clutter_swipe_action_class_init (ClutterSwipeActionClass *klass) clutter_swipe_action_class_init (ClutterSwipeActionClass *klass)
{ {
ClutterGestureActionClass *gesture_class = ClutterGestureActionClass *gesture_class =
CLUTTER_GESTURE_ACTION_CLASS (klass); 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_begin = gesture_begin;
gesture_class->gesture_progress = gesture_progress; gesture_class->gesture_progress = gesture_progress;
@ -246,9 +257,6 @@ 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

@ -91,11 +91,22 @@ gesture_end (ClutterGestureAction *gesture,
emit_tap (CLUTTER_TAP_ACTION (gesture), actor); emit_tap (CLUTTER_TAP_ACTION (gesture), actor);
} }
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 static void
clutter_tap_action_class_init (ClutterTapActionClass *klass) clutter_tap_action_class_init (ClutterTapActionClass *klass)
{ {
ClutterGestureActionClass *gesture_class = ClutterGestureActionClass *gesture_class =
CLUTTER_GESTURE_ACTION_CLASS (klass); 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; gesture_class->gesture_end = gesture_end;
@ -122,8 +133,6 @@ clutter_tap_action_class_init (ClutterTapActionClass *klass)
static void static void
clutter_tap_action_init (ClutterTapAction *self) clutter_tap_action_init (ClutterTapAction *self)
{ {
clutter_gesture_action_set_threshold_trigger_edge (CLUTTER_GESTURE_ACTION (self),
CLUTTER_GESTURE_TRIGGER_EDGE_BEFORE);
} }
/** /**

View File

@ -326,6 +326,15 @@ clutter_zoom_action_dispose (GObject *gobject)
G_OBJECT_CLASS (clutter_zoom_action_parent_class)->dispose (gobject); G_OBJECT_CLASS (clutter_zoom_action_parent_class)->dispose (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 static void
clutter_zoom_action_class_init (ClutterZoomActionClass *klass) clutter_zoom_action_class_init (ClutterZoomActionClass *klass)
{ {
@ -333,6 +342,7 @@ clutter_zoom_action_class_init (ClutterZoomActionClass *klass)
CLUTTER_GESTURE_ACTION_CLASS (klass); CLUTTER_GESTURE_ACTION_CLASS (klass);
GObjectClass *gobject_class = G_OBJECT_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->set_property = clutter_zoom_action_set_property;
gobject_class->get_property = clutter_zoom_action_get_property; gobject_class->get_property = clutter_zoom_action_get_property;
gobject_class->dispose = clutter_zoom_action_dispose; gobject_class->dispose = clutter_zoom_action_dispose;
@ -406,7 +416,6 @@ clutter_zoom_action_init (ClutterZoomAction *self)
gesture = CLUTTER_GESTURE_ACTION (self); gesture = CLUTTER_GESTURE_ACTION (self);
clutter_gesture_action_set_n_touch_points (gesture, 2); clutter_gesture_action_set_n_touch_points (gesture, 2);
clutter_gesture_action_set_threshold_trigger_edge (gesture, CLUTTER_GESTURE_TRIGGER_EDGE_NONE);
} }
/** /**