diff options
author | Mike Blumenkrantz <zmike@samsung.com> | 2020-01-29 14:09:16 -0500 |
---|---|---|
committer | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2020-02-14 09:20:18 +0100 |
commit | 0f2a61b5f280f11ba661996482a509f370d7e5e1 (patch) | |
tree | 661d50e81c9e584a81b257042e444f8b7b190b3e | |
parent | 6307fc056a25ae70655004d3f1d7c3d9106624ba (diff) | |
download | efl-0f2a61b5f280f11ba661996482a509f370d7e5e1.tar.gz |
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
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 } Efl_Canvas_Gesture_Manager_Data; static void _cleanup_cached_gestures(Efl_Canvas_Gesture_Manager_Data *pd, - Eo *target, const Efl_Event_Description *type, Efl_Canvas_Gesture_Recognizer *recognizer); + const Eo *target, const Efl_Event_Description *type, const Efl_Canvas_Gesture_Recognizer *recognizer); static Efl_Canvas_Gesture * _get_state(Efl_Canvas_Gesture_Manager_Data *pd, Eo *target, Efl_Canvas_Gesture_Recognizer *recognizer, const Efl_Event_Description *type); @@ -486,7 +486,7 @@ _get_state(Efl_Canvas_Gesture_Manager_Data *pd, static void _cleanup_cached_gestures(Efl_Canvas_Gesture_Manager_Data *pd, - Eo *target, const Efl_Event_Description *type, Efl_Canvas_Gesture_Recognizer *recognizer) + const Eo *target, const Efl_Event_Description *type, const Efl_Canvas_Gesture_Recognizer *recognizer) { Eina_List *l, *l_next; Object_Gesture *object_gesture; @@ -503,12 +503,20 @@ _cleanup_cached_gestures(Efl_Canvas_Gesture_Manager_Data *pd, } } -void -efl_gesture_manager_gesture_clean_up(Eo *obj, Eo *target, const Efl_Event_Description *type, Efl_Canvas_Gesture_Recognizer *recognizer) +EOLIAN static void +_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) { - Efl_Canvas_Gesture_Manager_Data *pd = efl_data_scope_get(obj, MY_CLASS); + const Efl_Event_Description *type; + Efl_Canvas_Gesture *dummy; EINA_SAFETY_ON_NULL_RETURN(recognizer); + + //Find the type of the recognizer + dummy = efl_gesture_recognizer_add((void*)recognizer, 0); + EINA_SAFETY_ON_NULL_RETURN(dummy); + + type = _efl_gesture_type_get(dummy); + efl_del(dummy); _cleanup_cached_gestures(pd, target, type, recognizer); eina_hash_del(pd->m_object_events, &recognizer, NULL); _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 value: any_value_ref; [[Value of the property.]] } } + recognizer_cleanup { + [[Perform cleanup for a gesture which ends after a delay.]] + params { + @in recognizer: const(Efl.Canvas.Gesture_Recognizer); [[The gesture recognizer object.]] + @in target: const(Efl.Canvas.Object); [[The target object being processed by the recognizer.]] + } + } } events { 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 @@ #define TAP_TOUCH_TIME_THRESHOLD (0.1 * 1000) const Efl_Event_Description * _efl_gesture_type_get(const Eo *obj); -void efl_gesture_manager_gesture_clean_up(Eo *obj, Eo *target, const Efl_Event_Description *type, Efl_Canvas_Gesture_Recognizer *recognizer); int _direction_get(Evas_Coord xx1, Evas_Coord xx2); Eina_Value *_recognizer_config_get(const Eo *obj, const char *name); 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) efl_gesture_state_set(pd->gesture, EFL_GESTURE_STATE_CANCELED); efl_event_callback_call(pd->target, EFL_EVENT_GESTURE_DOUBLE_TAP, pd->gesture); - efl_gesture_manager_gesture_clean_up(efl_provider_find(data, EFL_CANVAS_GESTURE_MANAGER_CLASS), - pd->target, EFL_EVENT_GESTURE_DOUBLE_TAP, data); + efl_gesture_manager_recognizer_cleanup(efl_provider_find(data, EFL_CANVAS_GESTURE_MANAGER_CLASS), data, + pd->target); pd->timeout = NULL; 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 //This is to handle a case with a mouse click on the target object. if (efl_gesture_touch_state_get(event) == EFL_GESTURE_TOUCH_STATE_END && !pd->touched) { - efl_gesture_manager_gesture_clean_up(efl_provider_find(obj, EFL_CANVAS_GESTURE_MANAGER_CLASS), watched, EFL_EVENT_GESTURE_FLICK, obj); + efl_gesture_manager_recognizer_cleanup(efl_provider_find(obj, EFL_CANVAS_GESTURE_MANAGER_CLASS), obj, watched); dead = EINA_TRUE; } 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) efl_gesture_state_set(pd->gesture, EFL_GESTURE_STATE_CANCELED); efl_event_callback_call(pd->target, EFL_EVENT_GESTURE_TRIPLE_TAP, pd->gesture); - efl_gesture_manager_gesture_clean_up(efl_provider_find(data, EFL_CANVAS_GESTURE_MANAGER_CLASS), pd->target, EFL_EVENT_GESTURE_TRIPLE_TAP, data); + efl_gesture_manager_recognizer_cleanup(efl_provider_find(data, EFL_CANVAS_GESTURE_MANAGER_CLASS), data, pd->target); pd->timeout = NULL; 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 * rd->continues = EINA_FALSE; _reset_recognizer(pd); - efl_gesture_manager_gesture_clean_up(efl_provider_find(obj, EFL_CANVAS_GESTURE_MANAGER_CLASS), watched, EFL_EVENT_GESTURE_ZOOM, obj); + efl_gesture_manager_recognizer_cleanup(efl_provider_find(obj, EFL_CANVAS_GESTURE_MANAGER_CLASS), obj, watched); return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE; } |