efl/gesture: add touch_count property for gesture event info
authorMike Blumenkrantz <zmike@samsung.com>
Fri, 17 Jan 2020 15:18:23 +0000 (10:18 -0500)
committerJongmin Lee <jm105.lee@samsung.com>
Tue, 11 Feb 2020 21:58:35 +0000 (06:58 +0900)
this allows us to provide the number of touch points active in any gesture
so we can detect e.g., double-tap with two fingers

Reviewed-by: woochan lee <wc0917.lee@samsung.com>
Differential Revision: https://phab.enlightenment.org/D11126

src/lib/evas/gesture/efl_canvas_gesture.c
src/lib/evas/gesture/efl_canvas_gesture.eo
src/lib/evas/gesture/efl_canvas_gesture_manager.c
src/lib/evas/gesture/efl_canvas_gesture_private.h
src/lib/evas/gesture/efl_canvas_gesture_touch.c
src/lib/evas/gesture/efl_canvas_gesture_touch.eo

index 077bc9b..231bc86 100644 (file)
@@ -1,3 +1,4 @@
+#define EFL_CANVAS_GESTURE_PROTECTED
 #include "efl_canvas_gesture_private.h"
 
 #define MY_CLASS EFL_CANVAS_GESTURE_CLASS
@@ -46,5 +47,17 @@ _efl_canvas_gesture_timestamp_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_
    return pd->timestamp;
 }
 
+EOLIAN static void
+_efl_canvas_gesture_touch_count_set(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Data *pd, unsigned int touch_count)
+{
+   pd->touch_count = touch_count;
+}
+
+EOLIAN static unsigned int
+_efl_canvas_gesture_touch_count_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Data *pd)
+{
+   return pd->touch_count;
+}
+
 #include "efl_canvas_gesture.eo.c"
 #include "efl_canvas_gesture_events.eo.c"
index 22334e2..26aef89 100644 (file)
@@ -46,5 +46,15 @@ abstract @beta Efl.Canvas.Gesture extends Efl.Object
             timestamp: uint;[[The time-stamp.]]
          }
       }
+      @property touch_count {
+         [[The current number of touch points recorded in the gesture.]]
+         get {
+         }
+         set @protected {
+         }
+         values {
+            touch_count: uint;[[The count of the touch points.]]
+         }
+      }
    }
 }
index 5a28b04..db2b3c1 100644 (file)
@@ -1,3 +1,4 @@
+#define EFL_CANVAS_GESTURE_PROTECTED
 #include "efl_canvas_gesture_private.h"
 
 #define MY_CLASS EFL_CANVAS_GESTURE_MANAGER_CLASS
@@ -192,6 +193,9 @@ _efl_canvas_gesture_manager_filter_event(void *data, Eo *target, void *event)
              if (!gesture)
                continue;
 
+             /* this is the "default" value for the event, recognizers may modify it if necessary */
+             efl_gesture_touch_count_set(gesture, efl_gesture_touch_points_count_get(touch_event));
+
              //Gesture detecting.
              recog_result = efl_gesture_recognizer_recognize(recognizer, gesture, target, touch_event);
              recog_state = recog_result & EFL_GESTURE_RECOGNIZER_RESULT_RESULT_MASK;
index 45c13a7..f77530f 100644 (file)
@@ -130,6 +130,7 @@ struct _Efl_Canvas_Gesture_Data
    Efl_Canvas_Gesture_State        state;
    Eina_Position2D                 hotspot;
    unsigned int                    timestamp;
+   unsigned int                    touch_count;
 };
 
 struct _Efl_Canvas_Gesture_Momentum_Data
index 3ed9dfe..3e90b7d 100644 (file)
@@ -122,6 +122,12 @@ _efl_canvas_gesture_touch_multi_touch_get(const Eo *obj EINA_UNUSED, Efl_Canvas_
    return pd->multi_touch;
 }
 
+EOLIAN static unsigned int
+_efl_canvas_gesture_touch_touch_points_count_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Touch_Data *pd)
+{
+   return pd->touch_down;
+}
+
 EOLIAN static const Efl_Gesture_Touch_Point_Data *
 _efl_canvas_gesture_touch_cur_data_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Touch_Data *pd)
 {
index a12d26d..ed9949e 100644 (file)
@@ -60,6 +60,14 @@ class @beta Efl.Canvas.Gesture_Touch extends Efl.Object
             return: bool; [[returns $true if its a multi touch]]
          }
       }
+      @property touch_points_count {
+         [[This provides the number of touch points active.]]
+         get {
+         }
+         values {
+            touch_count: uint; [[The number of active touch points.]]
+         }
+      }
       @property state {
          [[This property holds the state of the touch event.]]
          get {