summaryrefslogtreecommitdiff
path: root/src/lib/evas
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2020-02-11 10:29:11 -0500
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-02-14 09:21:15 +0100
commit93abc9cbeb82e118fdeee85b59a931c92c115415 (patch)
tree4ca6ad24383495fbb3a67158e59cc4546abd4ead /src/lib/evas
parentf917f75c56167ab87654d4209a48174da64ea721 (diff)
efl/gesture: rework custom gesture recognizer methodology
this needs to return the actual gesture class type so that custom gesture events can implement their own properties if necessary Reviewed-by: woochan lee <wc0917.lee@samsung.com> Differential Revision: https://phab.enlightenment.org/D11322
Diffstat (limited to 'src/lib/evas')
-rw-r--r--src/lib/evas/gesture/efl_canvas_gesture_custom.eo4
-rw-r--r--src/lib/evas/gesture/efl_canvas_gesture_manager.c71
-rw-r--r--src/lib/evas/gesture/efl_canvas_gesture_recognizer.eo4
-rw-r--r--src/lib/evas/gesture/efl_canvas_gesture_recognizer_custom.c4
-rw-r--r--src/lib/evas/gesture/efl_canvas_gesture_recognizer_double_tap.c4
-rw-r--r--src/lib/evas/gesture/efl_canvas_gesture_recognizer_flick.c4
-rw-r--r--src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_tap.c4
-rw-r--r--src/lib/evas/gesture/efl_canvas_gesture_recognizer_momentum.c4
-rw-r--r--src/lib/evas/gesture/efl_canvas_gesture_recognizer_tap.c4
-rw-r--r--src/lib/evas/gesture/efl_canvas_gesture_recognizer_triple_tap.c4
-rw-r--r--src/lib/evas/gesture/efl_canvas_gesture_recognizer_zoom.c4
11 files changed, 39 insertions, 72 deletions
diff --git a/src/lib/evas/gesture/efl_canvas_gesture_custom.eo b/src/lib/evas/gesture/efl_canvas_gesture_custom.eo
index 4e4f3ae3d0..b344801e95 100644
--- a/src/lib/evas/gesture/efl_canvas_gesture_custom.eo
+++ b/src/lib/evas/gesture/efl_canvas_gesture_custom.eo
@@ -1,4 +1,5 @@
1import eina_types; 1import eina_types;
2parse efl_canvas_gesture_recognizer;
2 3
3class @beta Efl.Canvas.Gesture_Custom extends Efl.Canvas.Gesture 4class @beta Efl.Canvas.Gesture_Custom extends Efl.Canvas.Gesture
4{ 5{
@@ -9,7 +10,8 @@ class @beta Efl.Canvas.Gesture_Custom extends Efl.Canvas.Gesture
9 Application developers receive these objects inside a gesture event and do not typically need to create their own. 10 Application developers receive these objects inside a gesture event and do not typically need to create their own.
10 11
11 Custom gesture recognizers which implement their own gesture properties (e.g., gesture momentum or angle) must 12 Custom gesture recognizers which implement their own gesture properties (e.g., gesture momentum or angle) must
12 inherit this class. 13 inherit this class, and their recognizers must implement the @Efl.Canvas.Gesture_Recognizer.type property to return
14 this class.
13 ]] 15 ]]
14 c_prefix: efl_gesture_custom; 16 c_prefix: efl_gesture_custom;
15 methods { 17 methods {
diff --git a/src/lib/evas/gesture/efl_canvas_gesture_manager.c b/src/lib/evas/gesture/efl_canvas_gesture_manager.c
index da6d8308b0..2bee20c248 100644
--- a/src/lib/evas/gesture/efl_canvas_gesture_manager.c
+++ b/src/lib/evas/gesture/efl_canvas_gesture_manager.c
@@ -39,60 +39,25 @@ static Efl_Canvas_Gesture *
39static const Efl_Event_Description * 39static const Efl_Event_Description *
40_gesture_recognizer_event_type_get(const Efl_Canvas_Gesture_Recognizer *recognizer) 40_gesture_recognizer_event_type_get(const Efl_Canvas_Gesture_Recognizer *recognizer)
41{ 41{
42 Efl_Canvas_Gesture_Recognizer_Type type = efl_gesture_recognizer_type_get(recognizer); 42 const Efl_Class *type = efl_gesture_recognizer_type_get(recognizer);
43 43
44 switch (type) 44 if (type == EFL_CANVAS_GESTURE_TAP_CLASS)
45 { 45 return EFL_EVENT_GESTURE_TAP;
46 case EFL_GESTURE_RECOGNIZER_TYPE_TAP: 46 if (type == EFL_CANVAS_GESTURE_DOUBLE_TAP_CLASS)
47 return EFL_EVENT_GESTURE_TAP; 47 return EFL_EVENT_GESTURE_DOUBLE_TAP;
48 case EFL_GESTURE_RECOGNIZER_TYPE_DOUBLE_TAP: 48 if (type == EFL_CANVAS_GESTURE_TRIPLE_TAP_CLASS)
49 return EFL_EVENT_GESTURE_DOUBLE_TAP; 49 return EFL_EVENT_GESTURE_TRIPLE_TAP;
50 case EFL_GESTURE_RECOGNIZER_TYPE_TRIPLE_TAP: 50 if (type == EFL_CANVAS_GESTURE_LONG_TAP_CLASS)
51 return EFL_EVENT_GESTURE_TRIPLE_TAP; 51 return EFL_EVENT_GESTURE_LONG_TAP;
52 case EFL_GESTURE_RECOGNIZER_TYPE_LONG_TAP: 52 if (type == EFL_CANVAS_GESTURE_MOMENTUM_CLASS)
53 return EFL_EVENT_GESTURE_LONG_TAP; 53 return EFL_EVENT_GESTURE_MOMENTUM;
54 case EFL_GESTURE_RECOGNIZER_TYPE_MOMENTUM: 54 if (type == EFL_CANVAS_GESTURE_FLICK_CLASS)
55 return EFL_EVENT_GESTURE_MOMENTUM; 55 return EFL_EVENT_GESTURE_FLICK;
56 case EFL_GESTURE_RECOGNIZER_TYPE_FLICK: 56 if (type == EFL_CANVAS_GESTURE_ZOOM_CLASS)
57 return EFL_EVENT_GESTURE_FLICK; 57 return EFL_EVENT_GESTURE_ZOOM;
58 case EFL_GESTURE_RECOGNIZER_TYPE_ZOOM: 58 return EFL_EVENT_GESTURE_CUSTOM;
59 return EFL_EVENT_GESTURE_ZOOM;
60 case EFL_GESTURE_RECOGNIZER_TYPE_CUSTOM:
61 return EFL_EVENT_GESTURE_CUSTOM;
62 default: break;
63 }
64 return NULL;
65}
66
67static const Efl_Class *
68_gesture_recognizer_class_type_get(const Efl_Canvas_Gesture_Recognizer *recognizer)
69{
70 Efl_Canvas_Gesture_Recognizer_Type type = efl_gesture_recognizer_type_get(recognizer);
71
72 switch (type)
73 {
74 case EFL_GESTURE_RECOGNIZER_TYPE_TAP:
75 return EFL_CANVAS_GESTURE_TAP_CLASS;
76 case EFL_GESTURE_RECOGNIZER_TYPE_DOUBLE_TAP:
77 return EFL_CANVAS_GESTURE_DOUBLE_TAP_CLASS;
78 case EFL_GESTURE_RECOGNIZER_TYPE_TRIPLE_TAP:
79 return EFL_CANVAS_GESTURE_TRIPLE_TAP_CLASS;
80 case EFL_GESTURE_RECOGNIZER_TYPE_LONG_TAP:
81 return EFL_CANVAS_GESTURE_LONG_TAP_CLASS;
82 case EFL_GESTURE_RECOGNIZER_TYPE_MOMENTUM:
83 return EFL_CANVAS_GESTURE_MOMENTUM_CLASS;
84 case EFL_GESTURE_RECOGNIZER_TYPE_FLICK:
85 return EFL_CANVAS_GESTURE_FLICK_CLASS;
86 case EFL_GESTURE_RECOGNIZER_TYPE_ZOOM:
87 return EFL_CANVAS_GESTURE_ZOOM_CLASS;
88 case EFL_GESTURE_RECOGNIZER_TYPE_CUSTOM:
89 return EFL_CANVAS_GESTURE_CUSTOM_CLASS;
90 default: break;
91 }
92 return NULL;
93} 59}
94 60
95
96static void 61static void
97_cleanup_object(Eina_Array *arr) 62_cleanup_object(Eina_Array *arr)
98{ 63{
@@ -503,7 +468,7 @@ _get_state(Efl_Canvas_Gesture_Manager_Data *pd,
503 } 468 }
504 } 469 }
505 470
506 gesture = efl_add(_gesture_recognizer_class_type_get(recognizer), recognizer); 471 gesture = efl_add(efl_gesture_recognizer_type_get(recognizer), recognizer);
507 if (!gesture) 472 if (!gesture)
508 return 0; 473 return 0;
509 474
diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer.eo b/src/lib/evas/gesture/efl_canvas_gesture_recognizer.eo
index c9801629ff..d03447f934 100644
--- a/src/lib/evas/gesture/efl_canvas_gesture_recognizer.eo
+++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer.eo
@@ -14,11 +14,11 @@ abstract @beta Efl.Canvas.Gesture_Recognizer extends Efl.Object
14 c_prefix: efl_gesture_recognizer; 14 c_prefix: efl_gesture_recognizer;
15 methods { 15 methods {
16 @property type @pure_virtual { 16 @property type @pure_virtual {
17 [[This property returns the type of gesture recognized by this recognizer. 17 [[This property returns the class type of gesture recognized by this recognizer.
18 It must be implemented for the recognizer to function.]] 18 It must be implemented for the recognizer to function.]]
19 get {} 19 get {}
20 values { 20 values {
21 type: Efl.Canvas.Gesture_Recognizer_Type; [[The gesture type to recognize.]] 21 type: const(Efl.Class); [[The gesture type to recognize.]]
22 } 22 }
23 } 23 }
24 recognize @pure_virtual { 24 recognize @pure_virtual {
diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_custom.c b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_custom.c
index 4dfe56944a..e91b195e3d 100644
--- a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_custom.c
+++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_custom.c
@@ -2,10 +2,10 @@
2 2
3#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_CUSTOM_CLASS 3#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_CUSTOM_CLASS
4 4
5EOLIAN static Efl_Canvas_Gesture_Recognizer_Type 5EOLIAN static const Efl_Class *
6_efl_canvas_gesture_recognizer_custom_efl_canvas_gesture_recognizer_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Recognizer_Custom_Data *pd EINA_UNUSED) 6_efl_canvas_gesture_recognizer_custom_efl_canvas_gesture_recognizer_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Recognizer_Custom_Data *pd EINA_UNUSED)
7{ 7{
8 return EFL_GESTURE_RECOGNIZER_TYPE_CUSTOM; 8 return EFL_CANVAS_GESTURE_CUSTOM_CLASS;
9} 9}
10 10
11EOLIAN static Eo * 11EOLIAN static Eo *
diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_double_tap.c b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_double_tap.c
index bf1791a549..c7b53110e2 100644
--- a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_double_tap.c
+++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_double_tap.c
@@ -4,10 +4,10 @@
4 4
5#define TAP_TIME_OUT 0.33 5#define TAP_TIME_OUT 0.33
6 6
7EOLIAN static Efl_Canvas_Gesture_Recognizer_Type 7EOLIAN static const Efl_Class *
8_efl_canvas_gesture_recognizer_double_tap_efl_canvas_gesture_recognizer_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Recognizer_Double_Tap_Data *pd EINA_UNUSED) 8_efl_canvas_gesture_recognizer_double_tap_efl_canvas_gesture_recognizer_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Recognizer_Double_Tap_Data *pd EINA_UNUSED)
9{ 9{
10 return EFL_GESTURE_RECOGNIZER_TYPE_DOUBLE_TAP; 10 return EFL_CANVAS_GESTURE_DOUBLE_TAP_CLASS;
11} 11}
12 12
13EOLIAN static void 13EOLIAN static void
diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_flick.c b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_flick.c
index 2c459482c2..6736e39a45 100644
--- a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_flick.c
+++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_flick.c
@@ -22,10 +22,10 @@ _reset_recognizer(Efl_Canvas_Gesture_Recognizer_Flick_Data *pd)
22 pd->touched = EINA_FALSE; 22 pd->touched = EINA_FALSE;
23} 23}
24 24
25EOLIAN static Efl_Canvas_Gesture_Recognizer_Type 25EOLIAN static const Efl_Class *
26_efl_canvas_gesture_recognizer_flick_efl_canvas_gesture_recognizer_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Recognizer_Flick_Data *pd EINA_UNUSED) 26_efl_canvas_gesture_recognizer_flick_efl_canvas_gesture_recognizer_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Recognizer_Flick_Data *pd EINA_UNUSED)
27{ 27{
28 return EFL_GESTURE_RECOGNIZER_TYPE_FLICK; 28 return EFL_CANVAS_GESTURE_FLICK_CLASS;
29} 29}
30 30
31static void 31static void
diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_tap.c b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_tap.c
index 3e2d3f3f96..5b173858fa 100644
--- a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_tap.c
+++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_tap.c
@@ -4,10 +4,10 @@
4 4
5#define EFL_GESTURE_LONG_TAP_TIME_OUT 1.2 5#define EFL_GESTURE_LONG_TAP_TIME_OUT 1.2
6 6
7EOLIAN static Efl_Canvas_Gesture_Recognizer_Type 7EOLIAN static const Efl_Class *
8_efl_canvas_gesture_recognizer_long_tap_efl_canvas_gesture_recognizer_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Recognizer_Long_Tap_Data *pd EINA_UNUSED) 8_efl_canvas_gesture_recognizer_long_tap_efl_canvas_gesture_recognizer_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Recognizer_Long_Tap_Data *pd EINA_UNUSED)
9{ 9{
10 return EFL_GESTURE_RECOGNIZER_TYPE_LONG_TAP; 10 return EFL_CANVAS_GESTURE_LONG_TAP_CLASS;
11} 11}
12 12
13EOLIAN static void 13EOLIAN static void
diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_momentum.c b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_momentum.c
index 90685d6400..0489147721 100644
--- a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_momentum.c
+++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_momentum.c
@@ -7,10 +7,10 @@
7#define THUMBSCROLL_MOMENTUM_THRESHOLD 100.0 7#define THUMBSCROLL_MOMENTUM_THRESHOLD 100.0
8#define EFL_GESTURE_MINIMUM_MOMENTUM 0.001 8#define EFL_GESTURE_MINIMUM_MOMENTUM 0.001
9 9
10EOLIAN static Efl_Canvas_Gesture_Recognizer_Type 10EOLIAN static const Efl_Class *
11_efl_canvas_gesture_recognizer_momentum_efl_canvas_gesture_recognizer_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Recognizer_Momentum_Data *pd EINA_UNUSED) 11_efl_canvas_gesture_recognizer_momentum_efl_canvas_gesture_recognizer_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Recognizer_Momentum_Data *pd EINA_UNUSED)
12{ 12{
13 return EFL_GESTURE_RECOGNIZER_TYPE_MOMENTUM; 13 return EFL_CANVAS_GESTURE_MOMENTUM_CLASS;
14} 14}
15 15
16static void 16static void
diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_tap.c b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_tap.c
index 4bbb00f8ce..eec8c34a22 100644
--- a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_tap.c
+++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_tap.c
@@ -6,10 +6,10 @@
6// may using dobule tap timeout value? 6// may using dobule tap timeout value?
7#define EFL_GESTURE_RECOGNIZER_TYPE_TAP_TIME_OUT 0.33 7#define EFL_GESTURE_RECOGNIZER_TYPE_TAP_TIME_OUT 0.33
8 8
9EOLIAN static Efl_Canvas_Gesture_Recognizer_Type 9EOLIAN static const Efl_Class *
10_efl_canvas_gesture_recognizer_tap_efl_canvas_gesture_recognizer_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Recognizer_Tap_Data *pd EINA_UNUSED) 10_efl_canvas_gesture_recognizer_tap_efl_canvas_gesture_recognizer_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Recognizer_Tap_Data *pd EINA_UNUSED)
11{ 11{
12 return EFL_GESTURE_RECOGNIZER_TYPE_TAP; 12 return EFL_CANVAS_GESTURE_TAP_CLASS;
13} 13}
14 14
15static Eina_Bool 15static Eina_Bool
diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_triple_tap.c b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_triple_tap.c
index 83d674a8ac..f79aff5f71 100644
--- a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_triple_tap.c
+++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_triple_tap.c
@@ -4,10 +4,10 @@
4 4
5#define TAP_TIME_OUT 0.33 5#define TAP_TIME_OUT 0.33
6 6
7EOLIAN static Efl_Canvas_Gesture_Recognizer_Type 7EOLIAN static const Efl_Class *
8_efl_canvas_gesture_recognizer_triple_tap_efl_canvas_gesture_recognizer_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Recognizer_Triple_Tap_Data *pd EINA_UNUSED) 8_efl_canvas_gesture_recognizer_triple_tap_efl_canvas_gesture_recognizer_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Recognizer_Triple_Tap_Data *pd EINA_UNUSED)
9{ 9{
10 return EFL_GESTURE_RECOGNIZER_TYPE_TRIPLE_TAP; 10 return EFL_CANVAS_GESTURE_TRIPLE_TAP_CLASS;
11} 11}
12 12
13EOLIAN static void 13EOLIAN static void
diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_zoom.c b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_zoom.c
index b91811c7d3..3dd6070ae4 100644
--- a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_zoom.c
+++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_zoom.c
@@ -125,10 +125,10 @@ _zoom_compute(Efl_Canvas_Gesture_Recognizer_Zoom_Data *pd,
125 return rt; 125 return rt;
126} 126}
127 127
128EOLIAN static Efl_Canvas_Gesture_Recognizer_Type 128EOLIAN static const Efl_Class *
129_efl_canvas_gesture_recognizer_zoom_efl_canvas_gesture_recognizer_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Recognizer_Zoom_Data *pd EINA_UNUSED) 129_efl_canvas_gesture_recognizer_zoom_efl_canvas_gesture_recognizer_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Recognizer_Zoom_Data *pd EINA_UNUSED)
130{ 130{
131 return EFL_GESTURE_RECOGNIZER_TYPE_ZOOM; 131 return EFL_CANVAS_GESTURE_ZOOM_CLASS;
132} 132}
133 133
134EOLIAN static Efl_Canvas_Gesture_Recognizer_Result 134EOLIAN static Efl_Canvas_Gesture_Recognizer_Result