[clutter] gesture-action: add gesture_prepare() virtual function



commit 2001cd7a2c4b3e5fb6ac48149208756900479308
Author: Emanuele Aina <emanuele aina collabora com>
Date:   Wed Sep 5 14:47:25 2012 +0000

    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

 clutter/clutter-gesture-action.c |    7 +++++++
 clutter/clutter-gesture-action.h |    5 ++++-
 2 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/clutter/clutter-gesture-action.c b/clutter/clutter-gesture-action.c
index 585c622..2f77a14 100644
--- a/clutter/clutter-gesture-action.c
+++ b/clutter/clutter-gesture-action.c
@@ -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:
diff --git a/clutter/clutter-gesture-action.h b/clutter/clutter-gesture-action.h
index 8d6f663..2a18a30 100644
--- a/clutter/clutter-gesture-action.h
+++ b/clutter/clutter-gesture-action.h
@@ -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;



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