gesture-action: add gesture_prepare() virtual function

The gesture_prepare() virtual function is called before the
::gesture-begin signal is emitted, and allows a subclass to reset
its state.

https://bugzilla.gnome.org/show_bug.cgi?id=683431
This commit is contained in:
Emanuele Aina 2012-09-05 14:47:25 +00:00 committed by Emmanuele Bassi
parent 609766fa2b
commit 2001cd7a2c
2 changed files with 11 additions and 1 deletions

View File

@ -253,6 +253,12 @@ stage_captured_event_cb (ClutterActor *stage,
{
priv->in_gesture = TRUE;
if (!CLUTTER_GESTURE_ACTION_GET_CLASS (action)->gesture_prepare (action, actor))
{
cancel_gesture (action);
return CLUTTER_EVENT_PROPAGATE;
}
g_signal_emit (action, gesture_signals[GESTURE_BEGIN], 0, actor,
&return_value);
if (!return_value)
@ -415,6 +421,7 @@ clutter_gesture_action_class_init (ClutterGestureActionClass *klass)
klass->gesture_begin = default_event_handler;
klass->gesture_progress = default_event_handler;
klass->gesture_prepare = default_event_handler;
/**
* ClutterGestureAction::gesture-begin:

View File

@ -67,6 +67,8 @@ struct _ClutterGestureAction
* @gesture_progress: class handler for the #ClutterGestureAction::gesture-progress signal
* @gesture_end: class handler for the #ClutterGestureAction::gesture-end signal
* @gesture_cancel: class handler for the #ClutterGestureAction::gesture-cancel signal
* @gesture_prepare: virtual function called before emitting the
* #ClutterGestureAction::gesture-cancel signal
*
* The <structname>ClutterGestureClass</structname> structure contains only
* private data.
@ -87,6 +89,8 @@ struct _ClutterGestureActionClass
ClutterActor *actor);
void (* gesture_cancel) (ClutterGestureAction *action,
ClutterActor *actor);
gboolean (* gesture_prepare) (ClutterGestureAction *action,
ClutterActor *actor);
/*< private >*/
void (* _clutter_gesture_action1) (void);
@ -95,7 +99,6 @@ struct _ClutterGestureActionClass
void (* _clutter_gesture_action4) (void);
void (* _clutter_gesture_action5) (void);
void (* _clutter_gesture_action6) (void);
void (* _clutter_gesture_action7) (void);
};
GType clutter_gesture_action_get_type (void) G_GNUC_CONST;