summaryrefslogtreecommitdiff
path: root/src/lib/evas
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2020-01-29 14:09:16 -0500
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-02-14 09:20:18 +0100
commit0f2a61b5f280f11ba661996482a509f370d7e5e1 (patch)
tree661d50e81c9e584a81b257042e444f8b7b190b3e /src/lib/evas
parent6307fc056a25ae70655004d3f1d7c3d9106624ba (diff)
efl/gesture: move manager's recognizer cleanup function to eo
this is needed by recognizers which use timers in order to do timeouts on gestures Reviewed-by: Xavi Artigas <xavierartigas@yahoo.es> Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D11245
Diffstat (limited to 'src/lib/evas')
-rw-r--r--src/lib/evas/gesture/efl_canvas_gesture_manager.c18
-rw-r--r--src/lib/evas/gesture/efl_canvas_gesture_manager.eo7
-rw-r--r--src/lib/evas/gesture/efl_canvas_gesture_private.h1
-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.c2
-rw-r--r--src/lib/evas/gesture/efl_canvas_gesture_recognizer_triple_tap.c2
-rw-r--r--src/lib/evas/gesture/efl_canvas_gesture_recognizer_zoom.c2
7 files changed, 25 insertions, 11 deletions
diff --git a/src/lib/evas/gesture/efl_canvas_gesture_manager.c b/src/lib/evas/gesture/efl_canvas_gesture_manager.c
index 1376191a92..38dfbe667b 100644
--- a/src/lib/evas/gesture/efl_canvas_gesture_manager.c
+++ b/src/lib/evas/gesture/efl_canvas_gesture_manager.c
@@ -32,7 +32,7 @@ typedef struct _Efl_Canvas_Gesture_Manager_Data
32} Efl_Canvas_Gesture_Manager_Data; 32} Efl_Canvas_Gesture_Manager_Data;
33 33
34static void _cleanup_cached_gestures(Efl_Canvas_Gesture_Manager_Data *pd, 34static void _cleanup_cached_gestures(Efl_Canvas_Gesture_Manager_Data *pd,
35 Eo *target, const Efl_Event_Description *type, Efl_Canvas_Gesture_Recognizer *recognizer); 35 const Eo *target, const Efl_Event_Description *type, const Efl_Canvas_Gesture_Recognizer *recognizer);
36static Efl_Canvas_Gesture * 36static Efl_Canvas_Gesture *
37 _get_state(Efl_Canvas_Gesture_Manager_Data *pd, Eo *target, 37 _get_state(Efl_Canvas_Gesture_Manager_Data *pd, Eo *target,
38 Efl_Canvas_Gesture_Recognizer *recognizer, const Efl_Event_Description *type); 38 Efl_Canvas_Gesture_Recognizer *recognizer, const Efl_Event_Description *type);
@@ -486,7 +486,7 @@ _get_state(Efl_Canvas_Gesture_Manager_Data *pd,
486 486
487static void 487static void
488_cleanup_cached_gestures(Efl_Canvas_Gesture_Manager_Data *pd, 488_cleanup_cached_gestures(Efl_Canvas_Gesture_Manager_Data *pd,
489 Eo *target, const Efl_Event_Description *type, Efl_Canvas_Gesture_Recognizer *recognizer) 489 const Eo *target, const Efl_Event_Description *type, const Efl_Canvas_Gesture_Recognizer *recognizer)
490{ 490{
491 Eina_List *l, *l_next; 491 Eina_List *l, *l_next;
492 Object_Gesture *object_gesture; 492 Object_Gesture *object_gesture;
@@ -503,12 +503,20 @@ _cleanup_cached_gestures(Efl_Canvas_Gesture_Manager_Data *pd,
503 } 503 }
504} 504}
505 505
506void 506EOLIAN static void
507efl_gesture_manager_gesture_clean_up(Eo *obj, Eo *target, const Efl_Event_Description *type, Efl_Canvas_Gesture_Recognizer *recognizer) 507_efl_canvas_gesture_manager_recognizer_cleanup(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Manager_Data *pd, const Efl_Canvas_Gesture_Recognizer *recognizer, const Eo *target)
508{ 508{
509 Efl_Canvas_Gesture_Manager_Data *pd = efl_data_scope_get(obj, MY_CLASS); 509 const Efl_Event_Description *type;
510 Efl_Canvas_Gesture *dummy;
510 511
511 EINA_SAFETY_ON_NULL_RETURN(recognizer); 512 EINA_SAFETY_ON_NULL_RETURN(recognizer);
513
514 //Find the type of the recognizer
515 dummy = efl_gesture_recognizer_add((void*)recognizer, 0);
516 EINA_SAFETY_ON_NULL_RETURN(dummy);
517
518 type = _efl_gesture_type_get(dummy);
519 efl_del(dummy);
512 _cleanup_cached_gestures(pd, target, type, recognizer); 520 _cleanup_cached_gestures(pd, target, type, recognizer);
513 eina_hash_del(pd->m_object_events, &recognizer, NULL); 521 eina_hash_del(pd->m_object_events, &recognizer, NULL);
514 _cleanup_object(pd->m_gestures_to_delete); 522 _cleanup_object(pd->m_gestures_to_delete);
diff --git a/src/lib/evas/gesture/efl_canvas_gesture_manager.eo b/src/lib/evas/gesture/efl_canvas_gesture_manager.eo
index 8d8d43b4df..eaf27300ba 100644
--- a/src/lib/evas/gesture/efl_canvas_gesture_manager.eo
+++ b/src/lib/evas/gesture/efl_canvas_gesture_manager.eo
@@ -35,6 +35,13 @@ class @beta Efl.Canvas.Gesture_Manager extends Efl.Object
35 value: any_value_ref; [[Value of the property.]] 35 value: any_value_ref; [[Value of the property.]]
36 } 36 }
37 } 37 }
38 recognizer_cleanup {
39 [[Perform cleanup for a gesture which ends after a delay.]]
40 params {
41 @in recognizer: const(Efl.Canvas.Gesture_Recognizer); [[The gesture recognizer object.]]
42 @in target: const(Efl.Canvas.Object); [[The target object being processed by the recognizer.]]
43 }
44 }
38 } 45 }
39 events { 46 events {
40 config,changed: string; [[Called when a config value has been changed for the manager object. Passed string is the name of the value.]] 47 config,changed: string; [[Called when a config value has been changed for the manager object. Passed string is the name of the value.]]
diff --git a/src/lib/evas/gesture/efl_canvas_gesture_private.h b/src/lib/evas/gesture/efl_canvas_gesture_private.h
index dadf5c0123..59255fb39e 100644
--- a/src/lib/evas/gesture/efl_canvas_gesture_private.h
+++ b/src/lib/evas/gesture/efl_canvas_gesture_private.h
@@ -12,7 +12,6 @@
12#define TAP_TOUCH_TIME_THRESHOLD (0.1 * 1000) 12#define TAP_TOUCH_TIME_THRESHOLD (0.1 * 1000)
13 13
14const Efl_Event_Description * _efl_gesture_type_get(const Eo *obj); 14const Efl_Event_Description * _efl_gesture_type_get(const Eo *obj);
15void efl_gesture_manager_gesture_clean_up(Eo *obj, Eo *target, const Efl_Event_Description *type, Efl_Canvas_Gesture_Recognizer *recognizer);
16int _direction_get(Evas_Coord xx1, Evas_Coord xx2); 15int _direction_get(Evas_Coord xx1, Evas_Coord xx2);
17Eina_Value *_recognizer_config_get(const Eo *obj, const char *name); 16Eina_Value *_recognizer_config_get(const Eo *obj, const char *name);
18 17
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 1db46da7c3..886d17f790 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
@@ -30,8 +30,8 @@ _tap_timeout_cb(void *data)
30 efl_gesture_state_set(pd->gesture, EFL_GESTURE_STATE_CANCELED); 30 efl_gesture_state_set(pd->gesture, EFL_GESTURE_STATE_CANCELED);
31 efl_event_callback_call(pd->target, EFL_EVENT_GESTURE_DOUBLE_TAP, pd->gesture); 31 efl_event_callback_call(pd->target, EFL_EVENT_GESTURE_DOUBLE_TAP, pd->gesture);
32 32
33 efl_gesture_manager_gesture_clean_up(efl_provider_find(data, EFL_CANVAS_GESTURE_MANAGER_CLASS), 33 efl_gesture_manager_recognizer_cleanup(efl_provider_find(data, EFL_CANVAS_GESTURE_MANAGER_CLASS), data,
34 pd->target, EFL_EVENT_GESTURE_DOUBLE_TAP, data); 34 pd->target);
35 35
36 pd->timeout = NULL; 36 pd->timeout = NULL;
37 pd->tap_count = 0; 37 pd->tap_count = 0;
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 de45dd762a..ebaf042f0a 100644
--- a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_flick.c
+++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_flick.c
@@ -212,7 +212,7 @@ _efl_canvas_gesture_recognizer_flick_efl_canvas_gesture_recognizer_recognize(Eo
212 //This is to handle a case with a mouse click on the target object. 212 //This is to handle a case with a mouse click on the target object.
213 if (efl_gesture_touch_state_get(event) == EFL_GESTURE_TOUCH_STATE_END && !pd->touched) 213 if (efl_gesture_touch_state_get(event) == EFL_GESTURE_TOUCH_STATE_END && !pd->touched)
214 { 214 {
215 efl_gesture_manager_gesture_clean_up(efl_provider_find(obj, EFL_CANVAS_GESTURE_MANAGER_CLASS), watched, EFL_EVENT_GESTURE_FLICK, obj); 215 efl_gesture_manager_recognizer_cleanup(efl_provider_find(obj, EFL_CANVAS_GESTURE_MANAGER_CLASS), obj, watched);
216 dead = EINA_TRUE; 216 dead = EINA_TRUE;
217 } 217 }
218 218
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 3144aa30d1..6d4d54962f 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
@@ -30,7 +30,7 @@ _tap_timeout_cb(void *data)
30 efl_gesture_state_set(pd->gesture, EFL_GESTURE_STATE_CANCELED); 30 efl_gesture_state_set(pd->gesture, EFL_GESTURE_STATE_CANCELED);
31 efl_event_callback_call(pd->target, EFL_EVENT_GESTURE_TRIPLE_TAP, pd->gesture); 31 efl_event_callback_call(pd->target, EFL_EVENT_GESTURE_TRIPLE_TAP, pd->gesture);
32 32
33 efl_gesture_manager_gesture_clean_up(efl_provider_find(data, EFL_CANVAS_GESTURE_MANAGER_CLASS), pd->target, EFL_EVENT_GESTURE_TRIPLE_TAP, data); 33 efl_gesture_manager_recognizer_cleanup(efl_provider_find(data, EFL_CANVAS_GESTURE_MANAGER_CLASS), data, pd->target);
34 34
35 pd->timeout = NULL; 35 pd->timeout = NULL;
36 pd->tap_count = 0; 36 pd->tap_count = 0;
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 40e638a5df..9190302d47 100644
--- a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_zoom.c
+++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_zoom.c
@@ -267,7 +267,7 @@ _efl_canvas_gesture_recognizer_zoom_efl_canvas_gesture_recognizer_recognize(Eo *
267 rd->continues = EINA_FALSE; 267 rd->continues = EINA_FALSE;
268 268
269 _reset_recognizer(pd); 269 _reset_recognizer(pd);
270 efl_gesture_manager_gesture_clean_up(efl_provider_find(obj, EFL_CANVAS_GESTURE_MANAGER_CLASS), watched, EFL_EVENT_GESTURE_ZOOM, obj); 270 efl_gesture_manager_recognizer_cleanup(efl_provider_find(obj, EFL_CANVAS_GESTURE_MANAGER_CLASS), obj, watched);
271 271
272 return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE; 272 return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE;
273 } 273 }