From d481cbe83c3c57883d32fc96ff3121f07025ab84 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 14 Feb 2020 08:50:13 -0500 Subject: [PATCH 01/27] tests/gesture: add custom gesture to custom recognizer test this adds a simple custom gesture implementation with basic motion accumulator properties to verify (and give an example of) the custom gesture capability that can be used by apps alongside custom recognizers Differential Revision: https://phab.enlightenment.org/D11352 --- src/tests/elementary/custom_gesture.c | 19 ++++++++++++++++ src/tests/elementary/custom_gesture.eo | 26 ++++++++++++++++++++++ src/tests/elementary/custom_gesture.h | 16 +++++++++++++ src/tests/elementary/custom_recognizer.c | 20 ++++++++++++++++- src/tests/elementary/custom_recognizer.eo | 1 + src/tests/elementary/efl_ui_test_gesture.c | 22 ++++++++++++++++++ src/tests/elementary/meson.build | 2 ++ 7 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 src/tests/elementary/custom_gesture.c create mode 100644 src/tests/elementary/custom_gesture.eo create mode 100644 src/tests/elementary/custom_gesture.h diff --git a/src/tests/elementary/custom_gesture.c b/src/tests/elementary/custom_gesture.c new file mode 100644 index 0000000000..629f68bcd5 --- /dev/null +++ b/src/tests/elementary/custom_gesture.c @@ -0,0 +1,19 @@ +#include +#include "custom_gesture.eo.h" +#include "custom_gesture.h" +#define MY_CLASS CUSTOM_GESTURE_CLASS + + +EOLIAN static int +_custom_gesture_x_delta_get(const Eo *obj EINA_UNUSED, Custom_Gesture_Data *pd) +{ + return pd->x_delta; +} + +EOLIAN static int +_custom_gesture_y_delta_get(const Eo *obj EINA_UNUSED, Custom_Gesture_Data *pd) +{ + return pd->y_delta; +} + +#include "custom_gesture.eo.c" diff --git a/src/tests/elementary/custom_gesture.eo b/src/tests/elementary/custom_gesture.eo new file mode 100644 index 0000000000..7a6266db93 --- /dev/null +++ b/src/tests/elementary/custom_gesture.eo @@ -0,0 +1,26 @@ +import eina_types; +parse efl_canvas_gesture_recognizer; + +class @beta Custom_Gesture extends Efl.Canvas.Gesture_Custom +{ + [[This is a test class for custom gesture implementations. + ]] + methods { + @property x_delta { + [[This is the total change in the X coordinate.]] + get { + } + values { + val: int; [[The change since the start of the gesture.]] + } + } + @property y_delta { + [[This is the total change in the Y coordinate.]] + get { + } + values { + val: int; [[The change since the start of the gesture.]] + } + } + } +} diff --git a/src/tests/elementary/custom_gesture.h b/src/tests/elementary/custom_gesture.h new file mode 100644 index 0000000000..fa12b68593 --- /dev/null +++ b/src/tests/elementary/custom_gesture.h @@ -0,0 +1,16 @@ +#ifndef CUSTOM_GESTURE_H +# define CUSTOM_GESTURE_H + + +typedef struct Custom_Gesture_Data +{ + int x_delta; + int y_delta; +} Custom_Gesture_Data; + + + + + + +#endif diff --git a/src/tests/elementary/custom_recognizer.c b/src/tests/elementary/custom_recognizer.c index 5e4c89c791..4797b9530e 100644 --- a/src/tests/elementary/custom_recognizer.c +++ b/src/tests/elementary/custom_recognizer.c @@ -1,5 +1,8 @@ #include #include "custom_recognizer.eo.h" +#include "custom_gesture.eo.h" +#include "custom_gesture.h" + #define MY_CLASS CUSTOM_RECOGNIZER_CLASS typedef struct Custom_Recognizer_Data @@ -7,6 +10,12 @@ typedef struct Custom_Recognizer_Data } Custom_Recognizer_Data; +EOLIAN static const Efl_Class * +_custom_recognizer_efl_canvas_gesture_recognizer_type_get(const Eo *obj EINA_UNUSED, Custom_Recognizer_Data *pd EINA_UNUSED) +{ + return CUSTOM_GESTURE_CLASS; +} + EOLIAN static Eo * _custom_recognizer_efl_object_finalize(Eo *obj, Custom_Recognizer_Data *pd EINA_UNUSED) { @@ -16,14 +25,23 @@ _custom_recognizer_efl_object_finalize(Eo *obj, Custom_Recognizer_Data *pd EINA_ EOLIAN static Efl_Canvas_Gesture_Recognizer_Result _custom_recognizer_efl_canvas_gesture_recognizer_recognize(Eo *obj EINA_UNUSED, Custom_Recognizer_Data *pd EINA_UNUSED, - Efl_Canvas_Gesture *gesture EINA_UNUSED, Efl_Object *watched EINA_UNUSED, + Efl_Canvas_Gesture *gesture, Efl_Object *watched EINA_UNUSED, Efl_Canvas_Gesture_Touch *event) { + const Efl_Gesture_Touch_Point_Data *data = efl_gesture_touch_current_data_get(event); + Custom_Gesture_Data *gd; + + /* ignore multi-touch */ + if (data->id) return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE; + switch (efl_gesture_touch_state_get(event)) { case EFL_GESTURE_TOUCH_STATE_BEGIN: return EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER; case EFL_GESTURE_TOUCH_STATE_UPDATE: + gd = efl_data_scope_get(gesture, CUSTOM_GESTURE_CLASS); + gd->x_delta += data->cur.pos.x - data->prev.pos.x; + gd->y_delta += data->cur.pos.y - data->prev.pos.y; return EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER; case EFL_GESTURE_TOUCH_STATE_END: return EFL_GESTURE_RECOGNIZER_RESULT_FINISH; diff --git a/src/tests/elementary/custom_recognizer.eo b/src/tests/elementary/custom_recognizer.eo index 7c6ab18d41..bbe4c0cfc6 100644 --- a/src/tests/elementary/custom_recognizer.eo +++ b/src/tests/elementary/custom_recognizer.eo @@ -6,5 +6,6 @@ class @beta Custom_Recognizer extends Efl.Canvas.Gesture_Recognizer_Custom implements { Efl.Object.finalize; Efl.Canvas.Gesture_Recognizer.recognize; + Efl.Canvas.Gesture_Recognizer.type { get; } } } diff --git a/src/tests/elementary/efl_ui_test_gesture.c b/src/tests/elementary/efl_ui_test_gesture.c index f47e4f3977..0f7d270853 100644 --- a/src/tests/elementary/efl_ui_test_gesture.c +++ b/src/tests/elementary/efl_ui_test_gesture.c @@ -8,6 +8,7 @@ #include #include +#include "custom_gesture.eo.h" #include "custom_recognizer.eo.h" #include "custom_recognizer2.eo.h" @@ -549,12 +550,24 @@ custom_cb2(void *data EINA_UNUSED , const Efl_Event *ev) count[efl_gesture_state_get(g) - 1]++; } +static void +custom_gesture_cb(void *data EINA_UNUSED , const Efl_Event *ev) +{ + Efl_Canvas_Gesture *g = ev->info; + + Eina_Position2D *delta = data; + if (!eina_streq(efl_gesture_custom_gesture_name_get(g), "custom_gesture")) return; + delta->x = custom_gesture_x_delta_get(g); + delta->y = custom_gesture_y_delta_get(g); +} + EFL_START_TEST(test_efl_ui_gesture_custom) { Eo *rect = setup(); Eo *manager = efl_provider_find(rect, EFL_CANVAS_GESTURE_MANAGER_CLASS); Eo *recognizer = efl_add(CUSTOM_RECOGNIZER_CLASS, manager); Eo *recognizer2 = efl_add(CUSTOM_RECOGNIZER2_CLASS, manager); + Eina_Position2D delta = {0}; efl_gesture_manager_recognizer_register(manager, recognizer); efl_gesture_manager_recognizer_register(manager, recognizer2); @@ -568,6 +581,15 @@ EFL_START_TEST(test_efl_ui_gesture_custom) RESET; + /* verify gesture properties */ + efl_event_callback_add(rect, EFL_EVENT_GESTURE_CUSTOM, custom_gesture_cb, &delta); + drag_object(rect, 0, 0, 75, 30, EINA_FALSE); + ck_assert_int_eq(delta.x, 75); + ck_assert_int_eq(delta.y, 30); + efl_event_callback_del(rect, EFL_EVENT_GESTURE_CUSTOM, custom_gesture_cb, &delta); + + RESET; + /* verify that we aren't still processing */ efl_gesture_manager_recognizer_unregister(manager, recognizer); efl_gesture_manager_recognizer_unregister(manager, recognizer2); diff --git a/src/tests/elementary/meson.build b/src/tests/elementary/meson.build index 10534277b4..7f5fd03733 100644 --- a/src/tests/elementary/meson.build +++ b/src/tests/elementary/meson.build @@ -1,4 +1,5 @@ priv_eo_files = [ + 'custom_gesture.eo', 'custom_recognizer.eo', 'custom_recognizer2.eo', 'focus_test.eo', @@ -164,6 +165,7 @@ efl_ui_suite_src = [ 'efl_ui_test_group_item.c', 'efl_ui_test_text.c', 'efl_ui_test_vg_animation.c', + 'custom_gesture.c', 'custom_recognizer.c', 'custom_recognizer2.c', ] From 25d96317c063c4b12f7f3fc78a1eb6225b4890fc Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 14 Feb 2020 09:36:53 -0500 Subject: [PATCH 02/27] efl/gesture: remove 'type' member from Efl_Canvas_Gesture_Data this is no longer used Reviewed-by: Xavi Artigas Differential Revision: https://phab.enlightenment.org/D11353 --- src/lib/evas/gesture/efl_canvas_gesture.c | 8 -------- src/lib/evas/gesture/efl_canvas_gesture_custom.c | 1 - src/lib/evas/gesture/efl_canvas_gesture_double_tap.c | 1 - src/lib/evas/gesture/efl_canvas_gesture_flick.c | 1 - src/lib/evas/gesture/efl_canvas_gesture_long_tap.c | 1 - src/lib/evas/gesture/efl_canvas_gesture_momentum.c | 1 - src/lib/evas/gesture/efl_canvas_gesture_private.h | 2 -- src/lib/evas/gesture/efl_canvas_gesture_tap.c | 1 - src/lib/evas/gesture/efl_canvas_gesture_triple_tap.c | 1 - src/lib/evas/gesture/efl_canvas_gesture_zoom.c | 1 - 10 files changed, 18 deletions(-) diff --git a/src/lib/evas/gesture/efl_canvas_gesture.c b/src/lib/evas/gesture/efl_canvas_gesture.c index 231bc865a0..e1fbe7824c 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture.c +++ b/src/lib/evas/gesture/efl_canvas_gesture.c @@ -3,14 +3,6 @@ #define MY_CLASS EFL_CANVAS_GESTURE_CLASS -const Efl_Event_Description * -_efl_gesture_type_get(const Eo *obj) -{ - Efl_Canvas_Gesture_Data *pd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_CLASS); - - return pd->type; -} - EOLIAN static Efl_Canvas_Gesture_State _efl_canvas_gesture_state_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Data *pd) { diff --git a/src/lib/evas/gesture/efl_canvas_gesture_custom.c b/src/lib/evas/gesture/efl_canvas_gesture_custom.c index 105558b57e..15fe0fe898 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_custom.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_custom.c @@ -19,7 +19,6 @@ _efl_canvas_gesture_custom_efl_object_constructor(Eo *obj, Efl_Canvas_Gesture_Cu obj = efl_constructor(efl_super(obj, MY_CLASS)); gd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_CLASS); - gd->type = EFL_EVENT_GESTURE_CUSTOM; return obj; } diff --git a/src/lib/evas/gesture/efl_canvas_gesture_double_tap.c b/src/lib/evas/gesture/efl_canvas_gesture_double_tap.c index 971d49e3b6..d29e61a4a2 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_double_tap.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_double_tap.c @@ -10,7 +10,6 @@ _efl_canvas_gesture_double_tap_efl_object_constructor(Eo *obj, void *pd EINA_UNU obj = efl_constructor(efl_super(obj, MY_CLASS)); gd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_CLASS); - gd->type = EFL_EVENT_GESTURE_DOUBLE_TAP; return obj; } diff --git a/src/lib/evas/gesture/efl_canvas_gesture_flick.c b/src/lib/evas/gesture/efl_canvas_gesture_flick.c index faa8e3812f..47364b1423 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_flick.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_flick.c @@ -10,7 +10,6 @@ _efl_canvas_gesture_flick_efl_object_constructor(Eo *obj, Efl_Canvas_Gesture_Fli obj = efl_constructor(efl_super(obj, MY_CLASS)); gd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_CLASS); - gd->type = EFL_EVENT_GESTURE_FLICK; return obj; } diff --git a/src/lib/evas/gesture/efl_canvas_gesture_long_tap.c b/src/lib/evas/gesture/efl_canvas_gesture_long_tap.c index 21f0055414..9ab6ff09c8 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_long_tap.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_long_tap.c @@ -9,7 +9,6 @@ _efl_canvas_gesture_long_tap_efl_object_constructor(Eo *obj, void *pd EINA_UNUSE obj = efl_constructor(efl_super(obj, MY_CLASS)); gd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_CLASS); - gd->type = EFL_EVENT_GESTURE_LONG_TAP; return obj; } diff --git a/src/lib/evas/gesture/efl_canvas_gesture_momentum.c b/src/lib/evas/gesture/efl_canvas_gesture_momentum.c index 91d2ca8f1d..4d00d0b580 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_momentum.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_momentum.c @@ -10,7 +10,6 @@ _efl_canvas_gesture_momentum_efl_object_constructor(Eo *obj, Efl_Canvas_Gesture_ obj = efl_constructor(efl_super(obj, MY_CLASS)); gd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_CLASS); - gd->type = EFL_EVENT_GESTURE_MOMENTUM; return obj; } diff --git a/src/lib/evas/gesture/efl_canvas_gesture_private.h b/src/lib/evas/gesture/efl_canvas_gesture_private.h index e7627d336d..3ef595c3c8 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_private.h +++ b/src/lib/evas/gesture/efl_canvas_gesture_private.h @@ -11,7 +11,6 @@ /* milliseconds */ #define TAP_TOUCH_TIME_THRESHOLD (0.1 * 1000) -const Efl_Event_Description * _efl_gesture_type_get(const Eo *obj); int _direction_get(Evas_Coord xx1, Evas_Coord xx2); Eina_Value *_recognizer_config_get(const Eo *obj, const char *name); Eina_Bool _event_multi_touch_get(const Efl_Canvas_Gesture_Touch *event); @@ -139,7 +138,6 @@ struct _Efl_Canvas_Gesture_Recognizer_Custom_Data struct _Efl_Canvas_Gesture_Data { Efl_Canvas_Gesture_State state; - const Efl_Event_Description *type; Eina_Position2D hotspot; unsigned int timestamp; unsigned int touch_count; diff --git a/src/lib/evas/gesture/efl_canvas_gesture_tap.c b/src/lib/evas/gesture/efl_canvas_gesture_tap.c index d777bebba1..a93dab95c1 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_tap.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_tap.c @@ -10,7 +10,6 @@ _efl_canvas_gesture_tap_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED) obj = efl_constructor(efl_super(obj, MY_CLASS)); gd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_CLASS); - gd->type = EFL_EVENT_GESTURE_TAP; return obj; } diff --git a/src/lib/evas/gesture/efl_canvas_gesture_triple_tap.c b/src/lib/evas/gesture/efl_canvas_gesture_triple_tap.c index 5a6bb2f126..d27dcec988 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_triple_tap.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_triple_tap.c @@ -10,7 +10,6 @@ _efl_canvas_gesture_triple_tap_efl_object_constructor(Eo *obj, void *pd EINA_UNU obj = efl_constructor(efl_super(obj, MY_CLASS)); gd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_CLASS); - gd->type = EFL_EVENT_GESTURE_TRIPLE_TAP; return obj; } diff --git a/src/lib/evas/gesture/efl_canvas_gesture_zoom.c b/src/lib/evas/gesture/efl_canvas_gesture_zoom.c index 9ea7533aeb..d8f73ba92a 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_zoom.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_zoom.c @@ -9,7 +9,6 @@ _efl_canvas_gesture_zoom_efl_object_constructor(Eo *obj, Efl_Canvas_Gesture_Zoom obj = efl_constructor(efl_super(obj, MY_CLASS)); gd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_CLASS); - gd->type = EFL_EVENT_GESTURE_ZOOM; return obj; } From e54454b98696e945c6d1a9d02092338bb3506781 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 14 Feb 2020 09:40:55 -0500 Subject: [PATCH 03/27] efl/gesture: remove empty efl.object implementations from gesture objects these are no longer needed Reviewed-by: Xavi Artigas Differential Revision: https://phab.enlightenment.org/D11354 --- .../evas/gesture/efl_canvas_gesture_custom.c | 12 ------------ .../evas/gesture/efl_canvas_gesture_custom.eo | 1 - .../gesture/efl_canvas_gesture_double_tap.c | 12 ------------ .../gesture/efl_canvas_gesture_double_tap.eo | 3 --- src/lib/evas/gesture/efl_canvas_gesture_flick.c | 12 ------------ .../evas/gesture/efl_canvas_gesture_flick.eo | 3 --- .../evas/gesture/efl_canvas_gesture_long_tap.c | 17 ----------------- .../evas/gesture/efl_canvas_gesture_long_tap.eo | 4 ---- .../evas/gesture/efl_canvas_gesture_momentum.c | 12 ------------ .../evas/gesture/efl_canvas_gesture_momentum.eo | 3 --- src/lib/evas/gesture/efl_canvas_gesture_tap.c | 12 ------------ src/lib/evas/gesture/efl_canvas_gesture_tap.eo | 3 --- .../gesture/efl_canvas_gesture_triple_tap.c | 12 ------------ .../gesture/efl_canvas_gesture_triple_tap.eo | 3 --- src/lib/evas/gesture/efl_canvas_gesture_zoom.c | 17 ----------------- src/lib/evas/gesture/efl_canvas_gesture_zoom.eo | 4 ---- 16 files changed, 130 deletions(-) diff --git a/src/lib/evas/gesture/efl_canvas_gesture_custom.c b/src/lib/evas/gesture/efl_canvas_gesture_custom.c index 15fe0fe898..890bcc5469 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_custom.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_custom.c @@ -11,18 +11,6 @@ _efl_canvas_gesture_custom_efl_object_destructor(Eo *obj, Efl_Canvas_Gesture_Cus efl_destructor(efl_super(obj, MY_CLASS)); } -EOLIAN static Efl_Object * -_efl_canvas_gesture_custom_efl_object_constructor(Eo *obj, Efl_Canvas_Gesture_Custom_Data *pd EINA_UNUSED) -{ - Efl_Canvas_Gesture_Data *gd; - - obj = efl_constructor(efl_super(obj, MY_CLASS)); - - gd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_CLASS); - - return obj; -} - EOLIAN static void _efl_canvas_gesture_custom_gesture_name_set(Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Custom_Data *pd, const char *name) { diff --git a/src/lib/evas/gesture/efl_canvas_gesture_custom.eo b/src/lib/evas/gesture/efl_canvas_gesture_custom.eo index b344801e95..0e21099481 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_custom.eo +++ b/src/lib/evas/gesture/efl_canvas_gesture_custom.eo @@ -27,7 +27,6 @@ class @beta Efl.Canvas.Gesture_Custom extends Efl.Canvas.Gesture } } implements { - Efl.Object.constructor; Efl.Object.destructor; } } diff --git a/src/lib/evas/gesture/efl_canvas_gesture_double_tap.c b/src/lib/evas/gesture/efl_canvas_gesture_double_tap.c index d29e61a4a2..cff4d8fe63 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_double_tap.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_double_tap.c @@ -2,16 +2,4 @@ #define MY_CLASS EFL_CANVAS_GESTURE_DOUBLE_TAP_CLASS -EOLIAN static Efl_Object * -_efl_canvas_gesture_double_tap_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED) -{ - Efl_Canvas_Gesture_Data *gd; - - obj = efl_constructor(efl_super(obj, MY_CLASS)); - - gd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_CLASS); - - return obj; -} - #include "efl_canvas_gesture_double_tap.eo.c" diff --git a/src/lib/evas/gesture/efl_canvas_gesture_double_tap.eo b/src/lib/evas/gesture/efl_canvas_gesture_double_tap.eo index ee52aedbc5..fe01a2ad66 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_double_tap.eo +++ b/src/lib/evas/gesture/efl_canvas_gesture_double_tap.eo @@ -8,7 +8,4 @@ class @beta Efl.Canvas.Gesture_Double_Tap extends Efl.Canvas.Gesture ]] data: null; c_prefix: efl_gesture_double_tap; - implements { - Efl.Object.constructor; - } } diff --git a/src/lib/evas/gesture/efl_canvas_gesture_flick.c b/src/lib/evas/gesture/efl_canvas_gesture_flick.c index 47364b1423..57c2ee3309 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_flick.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_flick.c @@ -2,18 +2,6 @@ #define MY_CLASS EFL_CANVAS_GESTURE_FLICK_CLASS -EOLIAN static Efl_Object * -_efl_canvas_gesture_flick_efl_object_constructor(Eo *obj, Efl_Canvas_Gesture_Flick_Data *pd EINA_UNUSED) -{ - Efl_Canvas_Gesture_Data *gd; - - obj = efl_constructor(efl_super(obj, MY_CLASS)); - - gd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_CLASS); - - return obj; -} - EOLIAN static Eina_Vector2 _efl_canvas_gesture_flick_momentum_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Flick_Data *pd) { diff --git a/src/lib/evas/gesture/efl_canvas_gesture_flick.eo b/src/lib/evas/gesture/efl_canvas_gesture_flick.eo index a624a529f9..a03dffa87d 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_flick.eo +++ b/src/lib/evas/gesture/efl_canvas_gesture_flick.eo @@ -29,7 +29,4 @@ class @beta Efl.Canvas.Gesture_Flick extends Efl.Canvas.Gesture } } } - implements { - Efl.Object.constructor; - } } diff --git a/src/lib/evas/gesture/efl_canvas_gesture_long_tap.c b/src/lib/evas/gesture/efl_canvas_gesture_long_tap.c index 9ab6ff09c8..743f4ded90 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_long_tap.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_long_tap.c @@ -2,21 +2,4 @@ #define MY_CLASS EFL_CANVAS_GESTURE_LONG_TAP_CLASS -EOLIAN static Efl_Object * -_efl_canvas_gesture_long_tap_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED) -{ - Efl_Canvas_Gesture_Data *gd; - - obj = efl_constructor(efl_super(obj, MY_CLASS)); - gd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_CLASS); - - return obj; -} - -EOLIAN static void -_efl_canvas_gesture_long_tap_efl_object_destructor(Eo *obj, void *pd EINA_UNUSED) -{ - efl_destructor(efl_super(obj, MY_CLASS)); -} - #include "efl_canvas_gesture_long_tap.eo.c" diff --git a/src/lib/evas/gesture/efl_canvas_gesture_long_tap.eo b/src/lib/evas/gesture/efl_canvas_gesture_long_tap.eo index 022e3bd4ae..939da391d7 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_long_tap.eo +++ b/src/lib/evas/gesture/efl_canvas_gesture_long_tap.eo @@ -8,8 +8,4 @@ class @beta Efl.Canvas.Gesture_Long_Tap extends Efl.Canvas.Gesture ]] data: null; c_prefix: efl_gesture_long_tap; - implements { - Efl.Object.constructor; - Efl.Object.destructor; - } } diff --git a/src/lib/evas/gesture/efl_canvas_gesture_momentum.c b/src/lib/evas/gesture/efl_canvas_gesture_momentum.c index 4d00d0b580..18aaf6595f 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_momentum.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_momentum.c @@ -2,18 +2,6 @@ #define MY_CLASS EFL_CANVAS_GESTURE_MOMENTUM_CLASS -EOLIAN static Efl_Object * -_efl_canvas_gesture_momentum_efl_object_constructor(Eo *obj, Efl_Canvas_Gesture_Momentum_Data *pd EINA_UNUSED) -{ - Efl_Canvas_Gesture_Data *gd; - - obj = efl_constructor(efl_super(obj, MY_CLASS)); - - gd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_CLASS); - - return obj; -} - EOLIAN static Eina_Vector2 _efl_canvas_gesture_momentum_momentum_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Momentum_Data *pd) { diff --git a/src/lib/evas/gesture/efl_canvas_gesture_momentum.eo b/src/lib/evas/gesture/efl_canvas_gesture_momentum.eo index 715743c49b..1220e0ffde 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_momentum.eo +++ b/src/lib/evas/gesture/efl_canvas_gesture_momentum.eo @@ -19,7 +19,4 @@ class @beta Efl.Canvas.Gesture_Momentum extends Efl.Canvas.Gesture } } } - implements { - Efl.Object.constructor; - } } diff --git a/src/lib/evas/gesture/efl_canvas_gesture_tap.c b/src/lib/evas/gesture/efl_canvas_gesture_tap.c index a93dab95c1..99ee591089 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_tap.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_tap.c @@ -2,16 +2,4 @@ #define MY_CLASS EFL_CANVAS_GESTURE_TAP_CLASS -EOLIAN static Efl_Object * -_efl_canvas_gesture_tap_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED) -{ - Efl_Canvas_Gesture_Data *gd; - - obj = efl_constructor(efl_super(obj, MY_CLASS)); - - gd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_CLASS); - - return obj; -} - #include "efl_canvas_gesture_tap.eo.c" diff --git a/src/lib/evas/gesture/efl_canvas_gesture_tap.eo b/src/lib/evas/gesture/efl_canvas_gesture_tap.eo index b3cda6d447..bd33011e05 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_tap.eo +++ b/src/lib/evas/gesture/efl_canvas_gesture_tap.eo @@ -8,7 +8,4 @@ class @beta Efl.Canvas.Gesture_Tap extends Efl.Canvas.Gesture ]] data: null; c_prefix: efl_gesture_tap; - implements { - Efl.Object.constructor; - } } diff --git a/src/lib/evas/gesture/efl_canvas_gesture_triple_tap.c b/src/lib/evas/gesture/efl_canvas_gesture_triple_tap.c index d27dcec988..f698013318 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_triple_tap.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_triple_tap.c @@ -2,16 +2,4 @@ #define MY_CLASS EFL_CANVAS_GESTURE_TRIPLE_TAP_CLASS -EOLIAN static Efl_Object * -_efl_canvas_gesture_triple_tap_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED) -{ - Efl_Canvas_Gesture_Data *gd; - - obj = efl_constructor(efl_super(obj, MY_CLASS)); - - gd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_CLASS); - - return obj; -} - #include "efl_canvas_gesture_triple_tap.eo.c" diff --git a/src/lib/evas/gesture/efl_canvas_gesture_triple_tap.eo b/src/lib/evas/gesture/efl_canvas_gesture_triple_tap.eo index f58a9912ae..590148d530 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_triple_tap.eo +++ b/src/lib/evas/gesture/efl_canvas_gesture_triple_tap.eo @@ -8,7 +8,4 @@ class @beta Efl.Canvas.Gesture_Triple_Tap extends Efl.Canvas.Gesture ]] data: null; c_prefix: efl_gesture_triple_tap; - implements { - Efl.Object.constructor; - } } diff --git a/src/lib/evas/gesture/efl_canvas_gesture_zoom.c b/src/lib/evas/gesture/efl_canvas_gesture_zoom.c index d8f73ba92a..8e7a635231 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_zoom.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_zoom.c @@ -2,23 +2,6 @@ #define MY_CLASS EFL_CANVAS_GESTURE_ZOOM_CLASS -EOLIAN static Efl_Object * -_efl_canvas_gesture_zoom_efl_object_constructor(Eo *obj, Efl_Canvas_Gesture_Zoom_Data *pd EINA_UNUSED) -{ - Efl_Canvas_Gesture_Data *gd; - - obj = efl_constructor(efl_super(obj, MY_CLASS)); - gd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_CLASS); - - return obj; -} - -EOLIAN static void -_efl_canvas_gesture_zoom_efl_object_destructor(Eo *obj, Efl_Canvas_Gesture_Zoom_Data *pd EINA_UNUSED) -{ - efl_destructor(efl_super(obj, MY_CLASS)); -} - EOLIAN static double _efl_canvas_gesture_zoom_radius_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Zoom_Data *pd) { diff --git a/src/lib/evas/gesture/efl_canvas_gesture_zoom.eo b/src/lib/evas/gesture/efl_canvas_gesture_zoom.eo index 1663a76440..5642da7b17 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_zoom.eo +++ b/src/lib/evas/gesture/efl_canvas_gesture_zoom.eo @@ -28,8 +28,4 @@ class @beta Efl.Canvas.Gesture_Zoom extends Efl.Canvas.Gesture } } } - implements { - Efl.Object.constructor; - Efl.Object.destructor; - } } From 641c9427ef5f462655750ad3c802f925d09430b4 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 18 Feb 2020 10:16:51 -0500 Subject: [PATCH 04/27] efl/gesture: rename long_tap -> long_press this is consistent with the rest of efl naming ref T8503 Reviewed-by: Xavi Artigas Differential Revision: https://phab.enlightenment.org/D11376 --- src/bin/elementary/test_gesture_framework.c | 36 +++++++------- src/lib/evas/Efl_Canvas.h | 4 +- src/lib/evas/Evas_Eo.h | 4 +- .../evas/gesture/efl_canvas_gesture_events.eo | 4 +- .../gesture/efl_canvas_gesture_long_press.c | 5 ++ ...ap.eo => efl_canvas_gesture_long_press.eo} | 6 +-- .../gesture/efl_canvas_gesture_long_tap.c | 5 -- .../evas/gesture/efl_canvas_gesture_manager.c | 12 ++--- .../evas/gesture/efl_canvas_gesture_private.h | 4 +- ...fl_canvas_gesture_recognizer_long_press.c} | 28 +++++------ ...l_canvas_gesture_recognizer_long_press.eo} | 6 +-- src/lib/evas/gesture/meson.build | 8 ++-- src/tests/elementary/efl_ui_test_gesture.c | 48 +++++++++---------- 13 files changed, 85 insertions(+), 85 deletions(-) create mode 100644 src/lib/evas/gesture/efl_canvas_gesture_long_press.c rename src/lib/evas/gesture/{efl_canvas_gesture_long_tap.eo => efl_canvas_gesture_long_press.eo} (56%) delete mode 100644 src/lib/evas/gesture/efl_canvas_gesture_long_tap.c rename src/lib/evas/gesture/{efl_canvas_gesture_recognizer_long_tap.c => efl_canvas_gesture_recognizer_long_press.c} (78%) rename src/lib/evas/gesture/{efl_canvas_gesture_recognizer_long_tap.eo => efl_canvas_gesture_recognizer_long_press.eo} (52%) diff --git a/src/bin/elementary/test_gesture_framework.c b/src/bin/elementary/test_gesture_framework.c index 41a9ffd49a..ff40711cdd 100644 --- a/src/bin/elementary/test_gesture_framework.c +++ b/src/bin/elementary/test_gesture_framework.c @@ -6,7 +6,7 @@ #define TAP_NAME "tap" #define DOUBLE_TAP_NAME "double_tap" #define TRIPLE_TAP_NAME "triple_tap" -#define LONG_TAP_NAME "long_tap" +#define LONG_PRESS_NAME "long_press" #define FLICK_NAME "flick" #define LINE_NAME "line" #define MOMENTUM_NAME "momentum" @@ -17,7 +17,7 @@ #define MAX_DOUBLE_TAP 5 #define MAX_FLICK 5 #define MAX_LINE 5 -#define MAX_LONG_TAP 5 +#define MAX_LONG_PRESS 5 #define MAX_MOMENTUM 5 #define MAX_ROTATE 1 #define MAX_TAP 5 @@ -59,7 +59,7 @@ struct _infra_data icon_properties *icons; Ecore_Timer *colortimer; char buf[1024]; - int long_tap_count; + int long_press_count; }; typedef struct _infra_data infra_data; @@ -360,34 +360,34 @@ finger_double_tap_abort(void *data , Efl_Canvas_Gesture *tap EINA_UNUSED) } static void -finger_long_tap_start(void *data , Efl_Canvas_Gesture *tap) +finger_long_press_start(void *data , Efl_Canvas_Gesture *tap) { Eina_Position2D pos = efl_gesture_hotspot_get(tap); - _color_and_icon_set(data, LONG_TAP_NAME, 1, MAX_TAP, START_COLOR); + _color_and_icon_set(data, LONG_PRESS_NAME, 1, MAX_TAP, START_COLOR); printf("Long Tap Gesture started x,y=<%d,%d> \n", pos.x, pos.y); } static void -finger_long_tap_update(void *data , Efl_Canvas_Gesture *tap EINA_UNUSED) +finger_long_press_update(void *data , Efl_Canvas_Gesture *tap EINA_UNUSED) { - _color_and_icon_set(data, LONG_TAP_NAME, 1, MAX_TAP, UPDATE_COLOR); + _color_and_icon_set(data, LONG_PRESS_NAME, 1, MAX_TAP, UPDATE_COLOR); printf("Long Tap Gesture updated\n"); } static void -finger_long_tap_end(void *data , Efl_Canvas_Gesture *tap) +finger_long_press_end(void *data , Efl_Canvas_Gesture *tap) { Eina_Position2D pos = efl_gesture_hotspot_get(tap); - _color_and_icon_set(data, LONG_TAP_NAME, 1, MAX_TAP, END_COLOR); + _color_and_icon_set(data, LONG_PRESS_NAME, 1, MAX_TAP, END_COLOR); printf("Long Tap Gesture ended x,y=<%d,%d> \n",pos.x, pos.y); } static void -finger_long_tap_abort(void *data , Efl_Canvas_Gesture *tap EINA_UNUSED) +finger_long_press_abort(void *data , Efl_Canvas_Gesture *tap EINA_UNUSED) { - _color_and_icon_set(data, LONG_TAP_NAME, 1, MAX_TAP, ABORT_COLOR); + _color_and_icon_set(data, LONG_PRESS_NAME, 1, MAX_TAP, ABORT_COLOR); printf("Long Tap Aborted\n"); } @@ -521,22 +521,22 @@ double_tap_gesture_cb(void *data , const Efl_Event *ev) } static void -long_tap_gesture_cb(void *data , const Efl_Event *ev) +long_press_gesture_cb(void *data , const Efl_Event *ev) { Efl_Canvas_Gesture *g = ev->info; switch(efl_gesture_state_get(g)) { case EFL_GESTURE_STATE_STARTED: - finger_long_tap_start(data, g); + finger_long_press_start(data, g); break; case EFL_GESTURE_STATE_UPDATED: - finger_long_tap_update(data, g); + finger_long_press_update(data, g); break; case EFL_GESTURE_STATE_CANCELED: - finger_long_tap_abort(data, g); + finger_long_press_abort(data, g); break; case EFL_GESTURE_STATE_FINISHED: - finger_long_tap_end(data, g); + finger_long_press_end(data, g); break; default: break; @@ -625,7 +625,7 @@ test_gesture_framework(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, elm_table_pack(tb, bx, 2, 0, 1, 1); /* Box of Long Tap icon and label */ - bx = create_gesture_box(win, infra->icons, 3, LONG_TAP_NAME, "Long Tap"); + bx = create_gesture_box(win, infra->icons, 3, LONG_PRESS_NAME, "Long Tap"); elm_table_pack(tb, bx, 3, 0, 1, 1); /* Box of Momentum icon and label */ @@ -736,7 +736,7 @@ test_gesture_framework(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, // LISTEN FOR GESTURES efl_event_callback_add(target, EFL_EVENT_GESTURE_TAP, tap_gesture_cb, infra); - efl_event_callback_add(target, EFL_EVENT_GESTURE_LONG_TAP, long_tap_gesture_cb, infra); + efl_event_callback_add(target, EFL_EVENT_GESTURE_LONG_PRESS, long_press_gesture_cb, infra); efl_event_callback_add(target, EFL_EVENT_GESTURE_DOUBLE_TAP, double_tap_gesture_cb, infra); efl_event_callback_add(target, EFL_EVENT_GESTURE_TRIPLE_TAP, triple_tap_gesture_cb, infra); efl_event_callback_add(target, EFL_EVENT_GESTURE_MOMENTUM, momentum_gesture_cb, infra); diff --git a/src/lib/evas/Efl_Canvas.h b/src/lib/evas/Efl_Canvas.h index 3d004c9425..f457acc4bf 100644 --- a/src/lib/evas/Efl_Canvas.h +++ b/src/lib/evas/Efl_Canvas.h @@ -109,11 +109,11 @@ extern "C" { #include #include -#include +#include #include #include #include -#include +#include #include #include #include diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h index 409e777853..7d25c38874 100644 --- a/src/lib/evas/Evas_Eo.h +++ b/src/lib/evas/Evas_Eo.h @@ -86,7 +86,7 @@ struct _Efl_Canvas_Object_Animation_Event #include "gesture/efl_canvas_gesture_touch.eo.h" #include "gesture/efl_canvas_gesture.eo.h" #include "gesture/efl_canvas_gesture_tap.eo.h" -#include "gesture/efl_canvas_gesture_long_tap.eo.h" +#include "gesture/efl_canvas_gesture_long_press.eo.h" #include "gesture/efl_canvas_gesture_double_tap.eo.h" #include "gesture/efl_canvas_gesture_triple_tap.eo.h" #include "gesture/efl_canvas_gesture_momentum.eo.h" @@ -95,7 +95,7 @@ struct _Efl_Canvas_Object_Animation_Event #include "gesture/efl_canvas_gesture_custom.eo.h" #include "gesture/efl_canvas_gesture_recognizer.eo.h" #include "gesture/efl_canvas_gesture_recognizer_tap.eo.h" -#include "gesture/efl_canvas_gesture_recognizer_long_tap.eo.h" +#include "gesture/efl_canvas_gesture_recognizer_long_press.eo.h" #include "gesture/efl_canvas_gesture_recognizer_double_tap.eo.h" #include "gesture/efl_canvas_gesture_recognizer_triple_tap.eo.h" #include "gesture/efl_canvas_gesture_recognizer_momentum.eo.h" diff --git a/src/lib/evas/gesture/efl_canvas_gesture_events.eo b/src/lib/evas/gesture/efl_canvas_gesture_events.eo index bbf9ef68fd..01c50a7aa8 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_events.eo +++ b/src/lib/evas/gesture/efl_canvas_gesture_events.eo @@ -6,7 +6,7 @@ interface @beta Efl.Canvas.Gesture_Events events { gesture,tap: Efl.Canvas.Gesture_Tap; [[Emitted when a Tap gesture has been detected. A Tap gesture consists of a touch of the screen (or click of the mouse) quickly followed by - a release. If the release happens too late a @[Efl.Canvas.Gesture_Events.gesture,long_tap] event will be + a release. If the release happens too late a @[Efl.Canvas.Gesture_Events.gesture,long_press] event will be emitted instead. ]] @@ -22,7 +22,7 @@ interface @beta Efl.Canvas.Gesture_Events @[Efl.Canvas.Gesture_Events.gesture,tap] or @[Efl.Canvas.Gesture_Events.gesture,double_tap] events. ]] - gesture,long_tap: Efl.Canvas.Gesture_Long_Tap; [[Emitted when a Long-tap gesture has been detected. + gesture,long_press: Efl.Canvas.Gesture_Long_Press; [[Emitted when a Long-tap gesture has been detected. A Long-tap gesture consists of a touch of the screen (or click of the mouse) followed by a release after some time. If the release happens too quickly a @[Efl.Canvas.Gesture_Events.gesture,tap] event will be emitted instead. diff --git a/src/lib/evas/gesture/efl_canvas_gesture_long_press.c b/src/lib/evas/gesture/efl_canvas_gesture_long_press.c new file mode 100644 index 0000000000..8403a473d1 --- /dev/null +++ b/src/lib/evas/gesture/efl_canvas_gesture_long_press.c @@ -0,0 +1,5 @@ +#include "efl_canvas_gesture_private.h" + +#define MY_CLASS EFL_CANVAS_GESTURE_LONG_PRESS_CLASS + +#include "efl_canvas_gesture_long_press.eo.c" diff --git a/src/lib/evas/gesture/efl_canvas_gesture_long_tap.eo b/src/lib/evas/gesture/efl_canvas_gesture_long_press.eo similarity index 56% rename from src/lib/evas/gesture/efl_canvas_gesture_long_tap.eo rename to src/lib/evas/gesture/efl_canvas_gesture_long_press.eo index 939da391d7..f039f24ff0 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_long_tap.eo +++ b/src/lib/evas/gesture/efl_canvas_gesture_long_press.eo @@ -1,11 +1,11 @@ -class @beta Efl.Canvas.Gesture_Long_Tap extends Efl.Canvas.Gesture +class @beta Efl.Canvas.Gesture_Long_Press extends Efl.Canvas.Gesture { [[Long-tap gesture class holding state information. See @Efl.Canvas.Gesture to see what this state is and - @[Efl.Canvas.Gesture_Events.gesture,long_tap] for a description of the Long-tap gesture. + @[Efl.Canvas.Gesture_Events.gesture,long_press] for a description of the Long-tap gesture. Application developers receive these objects inside a gesture event and do not typically need to create their own. ]] data: null; - c_prefix: efl_gesture_long_tap; + c_prefix: efl_gesture_long_press; } diff --git a/src/lib/evas/gesture/efl_canvas_gesture_long_tap.c b/src/lib/evas/gesture/efl_canvas_gesture_long_tap.c deleted file mode 100644 index 743f4ded90..0000000000 --- a/src/lib/evas/gesture/efl_canvas_gesture_long_tap.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "efl_canvas_gesture_private.h" - -#define MY_CLASS EFL_CANVAS_GESTURE_LONG_TAP_CLASS - -#include "efl_canvas_gesture_long_tap.eo.c" diff --git a/src/lib/evas/gesture/efl_canvas_gesture_manager.c b/src/lib/evas/gesture/efl_canvas_gesture_manager.c index 2bee20c248..5f86e4108c 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_manager.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_manager.c @@ -47,8 +47,8 @@ _gesture_recognizer_event_type_get(const Efl_Canvas_Gesture_Recognizer *recogniz return EFL_EVENT_GESTURE_DOUBLE_TAP; if (type == EFL_CANVAS_GESTURE_TRIPLE_TAP_CLASS) return EFL_EVENT_GESTURE_TRIPLE_TAP; - if (type == EFL_CANVAS_GESTURE_LONG_TAP_CLASS) - return EFL_EVENT_GESTURE_LONG_TAP; + if (type == EFL_CANVAS_GESTURE_LONG_PRESS_CLASS) + return EFL_EVENT_GESTURE_LONG_PRESS; if (type == EFL_CANVAS_GESTURE_MOMENTUM_CLASS) return EFL_EVENT_GESTURE_MOMENTUM; if (type == EFL_CANVAS_GESTURE_FLICK_CLASS) @@ -83,7 +83,7 @@ _update_finger_sizes(Efl_Canvas_Gesture_Manager_Data *pd, int finger_size) Efl_Canvas_Gesture_Recognizer_Tap_Data *td; Efl_Canvas_Gesture_Recognizer_Double_Tap_Data *dtd; Efl_Canvas_Gesture_Recognizer_Triple_Tap_Data *ttd; - Efl_Canvas_Gesture_Recognizer_Long_Tap_Data *ltd; + Efl_Canvas_Gesture_Recognizer_Long_Press_Data *ltd; Efl_Canvas_Gesture_Recognizer_Flick_Data *fd; Efl_Canvas_Gesture_Recognizer_Zoom_Data *zd; const Efl_Event_Description *type; @@ -103,9 +103,9 @@ _update_finger_sizes(Efl_Canvas_Gesture_Manager_Data *pd, int finger_size) ttd = efl_data_scope_get(r, EFL_CANVAS_GESTURE_RECOGNIZER_TRIPLE_TAP_CLASS); ttd->finger_size = finger_size; - type = EFL_EVENT_GESTURE_LONG_TAP; + type = EFL_EVENT_GESTURE_LONG_PRESS; r = eina_hash_find(pd->m_recognizers, &type); - ltd = efl_data_scope_get(r, EFL_CANVAS_GESTURE_RECOGNIZER_LONG_TAP_CLASS); + ltd = efl_data_scope_get(r, EFL_CANVAS_GESTURE_RECOGNIZER_LONG_PRESS_CLASS); ltd->finger_size = finger_size; type = EFL_EVENT_GESTURE_FLICK; @@ -147,7 +147,7 @@ _efl_canvas_gesture_manager_efl_object_constructor(Eo *obj, Efl_Canvas_Gesture_M //Register all types of recognizers at very first time. efl_gesture_manager_recognizer_register(obj, efl_add(EFL_CANVAS_GESTURE_RECOGNIZER_TAP_CLASS, obj)); - efl_gesture_manager_recognizer_register(obj, efl_add(EFL_CANVAS_GESTURE_RECOGNIZER_LONG_TAP_CLASS, obj)); + efl_gesture_manager_recognizer_register(obj, efl_add(EFL_CANVAS_GESTURE_RECOGNIZER_LONG_PRESS_CLASS, obj)); efl_gesture_manager_recognizer_register(obj, efl_add(EFL_CANVAS_GESTURE_RECOGNIZER_DOUBLE_TAP_CLASS, obj)); efl_gesture_manager_recognizer_register(obj, efl_add(EFL_CANVAS_GESTURE_RECOGNIZER_TRIPLE_TAP_CLASS, obj)); efl_gesture_manager_recognizer_register(obj, efl_add(EFL_CANVAS_GESTURE_RECOGNIZER_MOMENTUM_CLASS, obj)); diff --git a/src/lib/evas/gesture/efl_canvas_gesture_private.h b/src/lib/evas/gesture/efl_canvas_gesture_private.h index 3ef595c3c8..1b9e7d2ddc 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_private.h +++ b/src/lib/evas/gesture/efl_canvas_gesture_private.h @@ -18,7 +18,7 @@ Eina_Bool _event_multi_touch_get(const Efl_Canvas_Gesture_Touch *event); typedef struct _Efl_Canvas_Gesture_Manager_Data Efl_Canvas_Gesture_Manager_Data; typedef struct _Efl_Canvas_Gesture_Recognizer_Data Efl_Canvas_Gesture_Recognizer_Data; typedef struct _Efl_Canvas_Gesture_Recognizer_Tap_Data Efl_Canvas_Gesture_Recognizer_Tap_Data; -typedef struct _Efl_Canvas_Gesture_Recognizer_Long_Tap_Data Efl_Canvas_Gesture_Recognizer_Long_Tap_Data; +typedef struct _Efl_Canvas_Gesture_Recognizer_Long_Press_Data Efl_Canvas_Gesture_Recognizer_Long_Press_Data; typedef struct _Efl_Canvas_Gesture_Recognizer_Double_Tap_Data Efl_Canvas_Gesture_Recognizer_Double_Tap_Data; typedef struct _Efl_Canvas_Gesture_Recognizer_Triple_Tap_Data Efl_Canvas_Gesture_Recognizer_Triple_Tap_Data; typedef struct _Efl_Canvas_Gesture_Recognizer_Momentum_Data Efl_Canvas_Gesture_Recognizer_Momentum_Data; @@ -54,7 +54,7 @@ struct _Efl_Canvas_Gesture_Recognizer_Tap_Data int finger_size; }; -struct _Efl_Canvas_Gesture_Recognizer_Long_Tap_Data +struct _Efl_Canvas_Gesture_Recognizer_Long_Press_Data { double start_timeout; Eina_List *target_timeout; diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_tap.c b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_press.c similarity index 78% rename from src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_tap.c rename to src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_press.c index 5b173858fa..bcbe5bd592 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_tap.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_press.c @@ -1,18 +1,18 @@ #include "efl_canvas_gesture_private.h" -#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_LONG_TAP_CLASS +#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_LONG_PRESS_CLASS -#define EFL_GESTURE_LONG_TAP_TIME_OUT 1.2 +#define EFL_GESTURE_LONG_PRESS_TIME_OUT 1.2 EOLIAN static const Efl_Class * -_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) +_efl_canvas_gesture_recognizer_long_press_efl_canvas_gesture_recognizer_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Recognizer_Long_Press_Data *pd EINA_UNUSED) { - return EFL_CANVAS_GESTURE_LONG_TAP_CLASS; + return EFL_CANVAS_GESTURE_LONG_PRESS_CLASS; } EOLIAN static void -_efl_canvas_gesture_recognizer_long_tap_efl_object_destructor(Eo *obj, - Efl_Canvas_Gesture_Recognizer_Long_Tap_Data *pd) +_efl_canvas_gesture_recognizer_long_press_efl_object_destructor(Eo *obj, + Efl_Canvas_Gesture_Recognizer_Long_Press_Data *pd) { if (pd->timeout) ecore_timer_del(pd->timeout); @@ -21,28 +21,28 @@ _efl_canvas_gesture_recognizer_long_tap_efl_object_destructor(Eo *obj, } static Eina_Bool -_long_tap_timeout_cb(void *data) +_long_press_timeout_cb(void *data) { - Efl_Canvas_Gesture_Recognizer_Long_Tap_Data *pd = data; + Efl_Canvas_Gesture_Recognizer_Long_Press_Data *pd = data; /* FIXME: Needs to propagate this event back to evas! */ pd->is_timeout = EINA_TRUE; efl_gesture_state_set(pd->gesture, EFL_GESTURE_STATE_UPDATED); - efl_event_callback_call(pd->target, EFL_EVENT_GESTURE_LONG_TAP, pd->gesture); + efl_event_callback_call(pd->target, EFL_EVENT_GESTURE_LONG_PRESS, pd->gesture); return ECORE_CALLBACK_RENEW; } EOLIAN static Efl_Canvas_Gesture_Recognizer_Result -_efl_canvas_gesture_recognizer_long_tap_efl_canvas_gesture_recognizer_recognize(Eo *obj, - Efl_Canvas_Gesture_Recognizer_Long_Tap_Data *pd, +_efl_canvas_gesture_recognizer_long_press_efl_canvas_gesture_recognizer_recognize(Eo *obj, + Efl_Canvas_Gesture_Recognizer_Long_Press_Data *pd, Efl_Canvas_Gesture *gesture, Efl_Object *watched, Efl_Canvas_Gesture_Touch *event) { double length, start_timeout = pd->start_timeout; // Manhattan distance - double timeout = EFL_GESTURE_LONG_TAP_TIME_OUT; + double timeout = EFL_GESTURE_LONG_PRESS_TIME_OUT; Eina_Position2D pos; Eina_Vector2 dist; Efl_Canvas_Gesture_Recognizer_Result result = EFL_GESTURE_RECOGNIZER_RESULT_CANCEL; @@ -76,7 +76,7 @@ _efl_canvas_gesture_recognizer_long_tap_efl_canvas_gesture_recognizer_recognize( ecore_timer_del(pd->timeout); } pd->timeout = ecore_timer_add(timeout, - _long_tap_timeout_cb, pd); + _long_press_timeout_cb, pd); result = EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER; @@ -140,4 +140,4 @@ _efl_canvas_gesture_recognizer_long_tap_efl_canvas_gesture_recognizer_recognize( return result; } -#include "efl_canvas_gesture_recognizer_long_tap.eo.c" +#include "efl_canvas_gesture_recognizer_long_press.eo.c" diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_tap.eo b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_press.eo similarity index 52% rename from src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_tap.eo rename to src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_press.eo index 9eb9d6afab..316b74d683 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_tap.eo +++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_press.eo @@ -1,10 +1,10 @@ -class @beta Efl.Canvas.Gesture_Recognizer_Long_Tap extends Efl.Canvas.Gesture_Recognizer +class @beta Efl.Canvas.Gesture_Recognizer_Long_Press extends Efl.Canvas.Gesture_Recognizer { [[This is the recognizer for Long-tap gestures. - See @Efl.Canvas.Gesture_Long_Tap and @Efl.Canvas.Gesture_Recognizer. + See @Efl.Canvas.Gesture_Long_Press and @Efl.Canvas.Gesture_Recognizer. For internal use only. ]] - c_prefix: efl_gesture_recognizer_long_tap; + c_prefix: efl_gesture_recognizer_long_press; implements { Efl.Object.destructor; Efl.Canvas.Gesture_Recognizer.type { get; } diff --git a/src/lib/evas/gesture/meson.build b/src/lib/evas/gesture/meson.build index 5daa6f6f30..7c2fc28a31 100644 --- a/src/lib/evas/gesture/meson.build +++ b/src/lib/evas/gesture/meson.build @@ -4,7 +4,7 @@ pub_eo_files = [ 'efl_canvas_gesture_tap.eo', 'efl_canvas_gesture_double_tap.eo', 'efl_canvas_gesture_triple_tap.eo', - 'efl_canvas_gesture_long_tap.eo', + 'efl_canvas_gesture_long_press.eo', 'efl_canvas_gesture_momentum.eo', 'efl_canvas_gesture_flick.eo', 'efl_canvas_gesture_zoom.eo', @@ -13,7 +13,7 @@ pub_eo_files = [ 'efl_canvas_gesture_recognizer_tap.eo', 'efl_canvas_gesture_recognizer_double_tap.eo', 'efl_canvas_gesture_recognizer_triple_tap.eo', - 'efl_canvas_gesture_recognizer_long_tap.eo', + 'efl_canvas_gesture_recognizer_long_press.eo', 'efl_canvas_gesture_recognizer_momentum.eo', 'efl_canvas_gesture_recognizer_flick.eo', 'efl_canvas_gesture_recognizer_zoom.eo', @@ -68,7 +68,7 @@ evas_src += files([ 'efl_canvas_gesture_tap.c', 'efl_canvas_gesture_double_tap.c', 'efl_canvas_gesture_triple_tap.c', - 'efl_canvas_gesture_long_tap.c', + 'efl_canvas_gesture_long_press.c', 'efl_canvas_gesture_momentum.c', 'efl_canvas_gesture_flick.c', 'efl_canvas_gesture_zoom.c', @@ -77,7 +77,7 @@ evas_src += files([ 'efl_canvas_gesture_recognizer_tap.c', 'efl_canvas_gesture_recognizer_double_tap.c', 'efl_canvas_gesture_recognizer_triple_tap.c', - 'efl_canvas_gesture_recognizer_long_tap.c', + 'efl_canvas_gesture_recognizer_long_press.c', 'efl_canvas_gesture_recognizer_momentum.c', 'efl_canvas_gesture_recognizer_flick.c', 'efl_canvas_gesture_recognizer_zoom.c', diff --git a/src/tests/elementary/efl_ui_test_gesture.c b/src/tests/elementary/efl_ui_test_gesture.c index 0f7d270853..c176818331 100644 --- a/src/tests/elementary/efl_ui_test_gesture.c +++ b/src/tests/elementary/efl_ui_test_gesture.c @@ -26,7 +26,7 @@ typedef enum enum { TAP, - LONG_TAP, + LONG_PRESS, DOUBLE_TAP, TRIPLE_TAP, MOMENTUM, @@ -87,7 +87,7 @@ setup(void) #define WATCH(type) \ efl_event_callback_add(rect, EFL_EVENT_GESTURE_##type, gesture_cb, &count[(type)]) WATCH(TAP); - WATCH(LONG_TAP); + WATCH(LONG_PRESS); WATCH(DOUBLE_TAP); WATCH(TRIPLE_TAP); WATCH(MOMENTUM); @@ -105,7 +105,7 @@ EFL_START_TEST(test_efl_ui_gesture_taps) /* basic tap */ click_object(rect); CHECK_ALL(TAP, 1, 0, 1, 0); - CHECK_ALL(LONG_TAP, 1, 0, 0, 1); + CHECK_ALL(LONG_PRESS, 1, 0, 0, 1); CHECK_ALL(DOUBLE_TAP, 1, 1, 0, 0); CHECK_ALL(TRIPLE_TAP, 1, 1, 0, 0); CHECK_ZERO(MOMENTUM); @@ -117,7 +117,7 @@ EFL_START_TEST(test_efl_ui_gesture_taps) /* add a second tap */ click_object(rect); CHECK_ALL(TAP, 1, 0, 1, 0); - CHECK_ALL(LONG_TAP, 1, 0, 0, 1); + CHECK_ALL(LONG_PRESS, 1, 0, 0, 1); /* UPDATE -> FINISH */ CHECK_ALL(DOUBLE_TAP, 0, 1, 1, 0); CHECK_ALL(TRIPLE_TAP, 0, 2, 0, 0); @@ -130,7 +130,7 @@ EFL_START_TEST(test_efl_ui_gesture_taps) /* add a third tap */ click_object(rect); CHECK_ALL(TAP, 1, 0, 1, 0); - CHECK_ALL(LONG_TAP, 1, 0, 0, 1); + CHECK_ALL(LONG_PRESS, 1, 0, 0, 1); /* UPDATE -> FINISH */ CHECK_ALL(DOUBLE_TAP, 1, 1, 0, 0); CHECK_ALL(TRIPLE_TAP, 0, 1, 1, 0); @@ -146,7 +146,7 @@ EFL_START_TEST(test_efl_ui_gesture_taps) click_object_at(rect, 500, 500); click_object_at(rect, 505, 505); CHECK_ALL(TAP, 2, 0, 2, 0); - CHECK_ALL(LONG_TAP, 2, 0, 0, 2); + CHECK_ALL(LONG_PRESS, 2, 0, 0, 2); /* UPDATE -> FINISH */ CHECK_ALL(DOUBLE_TAP, 1, 2, 1, 0); CHECK_ALL(TRIPLE_TAP, 1, 3, 0, 0); @@ -161,7 +161,7 @@ EFL_START_TEST(test_efl_ui_gesture_taps) /* verify multiple simultaneous presses treated as same press */ multi_click_object(rect, 2); CHECK_ALL(TAP, 1, 0, 1, 0); - CHECK_ALL(LONG_TAP, 1, 0, 0, 1); + CHECK_ALL(LONG_PRESS, 1, 0, 0, 1); CHECK_ALL(DOUBLE_TAP, 1, 1, 0, 0); CHECK_ALL(TRIPLE_TAP, 1, 1, 0, 0); CHECK_ZERO(MOMENTUM); @@ -173,7 +173,7 @@ EFL_START_TEST(test_efl_ui_gesture_taps) multi_click_object(rect, 2); CHECK_ALL(TAP, 1, 0, 1, 0); - CHECK_ALL(LONG_TAP, 1, 0, 0, 1); + CHECK_ALL(LONG_PRESS, 1, 0, 0, 1); /* UPDATE -> FINISH */ CHECK_ALL(DOUBLE_TAP, 0, 1, 1, 0); CHECK_ALL(TRIPLE_TAP, 0, 2, 0, 0); @@ -186,7 +186,7 @@ EFL_START_TEST(test_efl_ui_gesture_taps) multi_click_object(rect, 2); CHECK_ALL(TAP, 1, 0, 1, 0); - CHECK_ALL(LONG_TAP, 1, 0, 0, 1); + CHECK_ALL(LONG_PRESS, 1, 0, 0, 1); /* UPDATE -> FINISH */ CHECK_ALL(DOUBLE_TAP, 1, 1, 0, 0); CHECK_ALL(TRIPLE_TAP, 0, 1, 1, 0); @@ -200,7 +200,7 @@ EFL_START_TEST(test_efl_ui_gesture_taps) multi_click_object(rect, 10); CHECK_ALL(TAP, 1, 0, 1, 0); - CHECK_ALL(LONG_TAP, 1, 0, 0, 1); + CHECK_ALL(LONG_PRESS, 1, 0, 0, 1); CHECK_ALL(DOUBLE_TAP, 1, 0, 0, 1); CHECK_ALL(TRIPLE_TAP, 1, 0, 0, 1); CHECK_ZERO(MOMENTUM); @@ -212,7 +212,7 @@ EFL_START_TEST(test_efl_ui_gesture_taps) } EFL_END_TEST -EFL_START_TEST(test_efl_ui_gesture_long_tap) +EFL_START_TEST(test_efl_ui_gesture_long_press) { Eo *rect = setup(); double timeout = 1.2; @@ -225,7 +225,7 @@ EFL_START_TEST(test_efl_ui_gesture_long_tap) /* press */ press_object(rect); CHECK_ALL(TAP, 1, 0, 0, 0); - CHECK_ALL(LONG_TAP, 1, 0, 0, 0); + CHECK_ALL(LONG_PRESS, 1, 0, 0, 0); CHECK_ALL(DOUBLE_TAP, 1, 0, 0, 0); CHECK_ALL(TRIPLE_TAP, 1, 0, 0, 0); CHECK_ZERO(MOMENTUM); @@ -238,7 +238,7 @@ EFL_START_TEST(test_efl_ui_gesture_long_tap) /* verify longpress */ CHECK_ALL(TAP, 0, 0, 0, 1); - CHECK_ALL(LONG_TAP, 0, 1, 0, 0); + CHECK_ALL(LONG_PRESS, 0, 1, 0, 0); CHECK_ALL(DOUBLE_TAP, 0, 0, 0, 1); CHECK_ALL(TRIPLE_TAP, 0, 0, 0, 1); CHECK_ZERO(MOMENTUM); @@ -249,7 +249,7 @@ EFL_START_TEST(test_efl_ui_gesture_long_tap) evas_event_feed_mouse_up(e, 1, 0, 2, NULL); CHECK_ZERO(TAP); - CHECK_ALL(LONG_TAP, 0, 0, 1, 0); + CHECK_ALL(LONG_PRESS, 0, 0, 1, 0); CHECK_ZERO(DOUBLE_TAP); CHECK_ZERO(TRIPLE_TAP); CHECK_ZERO(MOMENTUM); @@ -267,7 +267,7 @@ EFL_START_TEST(test_efl_ui_gesture_long_tap) /* verify longpress */ CHECK_ALL(TAP, 0, 1, 0, 0); - CHECK_ALL(LONG_TAP, 0, 1, 0, 0); + CHECK_ALL(LONG_PRESS, 0, 1, 0, 0); CHECK_ALL(DOUBLE_TAP, 0, 0, 0, 1); CHECK_ALL(TRIPLE_TAP, 0, 0, 0, 1); CHECK_ALL(MOMENTUM, 1, 0, 0, 0); @@ -292,7 +292,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick) /* canceled */ CHECK_ALL(TAP, 1, 0, 0, 1); /* canceled */ - CHECK_ALL(LONG_TAP, 1, 0, 0, 1); + CHECK_ALL(LONG_PRESS, 1, 0, 0, 1); /* canceled */ CHECK_ALL(DOUBLE_TAP, 1, 0, 0, 1); /* canceled */ @@ -313,7 +313,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick) /* canceled */ CHECK_ALL(TAP, 1, 0, 0, 1); /* canceled */ - CHECK_ALL(LONG_TAP, 1, 0, 0, 1); + CHECK_ALL(LONG_PRESS, 1, 0, 0, 1); /* canceled */ CHECK_ALL(DOUBLE_TAP, 1, 0, 0, 1); /* canceled */ @@ -331,7 +331,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick) /* canceled */ CHECK_ALL(TAP, 1, 0, 0, 1); /* canceled */ - CHECK_ALL(LONG_TAP, 1, 0, 0, 1); + CHECK_ALL(LONG_PRESS, 1, 0, 0, 1); /* canceled */ CHECK_ALL(DOUBLE_TAP, 1, 0, 0, 1); /* canceled */ @@ -349,7 +349,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick) /* canceled */ CHECK_ALL(TAP, 1, 0, 0, 1); /* canceled */ - CHECK_ALL(LONG_TAP, 1, 0, 0, 1); + CHECK_ALL(LONG_PRESS, 1, 0, 0, 1); /* canceled */ CHECK_ALL(DOUBLE_TAP, 1, 0, 0, 1); /* canceled */ @@ -368,7 +368,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick) /* canceled */ CHECK_ALL(TAP, 1, 0, 0, 1); /* canceled */ - CHECK_ALL(LONG_TAP, 1, 0, 0, 1); + CHECK_ALL(LONG_PRESS, 1, 0, 0, 1); /* canceled */ CHECK_ALL(DOUBLE_TAP, 1, 0, 0, 1); /* canceled */ @@ -386,7 +386,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick) /* canceled */ CHECK_ALL(TAP, 1, 0, 0, 1); /* canceled */ - CHECK_ALL(LONG_TAP, 1, 0, 0, 1); + CHECK_ALL(LONG_PRESS, 1, 0, 0, 1); /* canceled */ CHECK_ALL(DOUBLE_TAP, 1, 0, 0, 1); /* canceled */ @@ -474,7 +474,7 @@ EFL_START_TEST(test_efl_ui_gesture_zoom) /* canceled */ CHECK_ALL(TAP, 1, 0, 0, 1); /* canceled */ - CHECK_ALL(LONG_TAP, 1, 0, 0, 1); + CHECK_ALL(LONG_PRESS, 1, 0, 0, 1); /* canceled */ CHECK_ALL(DOUBLE_TAP, 1, 0, 0, 1); /* canceled */ @@ -502,7 +502,7 @@ EFL_START_TEST(test_efl_ui_gesture_zoom) /* canceled */ CHECK_ALL(TAP, 1, 0, 0, 1); /* canceled */ - CHECK_ALL(LONG_TAP, 1, 0, 0, 1); + CHECK_ALL(LONG_PRESS, 1, 0, 0, 1); /* canceled */ CHECK_ALL(DOUBLE_TAP, 1, 0, 0, 1); /* canceled */ @@ -624,7 +624,7 @@ EFL_END_TEST void efl_ui_test_gesture(TCase *tc) { tcase_add_test(tc, test_efl_ui_gesture_taps); - tcase_add_test(tc, test_efl_ui_gesture_long_tap); + tcase_add_test(tc, test_efl_ui_gesture_long_press); tcase_add_test(tc, test_efl_ui_gesture_flick); tcase_add_test(tc, test_efl_ui_gesture_zoom); tcase_add_test(tc, test_efl_ui_gesture_custom); From 830cdcf7ea7d45a78f2b08403f9eb5f50f35eeac Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 19 Feb 2020 09:49:08 -0500 Subject: [PATCH 05/27] efl/gesture: move some internal recognizer functions to be reusable no functional changes Differential Revision: https://phab.enlightenment.org/D11382 --- .../evas/gesture/efl_canvas_gesture_private.h | 3 + .../gesture/efl_canvas_gesture_recognizer.c | 101 ++++++++++++++++++ .../efl_canvas_gesture_recognizer_flick.c | 52 --------- .../efl_canvas_gesture_recognizer_zoom.c | 51 --------- 4 files changed, 104 insertions(+), 103 deletions(-) diff --git a/src/lib/evas/gesture/efl_canvas_gesture_private.h b/src/lib/evas/gesture/efl_canvas_gesture_private.h index 1b9e7d2ddc..fe8de41d04 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_private.h +++ b/src/lib/evas/gesture/efl_canvas_gesture_private.h @@ -15,6 +15,9 @@ int _direction_get(Evas_Coord xx1, Evas_Coord xx2); Eina_Value *_recognizer_config_get(const Eo *obj, const char *name); Eina_Bool _event_multi_touch_get(const Efl_Canvas_Gesture_Touch *event); +double _angle_get(Evas_Coord xx1, Evas_Coord yy1, Evas_Coord xx2, Evas_Coord yy2); +Evas_Coord _finger_gap_length_get(Evas_Coord xx1, Evas_Coord yy1, Evas_Coord xx2, Evas_Coord yy2, Evas_Coord *x, Evas_Coord *y); + typedef struct _Efl_Canvas_Gesture_Manager_Data Efl_Canvas_Gesture_Manager_Data; typedef struct _Efl_Canvas_Gesture_Recognizer_Data Efl_Canvas_Gesture_Recognizer_Data; typedef struct _Efl_Canvas_Gesture_Recognizer_Tap_Data Efl_Canvas_Gesture_Recognizer_Tap_Data; diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer.c b/src/lib/evas/gesture/efl_canvas_gesture_recognizer.c index 588a233660..c07e11d084 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_recognizer.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer.c @@ -1,5 +1,6 @@ #define EFL_CANVAS_GESTURE_RECOGNIZER_PROTECTED #include "efl_canvas_gesture_private.h" +#define RAD2DEG(x) ((x) * 57.295779513) #define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_CLASS #include "efl_canvas_gesture_recognizer.eo.h" @@ -39,4 +40,104 @@ _event_multi_touch_get(const Efl_Canvas_Gesture_Touch *event) return efl_gesture_touch_points_count_get(event) > 1; } + +double +_angle_get(Evas_Coord xx1, Evas_Coord yy1, Evas_Coord xx2, Evas_Coord yy2) +{ + double a, xx, yy, rt = (-1); + + xx = abs(xx2 - xx1); + yy = abs(yy2 - yy1); + + if (((int)xx) && ((int)yy)) + { + rt = a = RAD2DEG(atan(yy / xx)); + if (xx1 < xx2) + { + if (yy1 < yy2) rt = 360 - a; + else rt = a; + } + else + { + if (yy1 < yy2) rt = 180 + a; + else rt = 180 - a; + } + } + + if (rt < 0) /* Do this only if rt is not set */ + { + if (((int)xx)) /* Horizontal line */ + { + if (xx2 < xx1) rt = 180; + else rt = 0.0; + } + else /* Vertical line */ + { + if (yy2 < yy1) rt = 90; + else rt = 270; + } + } + + /* Now we want to change from: + * 90 0 + * original circle 180 0 We want: 270 90 + * 270 180 + */ + rt = 450 - rt; + if (rt >= 360) rt -= 360; + + return rt; +} + +Evas_Coord +_finger_gap_length_get(Evas_Coord xx1, + Evas_Coord yy1, + Evas_Coord xx2, + Evas_Coord yy2, + Evas_Coord *x, + Evas_Coord *y) +{ + double a, b, xx, yy, gap; + xx = abs(xx2 - xx1); + yy = abs(yy2 - yy1); + gap = sqrt((xx * xx) + (yy * yy)); + + /* START - Compute zoom center point */ + /* The triangle defined as follows: + * B + * / | + * / | + * gap / | a + * / | + * A-----C + * b + * http://en.wikipedia.org/wiki/Trigonometric_functions + *************************************/ + if (((int)xx) && ((int)yy)) + { + double A = atan((yy / xx)); + a = (Evas_Coord)((gap / 2) * sin(A)); + b = (Evas_Coord)((gap / 2) * cos(A)); + *x = (Evas_Coord)((xx2 > xx1) ? (xx1 + b) : (xx2 + b)); + *y = (Evas_Coord)((yy2 > yy1) ? (yy1 + a) : (yy2 + a)); + } + else + { + if ((int)xx) /* horiz line, take half width */ + { + *x = (Evas_Coord)((xx1 + xx2) / 2); + *y = (Evas_Coord)(yy1); + } + + if ((int)yy) /* vert line, take half width */ + { + *x = (Evas_Coord)(xx1); + *y = (Evas_Coord)((yy1 + yy2) / 2); + } + } + /* END - Compute zoom center point */ + + return (Evas_Coord)gap; +} + #include "efl_canvas_gesture_recognizer.eo.c" 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 6736e39a45..071d45f142 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_flick.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_flick.c @@ -7,7 +7,6 @@ #define THUMBSCROLL_MOMENTUM_THRESHOLD 100.0 #define EFL_GESTURE_MINIMUM_MOMENTUM 0.001 -#define RAD2DEG(x) ((x) * 57.295779513) #define DEG2RAD(x) ((x) / 57.295779513) #define memset do not use memset to reset flick data, use _reset_recognizer @@ -114,57 +113,6 @@ _single_line_process(Eo *obj, pd->t_st, efl_gesture_touch_current_timestamp_get(event)); } -static double -_angle_get(Evas_Coord xx1, - Evas_Coord yy1, - Evas_Coord xx2, - Evas_Coord yy2) -{ - double a, xx, yy, rt = (-1); - - xx = abs(xx2 - xx1); - yy = abs(yy2 - yy1); - - if (((int)xx) && ((int)yy)) - { - rt = a = RAD2DEG(atan(yy / xx)); - if (xx1 < xx2) - { - if (yy1 < yy2) rt = 360 - a; - else rt = a; - } - else - { - if (yy1 < yy2) rt = 180 + a; - else rt = 180 - a; - } - } - - if (rt < 0) /* Do this only if rt is not set */ - { - if (((int)xx)) /* Horizontal line */ - { - if (xx2 < xx1) rt = 180; - else rt = 0.0; - } - else /* Vertical line */ - { - if (yy2 < yy1) rt = 90; - else rt = 270; - } - } - - /* Now we want to change from: - * 90 0 - * original circle 180 0 We want: 270 90 - * 270 180 - */ - rt = 450 - rt; - if (rt >= 360) rt -= 360; - - return rt; -} - static void _vector_get(Eina_Position2D v1, Eina_Position2D v2, 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 3dd6070ae4..372fd1ecfe 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_zoom.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_zoom.c @@ -16,57 +16,6 @@ _reset_recognizer(Efl_Canvas_Gesture_Recognizer_Zoom_Data *pd) #define memset do not use memset to reset zoom data, use _reset_recognizer -static Evas_Coord -_finger_gap_length_get(Evas_Coord xx1, - Evas_Coord yy1, - Evas_Coord xx2, - Evas_Coord yy2, - Evas_Coord *x, - Evas_Coord *y) -{ - double a, b, xx, yy, gap; - xx = abs(xx2 - xx1); - yy = abs(yy2 - yy1); - gap = sqrt((xx * xx) + (yy * yy)); - - /* START - Compute zoom center point */ - /* The triangle defined as follows: - * B - * / | - * / | - * gap / | a - * / | - * A-----C - * b - * http://en.wikipedia.org/wiki/Trigonometric_functions - *************************************/ - if (((int)xx) && ((int)yy)) - { - double A = atan((yy / xx)); - a = (Evas_Coord)((gap / 2) * sin(A)); - b = (Evas_Coord)((gap / 2) * cos(A)); - *x = (Evas_Coord)((xx2 > xx1) ? (xx1 + b) : (xx2 + b)); - *y = (Evas_Coord)((yy2 > yy1) ? (yy1 + a) : (yy2 + a)); - } - else - { - if ((int)xx) /* horiz line, take half width */ - { - *x = (Evas_Coord)((xx1 + xx2) / 2); - *y = (Evas_Coord)(yy1); - } - - if ((int)yy) /* vert line, take half width */ - { - *x = (Evas_Coord)(xx1); - *y = (Evas_Coord)((yy1 + yy2) / 2); - } - } - /* END - Compute zoom center point */ - - return (Evas_Coord)gap; -} - static double _zoom_compute(Efl_Canvas_Gesture_Recognizer_Zoom_Data *pd, Efl_Canvas_Gesture_Zoom_Data *zd, From d300e90d390fc9c764e57dc5806616e43e8db954 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 19 Feb 2020 10:24:04 -0500 Subject: [PATCH 06/27] efl/gesture: port 'rotate' gesture from elm to new gesture framework this is a 1:1 port with minimal changes other than what's necessary to integrate into the new framework Differential Revision: https://phab.enlightenment.org/D11383 --- src/bin/elementary/test_gesture_framework.c | 48 ++++ src/lib/evas/Efl_Canvas.h | 2 + src/lib/evas/Evas_Eo.h | 2 + .../evas/gesture/efl_canvas_gesture_events.eo | 5 + .../evas/gesture/efl_canvas_gesture_manager.c | 9 + .../evas/gesture/efl_canvas_gesture_private.h | 28 ++ .../efl_canvas_gesture_recognizer_rotate.c | 269 ++++++++++++++++++ .../efl_canvas_gesture_recognizer_rotate.eo | 12 + .../evas/gesture/efl_canvas_gesture_rotate.c | 17 ++ .../evas/gesture/efl_canvas_gesture_rotate.eo | 28 ++ src/lib/evas/gesture/meson.build | 4 + 11 files changed, 424 insertions(+) create mode 100644 src/lib/evas/gesture/efl_canvas_gesture_recognizer_rotate.c create mode 100644 src/lib/evas/gesture/efl_canvas_gesture_recognizer_rotate.eo create mode 100644 src/lib/evas/gesture/efl_canvas_gesture_rotate.c create mode 100644 src/lib/evas/gesture/efl_canvas_gesture_rotate.eo diff --git a/src/bin/elementary/test_gesture_framework.c b/src/bin/elementary/test_gesture_framework.c index ff40711cdd..4675604fa3 100644 --- a/src/bin/elementary/test_gesture_framework.c +++ b/src/bin/elementary/test_gesture_framework.c @@ -223,6 +223,33 @@ finger_flick_abort(void *data , Efl_Canvas_Gesture *tap EINA_UNUSED) printf("Flick Aborted\n"); } +static void +finger_rotate_start(void *data , Efl_Canvas_Gesture *tap) +{ + Eina_Position2D pos = efl_gesture_hotspot_get(tap); + + _color_and_icon_set(data, ROTATE_NAME, 1, MAX_TAP, START_COLOR); + printf("Rotate Gesture started x,y=<%d,%d> \n", pos.x, pos.y); +} + +static void +finger_rotate_end(void *data , Efl_Canvas_Gesture *tap) +{ + Eina_Position2D pos = efl_gesture_hotspot_get(tap); + double angle = efl_gesture_rotate_angle_get(tap); + double radius = efl_gesture_rotate_radius_get(tap); + + _color_and_icon_set(data, ROTATE_NAME, 1, MAX_TAP, END_COLOR); + printf("Rotate Gesture ended x,y=<%d,%d> angle=<%g> radius=<%f>\n", pos.x, pos.y, angle, radius); +} + +static void +finger_rotate_abort(void *data , Efl_Canvas_Gesture *tap EINA_UNUSED) +{ + _color_and_icon_set(data, ROTATE_NAME, 1, MAX_TAP, ABORT_COLOR); + printf("Rotate Aborted\n"); +} + static void finger_zoom_start(void *data , Efl_Canvas_Gesture *tap) { @@ -431,6 +458,26 @@ flick_gesture_cb(void *data , const Efl_Event *ev) } } +static void +rotate_gesture_cb(void *data , const Efl_Event *ev) +{ + Efl_Canvas_Gesture *g = ev->info; + switch(efl_gesture_state_get(g)) + { + case EFL_GESTURE_STATE_STARTED: + finger_rotate_start(data, g); + break; + case EFL_GESTURE_STATE_CANCELED: + finger_rotate_abort(data, g); + break; + case EFL_GESTURE_STATE_FINISHED: + finger_rotate_end(data, g); + break; + default: + break; + } +} + static void zoom_gesture_cb(void *data , const Efl_Event *ev) { @@ -741,6 +788,7 @@ test_gesture_framework(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, efl_event_callback_add(target, EFL_EVENT_GESTURE_TRIPLE_TAP, triple_tap_gesture_cb, infra); efl_event_callback_add(target, EFL_EVENT_GESTURE_MOMENTUM, momentum_gesture_cb, infra); efl_event_callback_add(target, EFL_EVENT_GESTURE_FLICK, flick_gesture_cb, infra); + efl_event_callback_add(target, EFL_EVENT_GESTURE_ROTATE, rotate_gesture_cb, infra); efl_event_callback_add(target, EFL_EVENT_GESTURE_ZOOM, zoom_gesture_cb, infra); /* Update color state 20 times a second */ diff --git a/src/lib/evas/Efl_Canvas.h b/src/lib/evas/Efl_Canvas.h index f457acc4bf..55534b17dc 100644 --- a/src/lib/evas/Efl_Canvas.h +++ b/src/lib/evas/Efl_Canvas.h @@ -117,10 +117,12 @@ extern "C" { #include #include #include +#include #include #include #include #include +#include #include #include #include diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h index 7d25c38874..046f2c55d6 100644 --- a/src/lib/evas/Evas_Eo.h +++ b/src/lib/evas/Evas_Eo.h @@ -91,6 +91,7 @@ struct _Efl_Canvas_Object_Animation_Event #include "gesture/efl_canvas_gesture_triple_tap.eo.h" #include "gesture/efl_canvas_gesture_momentum.eo.h" #include "gesture/efl_canvas_gesture_flick.eo.h" +#include "gesture/efl_canvas_gesture_rotate.eo.h" #include "gesture/efl_canvas_gesture_zoom.eo.h" #include "gesture/efl_canvas_gesture_custom.eo.h" #include "gesture/efl_canvas_gesture_recognizer.eo.h" @@ -100,6 +101,7 @@ struct _Efl_Canvas_Object_Animation_Event #include "gesture/efl_canvas_gesture_recognizer_triple_tap.eo.h" #include "gesture/efl_canvas_gesture_recognizer_momentum.eo.h" #include "gesture/efl_canvas_gesture_recognizer_flick.eo.h" +#include "gesture/efl_canvas_gesture_recognizer_rotate.eo.h" #include "gesture/efl_canvas_gesture_recognizer_zoom.eo.h" #include "gesture/efl_canvas_gesture_recognizer_custom.eo.h" #include "gesture/efl_canvas_gesture_manager.eo.h" diff --git a/src/lib/evas/gesture/efl_canvas_gesture_events.eo b/src/lib/evas/gesture/efl_canvas_gesture_events.eo index 01c50a7aa8..6d95e68d4d 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_events.eo +++ b/src/lib/evas/gesture/efl_canvas_gesture_events.eo @@ -38,6 +38,11 @@ interface @beta Efl.Canvas.Gesture_Events holding down a mouse button) with the release occurring before slowing down. ]] + gesture,rotate: Efl.Canvas.Gesture_Rotate; [[Emitted when a Rotate gesture has been detected. + A Rotate gesture consists of two fingers touching the screen and performing a motion such that + one finger rotates around the other. + This gesture cannot be performed with a mouse as it requires more than one pointer. + ]] gesture,zoom: Efl.Canvas.Gesture_Zoom; [[Emitted when a Zoom gesture has been detected. A Zoom gesture consists of two fingers touching the screen and separating ("zoom in") or getting closer ("zoom out" or "pinch"). diff --git a/src/lib/evas/gesture/efl_canvas_gesture_manager.c b/src/lib/evas/gesture/efl_canvas_gesture_manager.c index 5f86e4108c..e33e3f2cb0 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_manager.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_manager.c @@ -53,6 +53,8 @@ _gesture_recognizer_event_type_get(const Efl_Canvas_Gesture_Recognizer *recogniz return EFL_EVENT_GESTURE_MOMENTUM; if (type == EFL_CANVAS_GESTURE_FLICK_CLASS) return EFL_EVENT_GESTURE_FLICK; + if (type == EFL_CANVAS_GESTURE_ROTATE_CLASS) + return EFL_EVENT_GESTURE_ROTATE; if (type == EFL_CANVAS_GESTURE_ZOOM_CLASS) return EFL_EVENT_GESTURE_ZOOM; return EFL_EVENT_GESTURE_CUSTOM; @@ -85,6 +87,7 @@ _update_finger_sizes(Efl_Canvas_Gesture_Manager_Data *pd, int finger_size) Efl_Canvas_Gesture_Recognizer_Triple_Tap_Data *ttd; Efl_Canvas_Gesture_Recognizer_Long_Press_Data *ltd; Efl_Canvas_Gesture_Recognizer_Flick_Data *fd; + Efl_Canvas_Gesture_Recognizer_Rotate_Data *rd; Efl_Canvas_Gesture_Recognizer_Zoom_Data *zd; const Efl_Event_Description *type; @@ -113,6 +116,11 @@ _update_finger_sizes(Efl_Canvas_Gesture_Manager_Data *pd, int finger_size) fd = efl_data_scope_get(r, EFL_CANVAS_GESTURE_RECOGNIZER_FLICK_CLASS); fd->finger_size = finger_size; + type = EFL_EVENT_GESTURE_ROTATE; + r = eina_hash_find(pd->m_recognizers, &type); + rd = efl_data_scope_get(r, EFL_CANVAS_GESTURE_RECOGNIZER_ROTATE_CLASS); + rd->finger_size = finger_size; + type = EFL_EVENT_GESTURE_ZOOM; r = eina_hash_find(pd->m_recognizers, &type); zd = efl_data_scope_get(r, EFL_CANVAS_GESTURE_RECOGNIZER_ZOOM_CLASS); @@ -152,6 +160,7 @@ _efl_canvas_gesture_manager_efl_object_constructor(Eo *obj, Efl_Canvas_Gesture_M efl_gesture_manager_recognizer_register(obj, efl_add(EFL_CANVAS_GESTURE_RECOGNIZER_TRIPLE_TAP_CLASS, obj)); efl_gesture_manager_recognizer_register(obj, efl_add(EFL_CANVAS_GESTURE_RECOGNIZER_MOMENTUM_CLASS, obj)); efl_gesture_manager_recognizer_register(obj, efl_add(EFL_CANVAS_GESTURE_RECOGNIZER_FLICK_CLASS, obj)); + efl_gesture_manager_recognizer_register(obj, efl_add(EFL_CANVAS_GESTURE_RECOGNIZER_ROTATE_CLASS, obj)); efl_gesture_manager_recognizer_register(obj, efl_add(EFL_CANVAS_GESTURE_RECOGNIZER_ZOOM_CLASS, obj)); _update_finger_sizes(pd, EFL_GESTURE_RECOGNIZER_TYPE_TAP_FINGER_SIZE); diff --git a/src/lib/evas/gesture/efl_canvas_gesture_private.h b/src/lib/evas/gesture/efl_canvas_gesture_private.h index fe8de41d04..7b9b8550b0 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_private.h +++ b/src/lib/evas/gesture/efl_canvas_gesture_private.h @@ -26,12 +26,14 @@ typedef struct _Efl_Canvas_Gesture_Recognizer_Double_Tap_Data Efl_Canvas_Gestur typedef struct _Efl_Canvas_Gesture_Recognizer_Triple_Tap_Data Efl_Canvas_Gesture_Recognizer_Triple_Tap_Data; typedef struct _Efl_Canvas_Gesture_Recognizer_Momentum_Data Efl_Canvas_Gesture_Recognizer_Momentum_Data; typedef struct _Efl_Canvas_Gesture_Recognizer_Flick_Data Efl_Canvas_Gesture_Recognizer_Flick_Data; +typedef struct _Efl_Canvas_Gesture_Recognizer_Rotate_Data Efl_Canvas_Gesture_Recognizer_Rotate_Data; typedef struct _Efl_Canvas_Gesture_Recognizer_Zoom_Data Efl_Canvas_Gesture_Recognizer_Zoom_Data; typedef struct _Efl_Canvas_Gesture_Recognizer_Custom_Data Efl_Canvas_Gesture_Recognizer_Custom_Data; typedef struct _Efl_Canvas_Gesture_Data Efl_Canvas_Gesture_Data; typedef struct _Efl_Canvas_Gesture_Momentum_Data Efl_Canvas_Gesture_Momentum_Data; typedef struct _Efl_Canvas_Gesture_Flick_Data Efl_Canvas_Gesture_Flick_Data; typedef struct _Efl_Canvas_Gesture_Zoom_Data Efl_Canvas_Gesture_Zoom_Data; +typedef struct _Efl_Canvas_Gesture_Rotate_Data Efl_Canvas_Gesture_Rotate_Data; typedef struct _Efl_Canvas_Gesture_Custom_Data Efl_Canvas_Gesture_Custom_Data; typedef struct _Efl_Canvas_Gesture_Touch_Data @@ -114,6 +116,24 @@ struct _Efl_Canvas_Gesture_Recognizer_Flick_Data Eina_Bool touched; }; +struct _Efl_Canvas_Gesture_Recognizer_Rotate_Data +{ + Efl_Gesture_Touch_Point_Data rotate_st; + Efl_Gesture_Touch_Point_Data rotate_st1; + + Efl_Gesture_Touch_Point_Data rotate_mv; + Efl_Gesture_Touch_Point_Data rotate_mv1; + double rotate_step; + double base_angle; /**< Holds start-angle */ + double prev_momentum; /* Snapshot of momentum 0.01 + * sec ago */ + double accum_momentum; + double rotate_angular_tolerance; + double next_step; + unsigned int prev_momentum_tm; /* timestamp of prev_momentum */ + int finger_size; +}; + struct _Efl_Canvas_Gesture_Recognizer_Zoom_Data { Efl_Gesture_Touch_Point_Data zoom_st; @@ -159,6 +179,14 @@ struct _Efl_Canvas_Gesture_Flick_Data int id; }; +struct _Efl_Canvas_Gesture_Rotate_Data +{ + //Evas_Coord x, y; /**< Holds rotate center point reported to user */ + double angle; /**< Rotation value: 0.0 means no rotation */ + double momentum; /**< Rotation momentum: rotation done per second (NOT YET SUPPORTED) */ + Evas_Coord radius; /**< Holds radius between fingers reported to user */ +}; + struct _Efl_Canvas_Gesture_Zoom_Data { double radius; diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_rotate.c b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_rotate.c new file mode 100644 index 0000000000..97fa907767 --- /dev/null +++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_rotate.c @@ -0,0 +1,269 @@ +#include "efl_canvas_gesture_private.h" + +#define NEGATIVE_ANGLE (-1.0) /* Magic number */ + +#define MY_CLASS EFL_CANVAS_GESTURE_RECOGNIZER_ROTATE_CLASS + +static void +_reset_recognizer(Efl_Canvas_Gesture_Recognizer_Rotate_Data *pd) +{ + memset(&pd->rotate_st, 0, sizeof(Efl_Gesture_Touch_Point_Data)); + memset(&pd->rotate_st1, 0, sizeof(Efl_Gesture_Touch_Point_Data)); + memset(&pd->rotate_mv, 0, sizeof(Efl_Gesture_Touch_Point_Data)); + memset(&pd->rotate_mv1, 0, sizeof(Efl_Gesture_Touch_Point_Data)); + pd->prev_momentum = 0; + pd->base_angle = 0; + pd->next_step = pd->accum_momentum = 0; +} + +#define memset do not use memset to reset rotate data, use _reset_recognizer + + +static void +_rotate_properties_get(Efl_Canvas_Gesture_Recognizer_Rotate_Data *pd, + Efl_Canvas_Gesture_Rotate_Data *gd, + Evas_Coord xx1, + Evas_Coord yy1, + Evas_Coord xx2, + Evas_Coord yy2, + double *angle, Eina_Bool started) +{ + /* FIXME: Fix momentum computation, it's wrong */ + double prev_angle = *angle; + int x, y; + gd->radius = _finger_gap_length_get(xx1, yy1, xx2, yy2, &x, &y) / 2; + + *angle = _angle_get(xx1, yy1, xx2, yy2); + + if (!started) /* Fingers are moving, compute momentum */ + { + unsigned int tm_start = + (pd->rotate_st.cur.timestamp > pd->rotate_st1.cur.timestamp) + ? pd->rotate_st.cur.timestamp : pd->rotate_st1.cur.timestamp; + unsigned int tm_end = + (pd->rotate_mv.cur.timestamp > pd->rotate_mv1.cur.timestamp) + ? pd->rotate_mv.cur.timestamp : pd->rotate_mv1.cur.timestamp; + + unsigned int tm_total = tm_end - tm_start; + if (tm_total) /* Momentum computed as: + accumulated rotation angle (deg) divided by time */ + { + double m = 0; + if (((prev_angle < 90) && ((*angle) > 270)) || + /* We circle passing ZERO point */ + ((prev_angle > 270) && ((*angle) < 90))) + { + prev_angle = (*angle); + } + else m = prev_angle - (*angle); + + pd->accum_momentum += m; + + if ((tm_end - pd->prev_momentum_tm) < 100) + pd->prev_momentum += m; + else + { + if (fabs(pd->prev_momentum) < 0.002) + pd->accum_momentum = 0.0; /* reset momentum */ + + pd->prev_momentum = 0.0; /* Start again */ + } + + pd->prev_momentum_tm = tm_end; + gd->momentum = (pd->accum_momentum * 1000) / tm_total; + } + } + else + gd->momentum = 0; +} + +static Eina_Bool +_on_rotation_broke_tolerance(Efl_Canvas_Gesture_Recognizer_Rotate_Data *pd, Efl_Canvas_Gesture_Rotate_Data *gd) +{ + if (pd->base_angle < 0) + return EINA_FALSE; /* Angle has to be computed first */ + + if (pd->rotate_angular_tolerance < 0) + return EINA_TRUE; + + double low = pd->base_angle - pd->rotate_angular_tolerance; + double high = pd->base_angle + pd->rotate_angular_tolerance; + double t = gd->angle; + + if (low < 0) + { + low += 180; + high += 180; + + if (t < 180) + t += 180; + else + t -= 180; + } + + if (high > 360) + { + low -= 180; + high -= 180; + + if (t < 180) + t += 180; + else + t -= 180; + } + + if ((t < low) || (t > high)) /* This marks that rotation action has + * started */ + { + pd->rotate_angular_tolerance = NEGATIVE_ANGLE; + pd->base_angle = gd->angle; /* Avoid jump in angle value */ + return EINA_TRUE; + } + + return EINA_FALSE; +} + +EOLIAN static const Efl_Class * +_efl_canvas_gesture_recognizer_rotate_efl_canvas_gesture_recognizer_type_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Recognizer_Rotate_Data *pd EINA_UNUSED) +{ + return EFL_CANVAS_GESTURE_ROTATE_CLASS; +} + +EOLIAN static Efl_Canvas_Gesture_Recognizer_Result +_efl_canvas_gesture_recognizer_rotate_efl_canvas_gesture_recognizer_recognize(Eo *obj, + Efl_Canvas_Gesture_Recognizer_Rotate_Data *pd, + Efl_Canvas_Gesture *gesture, + Efl_Object *watched, + Efl_Canvas_Gesture_Touch *event) +{ + Eina_Value *val; + unsigned char glayer_continues_enable; + Efl_Canvas_Gesture_Recognizer_Result result = EFL_GESTURE_RECOGNIZER_RESULT_CANCEL; + Efl_Canvas_Gesture_Rotate_Data *gd = efl_data_scope_get(gesture, EFL_CANVAS_GESTURE_ROTATE_CLASS); + Efl_Canvas_Gesture_Touch_Data *td = efl_data_scope_get(event, EFL_CANVAS_GESTURE_TOUCH_CLASS); + Efl_Canvas_Gesture_Recognizer_Data *rd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_RECOGNIZER_CLASS); + const Efl_Gesture_Touch_Point_Data *p1 = efl_gesture_touch_data_get(event, 0); + const Efl_Gesture_Touch_Point_Data *p2 = efl_gesture_touch_data_get(event, 1); + + //FIXME: Wheel rotate test first here. + + val = _recognizer_config_get(obj, "glayer_continues_enable"); + if (val) eina_value_get(val, &glayer_continues_enable); + else glayer_continues_enable = 1; + + rd->continues = EINA_TRUE; + + switch (efl_gesture_touch_state_get(event)) + { + case EFL_GESTURE_TOUCH_STATE_UPDATE: + { + if ((!glayer_continues_enable) && (!pd->rotate_st.cur.timestamp)) + { + return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE; + } + EINA_FALLTHROUGH; + } + + case EFL_GESTURE_TOUCH_STATE_BEGIN: + { + if (td->touch_down > 2) + { + _reset_recognizer(pd); + if (efl_gesture_state_get(gesture) == EFL_GESTURE_STATE_CANCELED) + return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE; + return EFL_GESTURE_RECOGNIZER_RESULT_CANCEL; + } + if (td->touch_down == 1) + { + return EFL_GESTURE_RECOGNIZER_RESULT_MAYBE; + } + + if (!pd->rotate_st.cur.timestamp) /* Now scan touched-devices list + * and find other finger */ + { + if (!_event_multi_touch_get(event)) + return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE; + pd->base_angle = NEGATIVE_ANGLE; + val = _recognizer_config_get(obj, "glayer_rotate_angular_tolerance"); + if (val) eina_value_get(val, &pd->rotate_angular_tolerance); + else pd->rotate_angular_tolerance = 2.0; + + memcpy(&pd->rotate_st, p2, sizeof(Efl_Gesture_Touch_Point_Data)); + memcpy(&pd->rotate_st1, p1, sizeof(Efl_Gesture_Touch_Point_Data)); + + memcpy(&pd->rotate_mv, p2, sizeof(Efl_Gesture_Touch_Point_Data)); + memcpy(&pd->rotate_mv1, p1, sizeof(Efl_Gesture_Touch_Point_Data)); + + _rotate_properties_get(pd, gd, + pd->rotate_st.cur.pos.x, pd->rotate_st.cur.pos.y, + pd->rotate_st1.cur.pos.x, pd->rotate_st1.cur.pos.y, + &pd->base_angle, EINA_TRUE); + if ((efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_STARTED) && + (efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_UPDATED)) + return EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER; + + return EFL_GESTURE_RECOGNIZER_RESULT_CANCEL; + } + + if (p2->id == pd->rotate_mv.id) + memcpy(&pd->rotate_mv, p2, sizeof(Efl_Gesture_Touch_Point_Data)); + else if (p2->id == pd->rotate_mv1.id) + memcpy(&pd->rotate_mv1, p2, sizeof(Efl_Gesture_Touch_Point_Data)); + + _rotate_properties_get(pd, gd, + pd->rotate_mv.cur.pos.x, pd->rotate_mv.cur.pos.y, + pd->rotate_mv1.cur.pos.x, pd->rotate_mv1.cur.pos.y, + &gd->angle, EINA_FALSE); + + if (_on_rotation_broke_tolerance(pd, gd)) /* Rotation broke + * tolerance, report + * move */ + { + double d = gd->angle - pd->next_step; + + if (d < 0.0) d = (-d); + + if (d >= pd->rotate_step) + { + pd->next_step = gd->angle; + + return EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER; + } + } + + return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE; + } + + case EFL_GESTURE_TOUCH_STATE_END: + { + /* no gesture was started, so no gesture should be detected */ + if ((td->touch_down == 0) || (!pd->rotate_st.cur.timestamp)) + { + rd->continues = EINA_FALSE; + + _reset_recognizer(pd); + efl_gesture_manager_recognizer_cleanup(efl_provider_find(obj, EFL_CANVAS_GESTURE_MANAGER_CLASS), obj, watched); + + return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE; + } + _reset_recognizer(pd); + if (pd->rotate_angular_tolerance < 0) + { + return EFL_GESTURE_RECOGNIZER_RESULT_FINISH; + } + + if (efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_NONE) + { + return EFL_GESTURE_RECOGNIZER_RESULT_CANCEL; + } + } + + default: + + break; + } + + return result; +} + +#include "efl_canvas_gesture_recognizer_rotate.eo.c" diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_rotate.eo b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_rotate.eo new file mode 100644 index 0000000000..28291b3083 --- /dev/null +++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_rotate.eo @@ -0,0 +1,12 @@ +class @beta Efl.Canvas.Gesture_Recognizer_Rotate extends Efl.Canvas.Gesture_Recognizer +{ + [[This is the recognizer for Rotate gestures. + See @Efl.Canvas.Gesture_Rotate and @Efl.Canvas.Gesture_Recognizer. + For internal use only. + ]] + c_prefix: efl_gesture_recognizer_rotate; + implements { + Efl.Canvas.Gesture_Recognizer.type { get; } + Efl.Canvas.Gesture_Recognizer.recognize; + } +} diff --git a/src/lib/evas/gesture/efl_canvas_gesture_rotate.c b/src/lib/evas/gesture/efl_canvas_gesture_rotate.c new file mode 100644 index 0000000000..77351236f8 --- /dev/null +++ b/src/lib/evas/gesture/efl_canvas_gesture_rotate.c @@ -0,0 +1,17 @@ +#include "efl_canvas_gesture_private.h" + +#define MY_CLASS EFL_CANVAS_GESTURE_ROTATE_CLASS + +EOLIAN static unsigned int +_efl_canvas_gesture_rotate_radius_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Rotate_Data *pd) +{ + return pd->radius; +} + +EOLIAN static double +_efl_canvas_gesture_rotate_angle_get(const Eo *obj EINA_UNUSED, Efl_Canvas_Gesture_Rotate_Data *pd) +{ + return pd->angle; +} + +#include "efl_canvas_gesture_rotate.eo.c" diff --git a/src/lib/evas/gesture/efl_canvas_gesture_rotate.eo b/src/lib/evas/gesture/efl_canvas_gesture_rotate.eo new file mode 100644 index 0000000000..8cd35f8661 --- /dev/null +++ b/src/lib/evas/gesture/efl_canvas_gesture_rotate.eo @@ -0,0 +1,28 @@ +class @beta Efl.Canvas.Gesture_Rotate extends Efl.Canvas.Gesture +{ + [[Rotate gesture class holding state information. + See @Efl.Canvas.Gesture to see what this state is and + @[Efl.Canvas.Gesture_Events.gesture,rotate] for a description of the Rotate gesture. + + Application developers receive these objects inside a gesture event and do not typically need to create their own. + ]] + c_prefix: efl_gesture_rotate; + methods { + @property radius { + [[The current radius (i.e. the distance between the two fingers) of the gesture.]] + get { + } + values { + radius: uint; [[The radius value in pixels.]] + } + } + @property angle { + [[The current angle of rotation for this gesture.]] + get { + } + values { + rotate: double; [[The angle of the rotation. $[0.0] means no rotation has occurred.]] + } + } + } +} diff --git a/src/lib/evas/gesture/meson.build b/src/lib/evas/gesture/meson.build index 7c2fc28a31..d57cdd0e94 100644 --- a/src/lib/evas/gesture/meson.build +++ b/src/lib/evas/gesture/meson.build @@ -7,6 +7,7 @@ pub_eo_files = [ 'efl_canvas_gesture_long_press.eo', 'efl_canvas_gesture_momentum.eo', 'efl_canvas_gesture_flick.eo', + 'efl_canvas_gesture_rotate.eo', 'efl_canvas_gesture_zoom.eo', 'efl_canvas_gesture_custom.eo', 'efl_canvas_gesture_recognizer.eo', @@ -16,6 +17,7 @@ pub_eo_files = [ 'efl_canvas_gesture_recognizer_long_press.eo', 'efl_canvas_gesture_recognizer_momentum.eo', 'efl_canvas_gesture_recognizer_flick.eo', + 'efl_canvas_gesture_recognizer_rotate.eo', 'efl_canvas_gesture_recognizer_zoom.eo', 'efl_canvas_gesture_recognizer_custom.eo', 'efl_canvas_gesture_manager.eo', @@ -71,6 +73,7 @@ evas_src += files([ 'efl_canvas_gesture_long_press.c', 'efl_canvas_gesture_momentum.c', 'efl_canvas_gesture_flick.c', + 'efl_canvas_gesture_rotate.c', 'efl_canvas_gesture_zoom.c', 'efl_canvas_gesture_custom.c', 'efl_canvas_gesture_recognizer.c', @@ -80,6 +83,7 @@ evas_src += files([ 'efl_canvas_gesture_recognizer_long_press.c', 'efl_canvas_gesture_recognizer_momentum.c', 'efl_canvas_gesture_recognizer_flick.c', + 'efl_canvas_gesture_recognizer_rotate.c', 'efl_canvas_gesture_recognizer_zoom.c', 'efl_canvas_gesture_recognizer_custom.c', 'efl_canvas_gesture_manager.c', From 3603884e51daf0cbb853b33a9a7fa6421bf2b7ff Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 20 Feb 2020 13:17:58 -0500 Subject: [PATCH 07/27] efl/gesture: fix internal gesture object management when a gesture ends and is not set to continue, the gesture object must be preserved until the entire touch sequence ends in order to ensure that all the touch point states are accurately detected and updated and so additional instances of that gesture are not accidentally triggered this fixes weird corner cases where you could tap with two fingers and then get a long press event while dragging the second finger around as long as you did it quickly enough Differential Revision: https://phab.enlightenment.org/D11384 --- .../evas/gesture/efl_canvas_gesture_manager.c | 26 +++++++------------ 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/lib/evas/gesture/efl_canvas_gesture_manager.c b/src/lib/evas/gesture/efl_canvas_gesture_manager.c index e33e3f2cb0..7a50a687f1 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_manager.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_manager.c @@ -251,8 +251,9 @@ _gesture_recognizer_process_internal(Efl_Canvas_Gesture_Manager_Data *pd, Efl_Ca Eo *target, const Efl_Event_Description *gesture_type, void *event) { Efl_Canvas_Gesture_Recognizer_Result recog_result; - Efl_Canvas_Gesture_Recognizer_Result recog_state; + Efl_Canvas_Gesture_Recognizer_Result recog_state = EFL_GESTURE_RECOGNIZER_RESULT_FINISH; Efl_Canvas_Gesture_Touch *touch_event; + Efl_Canvas_Gesture_Recognizer_Data *rd = efl_data_scope_get(recognizer, EFL_CANVAS_GESTURE_RECOGNIZER_CLASS); //If the gesture canceled or already finished by recognizer. Efl_Canvas_Gesture *gesture = _get_state(pd, target, recognizer, gesture_type); if (!gesture) return; @@ -272,7 +273,9 @@ _gesture_recognizer_process_internal(Efl_Canvas_Gesture_Manager_Data *pd, Efl_Ca //Such as the case of canceling gesture recognition after a mouse down. if (efl_gesture_touch_state_get(touch_event) == EFL_GESTURE_TOUCH_STATE_UNKNOWN) return; - + if ((!rd->continues) && ((efl_gesture_state_get(gesture) == EFL_GESTURE_STATE_CANCELED) || + (efl_gesture_state_get(gesture) == EFL_GESTURE_STATE_FINISHED))) + goto post_event; /* 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)); @@ -281,9 +284,6 @@ _gesture_recognizer_process_internal(Efl_Canvas_Gesture_Manager_Data *pd, Efl_Ca recog_result = efl_gesture_recognizer_recognize(recognizer, gesture, target, touch_event); recog_state = recog_result & EFL_GESTURE_RECOGNIZER_RESULT_RESULT_MASK; - Efl_Canvas_Gesture_Recognizer_Data *rd = - efl_data_scope_get(recognizer, EFL_CANVAS_GESTURE_RECOGNIZER_CLASS); - if (recog_state == EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER) { if (efl_gesture_state_get(gesture) == EFL_GESTURE_STATE_NONE) @@ -318,6 +318,10 @@ _gesture_recognizer_process_internal(Efl_Canvas_Gesture_Manager_Data *pd, Efl_Ca efl_gesture_timestamp_set(gesture, efl_gesture_touch_current_timestamp_get(touch_event)); efl_event_callback_call(target, gesture_type, gesture); post_event: + /* avoid destroying touch tracking before gesture has ended */ + if ((!rd->continues) && + ((efl_gesture_touch_state_get(touch_event) != EFL_GESTURE_TOUCH_STATE_END) || efl_gesture_touch_points_count_get(touch_event))) + return; //If the current event recognizes the gesture continuously, dont delete gesture. if (((recog_state == EFL_GESTURE_RECOGNIZER_RESULT_FINISH) || (recog_state == EFL_GESTURE_RECOGNIZER_RESULT_CANCEL)) && !rd->continues) @@ -448,8 +452,6 @@ _get_state(Efl_Canvas_Gesture_Manager_Data *pd, Eina_List *l; Object_Gesture *object_gesture; Efl_Canvas_Gesture *gesture; - Efl_Canvas_Gesture_Recognizer_Data *rd = - efl_data_scope_get(recognizer, EFL_CANVAS_GESTURE_RECOGNIZER_CLASS); //If the widget is being deleted we should be careful not to //Create a new state. @@ -463,16 +465,6 @@ _get_state(Efl_Canvas_Gesture_Manager_Data *pd, object_gesture->recognizer == recognizer && object_gesture->type == type) { - //The gesture is already processed waiting for cleanup - if (((efl_gesture_state_get(object_gesture->gesture) == EFL_GESTURE_STATE_FINISHED) || - (efl_gesture_state_get(object_gesture->gesture) == EFL_GESTURE_STATE_CANCELED)) && - (!rd->continues)) - { - _cleanup_cached_gestures(pd, target, type, recognizer); - eina_hash_del(pd->m_object_events, &recognizer, NULL); - _cleanup_object(pd->m_gestures_to_delete); - return NULL; - } return object_gesture->gesture; } } From e1b70206331dae6dea027e578459a8779e20ba4c Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 20 Feb 2020 13:20:32 -0500 Subject: [PATCH 08/27] efl/gesture: correctly filter tap events based on the processing touch point if the recognizer is processing using a touch point other than the first finger, e.g., in the case where multiple fingers are pressed simultaneously, then the recognizer needs to also detect distance based on that finger more fixes for triggering tap events while fingers are moving Differential Revision: https://phab.enlightenment.org/D11385 --- .../evas/gesture/efl_canvas_gesture_recognizer_double_tap.c | 4 ++-- .../evas/gesture/efl_canvas_gesture_recognizer_long_press.c | 4 ++-- src/lib/evas/gesture/efl_canvas_gesture_recognizer_tap.c | 2 +- .../evas/gesture/efl_canvas_gesture_recognizer_triple_tap.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) 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 c7b53110e2..123dbd551e 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 @@ -102,7 +102,7 @@ _efl_canvas_gesture_recognizer_double_tap_efl_canvas_gesture_recognizer_recogniz if (efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_NONE && !_event_multi_touch_get(event)) { - dist = efl_gesture_touch_distance(event, 0); + dist = efl_gesture_touch_distance(event, efl_gesture_touch_current_data_get(event)->id); length = fabs(dist.x) + fabs(dist.y); if (length > pd->finger_size) @@ -141,7 +141,7 @@ _efl_canvas_gesture_recognizer_double_tap_efl_canvas_gesture_recognizer_recogniz } } } - dist = efl_gesture_touch_distance(event, 0); + dist = efl_gesture_touch_distance(event, efl_gesture_touch_current_data_get(event)->id); length = fabs(dist.x) + fabs(dist.y); if (length <= pd->finger_size) diff --git a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_press.c b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_press.c index bcbe5bd592..e146c5acaf 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_press.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_long_press.c @@ -85,7 +85,7 @@ _efl_canvas_gesture_recognizer_long_press_efl_canvas_gesture_recognizer_recogniz case EFL_GESTURE_TOUCH_STATE_UPDATE: { - dist = efl_gesture_touch_distance(event, 0); + dist = efl_gesture_touch_distance(event, efl_gesture_touch_current_data_get(event)->id); length = fabs(dist.x) + fabs(dist.y); if ((_event_multi_touch_get(event)) || (length > pd->finger_size)) @@ -117,7 +117,7 @@ _efl_canvas_gesture_recognizer_long_press_efl_canvas_gesture_recognizer_recogniz if (efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_NONE && !_event_multi_touch_get(event)) { - dist = efl_gesture_touch_distance(event, 0); + dist = efl_gesture_touch_distance(event, efl_gesture_touch_current_data_get(event)->id); length = fabs(dist.x) + fabs(dist.y); if (length <= pd->finger_size && pd->is_timeout) { 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 eec8c34a22..f4c28879cb 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_tap.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_tap.c @@ -80,7 +80,7 @@ new_tap: if (_event_multi_touch_get(event)) return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE; if (efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_NONE) { - dist = efl_gesture_touch_distance(event, 0); + dist = efl_gesture_touch_distance(event, efl_gesture_touch_current_data_get(event)->id); length = fabs(dist.x) + fabs(dist.y); if (length <= pd->finger_size) { 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 f79aff5f71..75cb3686b4 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 @@ -101,7 +101,7 @@ _efl_canvas_gesture_recognizer_triple_tap_efl_canvas_gesture_recognizer_recogniz if (efl_gesture_state_get(gesture) != EFL_GESTURE_STATE_NONE && !_event_multi_touch_get(event)) { - dist = efl_gesture_touch_distance(event, 0); + dist = efl_gesture_touch_distance(event, efl_gesture_touch_current_data_get(event)->id); length = fabs(dist.x) + fabs(dist.y); if (length > pd->finger_size) @@ -140,7 +140,7 @@ _efl_canvas_gesture_recognizer_triple_tap_efl_canvas_gesture_recognizer_recogniz } } } - dist = efl_gesture_touch_distance(event, 0); + dist = efl_gesture_touch_distance(event, efl_gesture_touch_current_data_get(event)->id); length = fabs(dist.x) + fabs(dist.y); if (length <= pd->finger_size) From 322fdba5f093b14d6057171039567fc6cc35bf07 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 20 Feb 2020 13:22:47 -0500 Subject: [PATCH 09/27] efl/gesture: fix momentum gesture recognizer to properly continue its gestures it's not enough to just check the value for this in the recognizer; we need to always modify the recognizer property here to correctly manage object lifetimes and generate the correct events (e.g., not emitting momentum gestures while multiple fingers are moving simultaneously) also update a couple existing unit test checks which were wrong Differential Revision: https://phab.enlightenment.org/D11386 --- .../efl_canvas_gesture_recognizer_momentum.c | 30 ++++++++++++------- src/tests/elementary/efl_ui_test_gesture.c | 4 +-- 2 files changed, 22 insertions(+), 12 deletions(-) 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 0489147721..64afe22a2d 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_momentum.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_momentum.c @@ -67,6 +67,7 @@ _efl_canvas_gesture_recognizer_momentum_efl_canvas_gesture_recognizer_recognize( Eina_Value *val; unsigned char glayer_continues_enable; Efl_Canvas_Gesture_Recognizer_Result result = EFL_GESTURE_RECOGNIZER_RESULT_CANCEL; + Efl_Canvas_Gesture_Recognizer_Data *rd = efl_data_scope_get(obj, EFL_CANVAS_GESTURE_RECOGNIZER_CLASS); Efl_Canvas_Gesture_Momentum_Data *md = efl_data_scope_get(gesture, EFL_CANVAS_GESTURE_MOMENTUM_CLASS); val = _recognizer_config_get(obj, "glayer_continues_enable"); @@ -83,6 +84,7 @@ _efl_canvas_gesture_recognizer_momentum_efl_canvas_gesture_recognizer_recognize( if (efl_gesture_touch_points_count_get(event) == 1) { pd->touched = EINA_TRUE; + rd->continues = EINA_TRUE; md->id = -1; } } @@ -109,6 +111,7 @@ _efl_canvas_gesture_recognizer_momentum_efl_canvas_gesture_recognizer_recognize( if ((xdir != pd->xdir) || (ydir != pd->ydir)) { memset(pd, 0, sizeof(Efl_Canvas_Gesture_Recognizer_Momentum_Data)); + rd->continues = EINA_FALSE; return EFL_GESTURE_RECOGNIZER_RESULT_CANCEL; } return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE; @@ -124,20 +127,20 @@ _efl_canvas_gesture_recognizer_momentum_efl_canvas_gesture_recognizer_recognize( if (efl_gesture_touch_state_get(event) == EFL_GESTURE_TOUCH_STATE_BEGIN || glayer_continues_enable) { - if (efl_gesture_touch_previous_data_get(event)) - { - if (efl_gesture_touch_previous_data_get(event)->action == efl_gesture_touch_current_data_get(event)->action) - return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE; - } + pd->t_st = pd->t_end = efl_gesture_touch_current_timestamp_get(event); pd->st_line = pd->end_line = efl_gesture_touch_start_point_get(event); efl_gesture_hotspot_set(gesture, pd->st_line); - if (!glayer_continues_enable) - md->id = efl_gesture_touch_current_data_get(event)->id; - + md->id = efl_gesture_touch_current_data_get(event)->id; + if (efl_gesture_touch_previous_data_get(event)) + { + /* if multiple fingers are pressed simultaneously, start tracking the latest finger for gesture */ + if (efl_gesture_touch_previous_data_get(event)->action == efl_gesture_touch_current_data_get(event)->action) + return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE; + } return EFL_GESTURE_RECOGNIZER_RESULT_TRIGGER; } } @@ -186,11 +189,16 @@ _efl_canvas_gesture_recognizer_momentum_efl_canvas_gesture_recognizer_recognize( case EFL_GESTURE_TOUCH_STATE_END: { + Eina_Bool touched = !!efl_gesture_touch_points_count_get(event); if (!pd->t_st) { - pd->touched = EINA_FALSE; + Eina_Bool prev_touched = pd->touched; - return EFL_GESTURE_RECOGNIZER_RESULT_CANCEL; + rd->continues = pd->touched = touched; + + if (prev_touched) + return EFL_GESTURE_RECOGNIZER_RESULT_CANCEL; + return EFL_GESTURE_RECOGNIZER_RESULT_IGNORE; } if ((efl_gesture_touch_current_timestamp_get(event) - MOMENTUM_TIMEOUT) > pd->t_end) @@ -202,6 +210,7 @@ _efl_canvas_gesture_recognizer_momentum_efl_canvas_gesture_recognizer_recognize( pd->end_line = efl_gesture_touch_current_point_get(event); pd->t_end = efl_gesture_touch_current_timestamp_get(event); + rd->continues = touched; efl_gesture_hotspot_set(gesture, pd->end_line); if ((fabs(md->momentum.x) > EFL_GESTURE_MINIMUM_MOMENTUM) || @@ -211,6 +220,7 @@ _efl_canvas_gesture_recognizer_momentum_efl_canvas_gesture_recognizer_recognize( result = EFL_GESTURE_RECOGNIZER_RESULT_CANCEL; memset(pd, 0, sizeof(Efl_Canvas_Gesture_Recognizer_Momentum_Data)); + pd->touched = touched; break; } diff --git a/src/tests/elementary/efl_ui_test_gesture.c b/src/tests/elementary/efl_ui_test_gesture.c index c176818331..0efd168f68 100644 --- a/src/tests/elementary/efl_ui_test_gesture.c +++ b/src/tests/elementary/efl_ui_test_gesture.c @@ -481,7 +481,7 @@ EFL_START_TEST(test_efl_ui_gesture_zoom) CHECK_ALL(TRIPLE_TAP, 1, 0, 0, 1); CHECK_START(MOMENTUM, 1); - CHECK_UPDATE(MOMENTUM, moves * 2 + 1); + CHECK_UPDATE(MOMENTUM, 0); CHECK_FINISH(MOMENTUM, 0); CHECK_CANCEL(MOMENTUM, 1); @@ -509,7 +509,7 @@ EFL_START_TEST(test_efl_ui_gesture_zoom) CHECK_ALL(TRIPLE_TAP, 1, 0, 0, 1); CHECK_START(MOMENTUM, 1); - CHECK_UPDATE(MOMENTUM, moves * 2 + 1); + CHECK_UPDATE(MOMENTUM, 0); CHECK_FINISH(MOMENTUM, 0); CHECK_CANCEL(MOMENTUM, 1); From 613cd9f8122ec0afa081064bd6c61d02bf323140 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 20 Feb 2020 13:47:33 -0500 Subject: [PATCH 10/27] efl/gesture: fix flick internal touch id tracking need to always make sure we set this when a gesture is being tracked so we know which touch point we're watching Differential Revision: https://phab.enlightenment.org/D11387 --- src/lib/evas/gesture/efl_canvas_gesture_recognizer_flick.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 071d45f142..b113e612b0 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_recognizer_flick.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_recognizer_flick.c @@ -295,11 +295,12 @@ _efl_canvas_gesture_recognizer_flick_efl_canvas_gesture_recognizer_recognize(Eo switch (efl_gesture_touch_state_get(event)) { case EFL_GESTURE_TOUCH_STATE_BEGIN: - if (!glayer_continues_enable) - fd->id = efl_gesture_touch_current_data_get(event)->id; + fd->id = efl_gesture_touch_current_data_get(event)->id; EINA_FALLTHROUGH; case EFL_GESTURE_TOUCH_STATE_UPDATE: { + if (fd->id == -1) + fd->id = efl_gesture_touch_current_data_get(event)->id; if (pd->t_st) { if (glayer_continues_enable && pd->t_end) From 7f6dfbac809b250e2c9f25728b6fe77e2aca61fb Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 20 Feb 2020 13:16:51 -0500 Subject: [PATCH 11/27] tests/elm: fix drag_around helper to handle negative angles oops Differential Revision: https://phab.enlightenment.org/D11388 --- src/tests/elementary/suite_helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/elementary/suite_helpers.c b/src/tests/elementary/suite_helpers.c index 3deb5ff2bd..ea8164a642 100644 --- a/src/tests/elementary/suite_helpers.c +++ b/src/tests/elementary/suite_helpers.c @@ -731,7 +731,7 @@ drag_object_around(Eo *obj, int cx, int cy, int radius, int degrees) { Evas *e = evas_object_evas_get(obj); /* clamp num mouse moves to a vaguely sane value */ - int i, num = MIN(degrees, DRAG_OBJECT_AROUND_NUM_MOVES); + int i, num = MIN(abs(degrees), DRAG_OBJECT_AROUND_NUM_MOVES); int last_x = round(cx + radius); int last_y = round(cy); /* start at 0 degrees */ From db5fcd13db38115506ef1adcc4f795c14ee0d338 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 20 Feb 2020 13:24:52 -0500 Subject: [PATCH 12/27] tests/elm: add util function for doing a multi-press drag around same as existing function, but takes a finger id Differential Revision: https://phab.enlightenment.org/D11389 --- src/tests/elementary/suite_helpers.c | 26 ++++++++++++++++++++++++++ src/tests/elementary/suite_helpers.h | 1 + 2 files changed, 27 insertions(+) diff --git a/src/tests/elementary/suite_helpers.c b/src/tests/elementary/suite_helpers.c index ea8164a642..e31e302c9f 100644 --- a/src/tests/elementary/suite_helpers.c +++ b/src/tests/elementary/suite_helpers.c @@ -754,6 +754,32 @@ drag_object_around(Eo *obj, int cx, int cy, int radius, int degrees) return num; } +int +multi_drag_object_around(Eo *obj, int touch_point, int cx, int cy, int radius, int degrees) +{ + Evas *e = evas_object_evas_get(obj); + /* clamp num mouse moves to a vaguely sane value */ + int i, num = MIN(abs(degrees), DRAG_OBJECT_AROUND_NUM_MOVES); + int last_x = round(cx + radius); + int last_y = round(cy); + /* start at 0 degrees */ + evas_event_feed_multi_down(e, touch_point, last_x, last_y, 1, 1, 1, 1, 0, last_x, last_y, 0, ts++, NULL); + for (i = 1; i < num; i++) + { + /* x = cx + r * cos(a), y = cy + r * sin(a) */ + int ax, ay; + /* each iteration is 1 degree */ + double angle = (i * (degrees / DRAG_OBJECT_AROUND_NUM_MOVES)) * M_PI / 180.0; + ax = round(cx + radius * cos(angle)); + ay = round(cy + radius * sin(angle)); + if ((ax == last_x) && (ay == last_y)) continue; + evas_event_feed_multi_move(e, touch_point, ax, ay, 1, 1, 1, 1, 0, ax, ay, ts++, NULL); + last_x = ax, last_y = ay; + } + evas_event_feed_multi_up(e, touch_point, last_x, last_y, 1, 1, 1, 1, 0, last_x, last_y, 0, ts++, NULL); + /* only count arc motion: subtract initial move, mouse down, mouse up */ + return num; +} int pinch_object(Eo *obj, int x, int y, int x2, int y2, int dx, int dy, int dx2, int dy2) diff --git a/src/tests/elementary/suite_helpers.h b/src/tests/elementary/suite_helpers.h index 1a028e5683..2a8e1d23e0 100644 --- a/src/tests/elementary/suite_helpers.h +++ b/src/tests/elementary/suite_helpers.h @@ -34,6 +34,7 @@ void multi_click_object(Eo *obj, int ids); void multi_press_object(Eo *obj, int ids); void multi_click_object_at(Eo *obj, int x, int y, int ids); void multi_press_object_at(Eo *obj, int x, int y, int ids); +int multi_drag_object_around(Eo *obj, int touch_point, int cx, int cy, int radius, int degrees); void drag_object(Eo *obj, int x, int y, int dx, int dy, Eina_Bool iterate); int drag_object_around(Eo *obj, int cx, int cy, int radius, int degrees); int pinch_object(Eo *obj, int x, int y, int x2, int y2, int dx, int dy, int dx2, int dy2); From 6aa9299cc9a55d3cfdb7a9b4dd0caf0739c32923 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 19 Feb 2020 12:57:26 -0500 Subject: [PATCH 13/27] tests/gesture: verify rotate gesture event counting in existing tests these magically pass already Differential Revision: https://phab.enlightenment.org/D11390 --- src/tests/elementary/efl_ui_test_gesture.c | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/tests/elementary/efl_ui_test_gesture.c b/src/tests/elementary/efl_ui_test_gesture.c index 0efd168f68..4d96297c9e 100644 --- a/src/tests/elementary/efl_ui_test_gesture.c +++ b/src/tests/elementary/efl_ui_test_gesture.c @@ -31,6 +31,7 @@ enum TRIPLE_TAP, MOMENTUM, FLICK, + ROTATE, ZOOM, CUSTOM, CUSTOM2, @@ -92,6 +93,7 @@ setup(void) WATCH(TRIPLE_TAP); WATCH(MOMENTUM); WATCH(FLICK); + WATCH(ROTATE); WATCH(ZOOM); get_me_to_those_events(win); @@ -110,6 +112,7 @@ EFL_START_TEST(test_efl_ui_gesture_taps) CHECK_ALL(TRIPLE_TAP, 1, 1, 0, 0); CHECK_ZERO(MOMENTUM); CHECK_ZERO(FLICK); + CHECK_ZERO(ROTATE); CHECK_ZERO(ZOOM); RESET; @@ -123,6 +126,7 @@ EFL_START_TEST(test_efl_ui_gesture_taps) CHECK_ALL(TRIPLE_TAP, 0, 2, 0, 0); CHECK_ZERO(MOMENTUM); CHECK_ZERO(FLICK); + CHECK_ZERO(ROTATE); CHECK_ZERO(ZOOM); RESET; @@ -136,6 +140,7 @@ EFL_START_TEST(test_efl_ui_gesture_taps) CHECK_ALL(TRIPLE_TAP, 0, 1, 1, 0); CHECK_ZERO(MOMENTUM); CHECK_ZERO(FLICK); + CHECK_ZERO(ROTATE); CHECK_ZERO(ZOOM); /* clear states */ @@ -152,6 +157,7 @@ EFL_START_TEST(test_efl_ui_gesture_taps) CHECK_ALL(TRIPLE_TAP, 1, 3, 0, 0); CHECK_ZERO(MOMENTUM); CHECK_ZERO(FLICK); + CHECK_ZERO(ROTATE); CHECK_ZERO(ZOOM); /* clear states */ @@ -166,6 +172,8 @@ EFL_START_TEST(test_efl_ui_gesture_taps) CHECK_ALL(TRIPLE_TAP, 1, 1, 0, 0); CHECK_ZERO(MOMENTUM); CHECK_ZERO(FLICK); + /* this is two fingers, so we have a rotate start */ + CHECK_ALL(ROTATE, 1, 0, 0, 1); /* this is two fingers, so we have a zoom start */ CHECK_ALL(ZOOM, 1, 0, 0, 1); @@ -179,6 +187,8 @@ EFL_START_TEST(test_efl_ui_gesture_taps) CHECK_ALL(TRIPLE_TAP, 0, 2, 0, 0); CHECK_ZERO(MOMENTUM); CHECK_ZERO(FLICK); + /* this is two fingers, so we have a rotate start */ + CHECK_ALL(ROTATE, 1, 0, 0, 1); /* this is two fingers, so we have a zoom start */ CHECK_ALL(ZOOM, 1, 0, 0, 1); @@ -192,6 +202,8 @@ EFL_START_TEST(test_efl_ui_gesture_taps) CHECK_ALL(TRIPLE_TAP, 0, 1, 1, 0); CHECK_ZERO(MOMENTUM); CHECK_ZERO(FLICK); + /* this is two fingers, so we have a rotate start */ + CHECK_ALL(ROTATE, 1, 0, 0, 1); /* this is two fingers, so we have a zoom start */ CHECK_ALL(ZOOM, 1, 0, 0, 1); /* clear states */ @@ -205,6 +217,8 @@ EFL_START_TEST(test_efl_ui_gesture_taps) CHECK_ALL(TRIPLE_TAP, 1, 0, 0, 1); CHECK_ZERO(MOMENTUM); CHECK_ZERO(FLICK); + /* this is two fingers, so we have a rotate start */ + CHECK_ALL(ROTATE, 1, 0, 0, 1); /* this is two fingers, so we have a zoom start */ CHECK_ALL(ZOOM, 1, 0, 0, 1); RESET; @@ -230,6 +244,7 @@ EFL_START_TEST(test_efl_ui_gesture_long_press) CHECK_ALL(TRIPLE_TAP, 1, 0, 0, 0); CHECK_ZERO(MOMENTUM); CHECK_ZERO(FLICK); + CHECK_ZERO(ROTATE); CHECK_ZERO(ZOOM); RESET; @@ -243,6 +258,7 @@ EFL_START_TEST(test_efl_ui_gesture_long_press) CHECK_ALL(TRIPLE_TAP, 0, 0, 0, 1); CHECK_ZERO(MOMENTUM); CHECK_ZERO(FLICK); + CHECK_ZERO(ROTATE); CHECK_ZERO(ZOOM); RESET; @@ -254,6 +270,7 @@ EFL_START_TEST(test_efl_ui_gesture_long_press) CHECK_ZERO(TRIPLE_TAP); CHECK_ZERO(MOMENTUM); CHECK_ZERO(FLICK); + CHECK_ZERO(ROTATE); CHECK_ZERO(ZOOM); RESET; @@ -272,6 +289,7 @@ EFL_START_TEST(test_efl_ui_gesture_long_press) CHECK_ALL(TRIPLE_TAP, 0, 0, 0, 1); CHECK_ALL(MOMENTUM, 1, 0, 0, 0); CHECK_ALL(FLICK, 1, 0, 0, 0); + CHECK_ZERO(ROTATE); CHECK_ZERO(ZOOM); RESET; @@ -301,6 +319,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick) CHECK_ALL(MOMENTUM, 1, DRAG_OBJECT_NUM_MOVES - 1, 0, 1); /* triggered */ CHECK_ALL(FLICK, 1, DRAG_OBJECT_NUM_MOVES - 1, 1, 0); + CHECK_ZERO(ROTATE); CHECK_ZERO(ZOOM); RESET; @@ -322,6 +341,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick) CHECK_ALL(MOMENTUM, 1, DRAG_OBJECT_NUM_MOVES - 1, 0, 1); /* triggered */ CHECK_ALL(FLICK, 1, DRAG_OBJECT_NUM_MOVES - 1, 1, 0); + CHECK_ZERO(ROTATE); CHECK_ZERO(ZOOM); RESET; @@ -340,6 +360,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick) CHECK_ALL(MOMENTUM, 1, DRAG_OBJECT_NUM_MOVES - 1, 0, 1); /* triggered */ CHECK_ALL(FLICK, 1, DRAG_OBJECT_NUM_MOVES - 1, 1, 0); + CHECK_ZERO(ROTATE); CHECK_ZERO(ZOOM); RESET; @@ -358,6 +379,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick) CHECK_ALL(MOMENTUM, 1, DRAG_OBJECT_NUM_MOVES - 1, 0, 1); /* triggered */ CHECK_ALL(FLICK, 1, DRAG_OBJECT_NUM_MOVES - 1, 1, 0); + CHECK_ZERO(ROTATE); CHECK_ZERO(ZOOM); RESET; @@ -377,6 +399,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick) CHECK_ALL(MOMENTUM, 1, DRAG_OBJECT_NUM_MOVES - 1, 0, 1); /* triggered */ CHECK_ALL(FLICK, 1, DRAG_OBJECT_NUM_MOVES - 1, 1, 0); + CHECK_ZERO(ROTATE); CHECK_ZERO(ZOOM); RESET; @@ -397,6 +420,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick) CHECK_START(FLICK, 1); CHECK_FINISH(FLICK, 1); CHECK_CANCEL(FLICK, 0); + CHECK_ZERO(ROTATE); CHECK_ZERO(ZOOM); RESET; @@ -413,6 +437,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick) CHECK_ALL(MOMENTUM, 1, moves - 2, 1, 0); /* NOT triggered; this is going to have some crazy number of update events since it ignores a bunch */ CHECK_FINISH(FLICK, 0); + CHECK_ZERO(ROTATE); CHECK_ZERO(ZOOM); RESET; @@ -436,6 +461,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick) CHECK_FINISH(FLICK, 0); /* flick checks a tolerance value for straight lines, so "start" will be >= 1 */ ck_assert_int_ge(count[FLICK][EFL_GESTURE_STATE_CANCELED - 1], 1); + CHECK_ZERO(ROTATE); CHECK_ZERO(ZOOM); RESET; @@ -459,6 +485,7 @@ EFL_START_TEST(test_efl_ui_gesture_flick) CHECK_FINISH(FLICK, 0); /* flick checks a tolerance value for straight lines, so "start" will be >= 1 */ ck_assert_int_ge(count[FLICK][EFL_GESTURE_STATE_CANCELED - 1], 1); + CHECK_ZERO(ROTATE); CHECK_ZERO(ZOOM); RESET; @@ -487,6 +514,8 @@ EFL_START_TEST(test_efl_ui_gesture_zoom) /* only finish is verifiable */ CHECK_FINISH(FLICK, 0); + /* started then canceled */ + CHECK_ALL(ROTATE, 1, 0, 0, 1); /* started 1x */ CHECK_START(ZOOM, 1); /* 2 touch points tracked, so this will be roughly (2 * moves) but probably less */ @@ -515,6 +544,8 @@ EFL_START_TEST(test_efl_ui_gesture_zoom) /* only finish is verifiable */ CHECK_FINISH(FLICK, 0); + /* started then canceled */ + CHECK_ALL(ROTATE, 1, 0, 0, 1); /* started 1x */ CHECK_START(ZOOM, 1); /* 2 touch points tracked, so this will be roughly (2 * moves) but probably less */ From 6d9f8416e7237134d0092ce740135de6c3df4ed6 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 20 Feb 2020 13:48:14 -0500 Subject: [PATCH 14/27] tests/gesture: add a couple rotate gesture tests these end up triggering a lot of corner cases in other recognizers too, but the tests themselves are fairly minimal Differential Revision: https://phab.enlightenment.org/D11391 --- src/tests/elementary/efl_ui_test_gesture.c | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/src/tests/elementary/efl_ui_test_gesture.c b/src/tests/elementary/efl_ui_test_gesture.c index 4d96297c9e..fccbdd62fb 100644 --- a/src/tests/elementary/efl_ui_test_gesture.c +++ b/src/tests/elementary/efl_ui_test_gesture.c @@ -559,6 +559,71 @@ EFL_START_TEST(test_efl_ui_gesture_zoom) } EFL_END_TEST +EFL_START_TEST(test_efl_ui_gesture_rotate) +{ + Eo *rect = setup(); + int moves, momentum_moves; + + multi_press_object(rect, 1); + CHECK_ALL(TAP, 1, 0, 0, 0); + CHECK_ALL(LONG_PRESS, 1, 0, 0, 0); + CHECK_ALL(DOUBLE_TAP, 1, 0, 0, 0); + CHECK_ALL(TRIPLE_TAP, 1, 0, 0, 0); + + CHECK_ZERO(MOMENTUM); + CHECK_ZERO(FLICK); + CHECK_ZERO(ROTATE); + CHECK_ZERO(ZOOM); + + RESET; + + + moves = multi_drag_object_around(rect, 1, 500, 500, 250, 180); + CHECK_ALL(TAP, 0, 0, 0, 1); + CHECK_ALL(LONG_PRESS, 0, 0, 0, 1); + CHECK_ALL(DOUBLE_TAP, 0, 0, 0, 1); + CHECK_ALL(TRIPLE_TAP, 0, 0, 0, 1); + + CHECK_START(MOMENTUM, 1); + momentum_moves = count[MOMENTUM][EFL_GESTURE_STATE_UPDATED - 1]; + ck_assert_int_ge(count[MOMENTUM][EFL_GESTURE_STATE_UPDATED - 1], moves - 5); + CHECK_FINISH(MOMENTUM, 1); + CHECK_CANCEL(MOMENTUM, 0); + + /* flick is just going to do flick stuff here, so don't even bother checking much */ + CHECK_FINISH(FLICK, 0); + + CHECK_ALL(ROTATE, 1, moves - 1, 1, 0); + CHECK_ALL(ZOOM, 1, 0, 0, 1); + + RESET; + + /* verify identical motion in reverse */ + moves = multi_drag_object_around(rect, 1, 500, 500, 250, -180); + /* already occurred, first finger still down */ + CHECK_ZERO(TAP); + /* already canceled, first finger still down */ + CHECK_ZERO(LONG_PRESS); + CHECK_ZERO(DOUBLE_TAP); + CHECK_ZERO(TRIPLE_TAP); + + /* continuing gesture, counts as already started */ + CHECK_START(MOMENTUM, 0); + /* should be exactly 1 more than previous time */ + CHECK_UPDATE(MOMENTUM, momentum_moves + 1); + CHECK_FINISH(MOMENTUM, 1); + CHECK_CANCEL(MOMENTUM, 0); + + /* flick is just going to do flick stuff here, so don't even bother checking much */ + CHECK_FINISH(FLICK, 0); + + /* continuing gesture, counts as already started, increment update counter */ + CHECK_ALL(ROTATE, 0, (moves - 1) + 1, 1, 0); + CHECK_ALL(ZOOM, 0, 1, 0, 1); + +} +EFL_END_TEST + static void custom_cb(void *data EINA_UNUSED , const Efl_Event *ev) { @@ -658,5 +723,6 @@ void efl_ui_test_gesture(TCase *tc) tcase_add_test(tc, test_efl_ui_gesture_long_press); tcase_add_test(tc, test_efl_ui_gesture_flick); tcase_add_test(tc, test_efl_ui_gesture_zoom); + tcase_add_test(tc, test_efl_ui_gesture_rotate); tcase_add_test(tc, test_efl_ui_gesture_custom); } From 710c05ed5ae8d470c9efd2f15b059144672fc6ab Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 20 Feb 2020 13:55:40 -0500 Subject: [PATCH 15/27] efl/gesture: deduplicate some code also remove a misleading comment no functional changes Differential Revision: https://phab.enlightenment.org/D11395 --- .../evas/gesture/efl_canvas_gesture_manager.c | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/lib/evas/gesture/efl_canvas_gesture_manager.c b/src/lib/evas/gesture/efl_canvas_gesture_manager.c index 7a50a687f1..a05794fd91 100644 --- a/src/lib/evas/gesture/efl_canvas_gesture_manager.c +++ b/src/lib/evas/gesture/efl_canvas_gesture_manager.c @@ -246,6 +246,15 @@ _efl_canvas_gesture_manager_callback_del_hook(void *data, Eo *target, const Efl_ } } +static void +_recognizer_cleanup_internal(Efl_Canvas_Gesture_Manager_Data *pd, const Efl_Canvas_Gesture_Recognizer *recognizer, const Eo *target, const Efl_Event_Description *type) +{ + _cleanup_cached_gestures(pd, target, type, recognizer); + eina_hash_del(pd->m_object_events, &recognizer, NULL); + //FIXME: delete it by object not list. + _cleanup_object(pd->m_gestures_to_delete); +} + static void _gesture_recognizer_process_internal(Efl_Canvas_Gesture_Manager_Data *pd, Efl_Canvas_Gesture_Recognizer *recognizer, Eo *target, const Efl_Event_Description *gesture_type, void *event) @@ -325,12 +334,7 @@ post_event: //If the current event recognizes the gesture continuously, dont delete gesture. if (((recog_state == EFL_GESTURE_RECOGNIZER_RESULT_FINISH) || (recog_state == EFL_GESTURE_RECOGNIZER_RESULT_CANCEL)) && !rd->continues) - { - _cleanup_cached_gestures(pd, target, gesture_type, recognizer); - eina_hash_del(pd->m_object_events, &recognizer, NULL); - //FIXME: delete it by object not list. - _cleanup_object(pd->m_gestures_to_delete); - } + _recognizer_cleanup_internal(pd, recognizer, target, gesture_type); } void @@ -514,9 +518,7 @@ _efl_canvas_gesture_manager_recognizer_cleanup(Eo *obj EINA_UNUSED, Efl_Canvas_G //Find the type of the recognizer type = _gesture_recognizer_event_type_get(recognizer); - _cleanup_cached_gestures(pd, target, type, recognizer); - eina_hash_del(pd->m_object_events, &recognizer, NULL); - _cleanup_object(pd->m_gestures_to_delete); + _recognizer_cleanup_internal(pd, recognizer, target, type); } #include "efl_canvas_gesture_manager.eo.c" From 677b507281103ccd1d761641fc81338abef6b364 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 2 Mar 2020 10:23:31 -0500 Subject: [PATCH 16/27] tests/gesture: add test for gesture sequence ensure that tap continues working after complex gestures Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D11440 --- src/tests/elementary/efl_ui_test_gesture.c | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/tests/elementary/efl_ui_test_gesture.c b/src/tests/elementary/efl_ui_test_gesture.c index fccbdd62fb..0805cd82ee 100644 --- a/src/tests/elementary/efl_ui_test_gesture.c +++ b/src/tests/elementary/efl_ui_test_gesture.c @@ -717,6 +717,46 @@ EFL_START_TEST(test_efl_ui_gesture_custom) } EFL_END_TEST + +EFL_START_TEST(test_efl_ui_gesture_sequence) +{ + Eo *rect = setup(); + int moves; + + multi_click_object(rect, 1); + CHECK_ALL(TAP, 1, 0, 1, 0); + + wait_timer(0.4); + RESET; + + moves = pinch_object(rect, 500, 500, 501, 501, -250, 0, 250, 0); + /* canceled */ + CHECK_ALL(TAP, 1, 0, 0, 1); + /* canceled */ + CHECK_ALL(LONG_PRESS, 1, 0, 0, 1); + /* canceled */ + CHECK_ALL(DOUBLE_TAP, 1, 0, 0, 1); + /* canceled */ + CHECK_ALL(TRIPLE_TAP, 1, 0, 0, 1); + + + CHECK_START(ZOOM, 1); + /* 2 touch points tracked, so this will be roughly (2 * moves) but probably less */ + ck_assert_int_ge(count[ZOOM][EFL_GESTURE_STATE_UPDATED - 1], moves); + /* finished 1x */ + CHECK_FINISH(ZOOM, 1); + CHECK_CANCEL(ZOOM, 0); + + wait_timer(0.4); + RESET; + + multi_click_object(rect, 1); + CHECK_ALL(TAP, 1, 0, 1, 0); + + RESET; +} +EFL_END_TEST + void efl_ui_test_gesture(TCase *tc) { tcase_add_test(tc, test_efl_ui_gesture_taps); @@ -725,4 +765,5 @@ void efl_ui_test_gesture(TCase *tc) tcase_add_test(tc, test_efl_ui_gesture_zoom); tcase_add_test(tc, test_efl_ui_gesture_rotate); tcase_add_test(tc, test_efl_ui_gesture_custom); + tcase_add_test(tc, test_efl_ui_gesture_sequence); } From 57adf37303bac3e2cfdd5e25fddd4fe39ae284c9 Mon Sep 17 00:00:00 2001 From: Stefan Schmidt Date: Mon, 2 Mar 2020 16:40:38 +0100 Subject: [PATCH 17/27] tests_: elementary: free memory in error path Make sure we free the iterator here as well. CID: 1409658 Signed-off-by: Stefan Schmidt Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D11441 --- src/tests/elementary/spec/efl_test_basics.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tests/elementary/spec/efl_test_basics.c b/src/tests/elementary/spec/efl_test_basics.c index 2774b2ae8f..603c094ce0 100644 --- a/src/tests/elementary/spec/efl_test_basics.c +++ b/src/tests/elementary/spec/efl_test_basics.c @@ -67,7 +67,12 @@ EFL_START_TEST(no_leaking_canvas_object) Eina_Iterator *iter = eo_objects_iterator_new(); Eo *obj; - if (efl_isa(widget, EFL_UI_FLIP_CLASS)) return; //FIXME Flip needs more work for this. However, flip should be redone as a spotlight manager, When this is done, we can add these classes to the check here. + if (efl_isa(widget, EFL_UI_FLIP_CLASS)) + { + //FIXME Flip needs more work for this. However, flip should be redone as a spotlight manager, When this is done, we can add these classes to the check here. + eina_iterator_free(iter); + return; + } EINA_ITERATOR_FOREACH(iter, obj) { From 120c0e4032cd1239d17f76f4dd60692cb6f72b5f Mon Sep 17 00:00:00 2001 From: Stefan Schmidt Date: Mon, 2 Mar 2020 16:46:19 +0100 Subject: [PATCH 18/27] tests_: elementary: remove not used allocation in collection view test Allocated but never used (and never freed). Seems like a copy and paste bug to me. CID: 1412363 Signed-off-by: Stefan Schmidt Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D11442 --- src/tests/elementary/efl_ui_test_collection_view.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/tests/elementary/efl_ui_test_collection_view.c b/src/tests/elementary/efl_ui_test_collection_view.c index 5471deaad4..9e9f91b48e 100644 --- a/src/tests/elementary/efl_ui_test_collection_view.c +++ b/src/tests/elementary/efl_ui_test_collection_view.c @@ -45,12 +45,8 @@ static Eina_Value _children_get(Eo *obj EINA_UNUSED, void *data EINA_UNUSED, const Eina_Value v) { Efl_Model *child; - Eina_Future **all; unsigned int i, len; - all = calloc(1 + 1, sizeof(Eina_Future*)); - if (!all) return eina_value_error_init(ENOMEM); - EINA_VALUE_ARRAY_FOREACH(&v, len, i, child) { Eina_Value *rel_val, *title_val; From 146cf9da7e917d1d9e282a7378258d98610057d0 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Tue, 3 Mar 2020 19:17:29 +0900 Subject: [PATCH 19/27] evas: ++safety by prevent invalid accesses. --- src/lib/evas/canvas/evas_object_intercept.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/evas/canvas/evas_object_intercept.c b/src/lib/evas/canvas/evas_object_intercept.c index 9911a5b1f3..fd904f7708 100644 --- a/src/lib/evas/canvas/evas_object_intercept.c +++ b/src/lib/evas/canvas/evas_object_intercept.c @@ -16,7 +16,7 @@ static void evas_object_intercept_init(Evas_Object *eo_obj) { Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); - if (!obj->interceptors) + if (!obj || !obj->interceptors) obj->interceptors = calloc(1, sizeof(Evas_Intercept_Func)); } @@ -24,7 +24,7 @@ static void evas_object_intercept_deinit(Evas_Object *eo_obj) { Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); - if (!obj->interceptors) return; + if (!obj || !obj->interceptors) return; if ((obj->interceptors->show.func) || (obj->interceptors->hide.func) || (obj->interceptors->move.func) || From f6f4c1fcc8ced945e9f5ea9294037a98ea98ee1f Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 3 Mar 2020 12:27:43 -0500 Subject: [PATCH 20/27] efl-wl: add function to get pid of a surface Summary: this is useful for tracking surfaces of specific clients Reviewers: bu5hm4n, devilhorns Reviewed By: devilhorns Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11438 --- src/lib/efl_wl/Efl_Wl.h | 11 +++++++++++ src/lib/efl_wl/efl_wl.c | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/lib/efl_wl/Efl_Wl.h b/src/lib/efl_wl/Efl_Wl.h index 62f43e0d2b..3bf4aeea20 100644 --- a/src/lib/efl_wl/Efl_Wl.h +++ b/src/lib/efl_wl/Efl_Wl.h @@ -177,6 +177,17 @@ EAPI void *efl_wl_global_add(Evas_Object *obj, const void *interface, uint32_t v */ EAPI Eina_Bool efl_wl_surface_extract(Evas_Object *surface); +/** + * Return the pid for the surface's client + * + * Get the pid of the underlying client that created the surface. + * + * @param surface The surface to extract + * @return The pid of the surface, or -1 on failure + * @since 1.24 + */ +EAPI int32_t efl_wl_surface_pid_get(Evas_Object *surface); + /** * Get the Evas_Object for an extracted wl_surface resource created by an efl_wl object * diff --git a/src/lib/efl_wl/efl_wl.c b/src/lib/efl_wl/efl_wl.c index d872a4a426..4b1afa64ec 100644 --- a/src/lib/efl_wl/efl_wl.c +++ b/src/lib/efl_wl/efl_wl.c @@ -5909,6 +5909,18 @@ extracted_changed(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event shell_surface_send_configure(data); } +int32_t +efl_wl_surface_pid_get(Evas_Object *surface) +{ + Comp_Surface *cs; + int32_t pid; + if (!eina_streq(evas_object_type_get(surface), "comp_surface")) abort(); + cs = evas_object_smart_data_get(surface); + EINA_SAFETY_ON_TRUE_RETURN_VAL(cs->dead, -1); + wl_client_get_credentials(wl_resource_get_client(cs->res), &pid, NULL, NULL); + return pid; +} + Eina_Bool efl_wl_surface_extract(Evas_Object *surface) { From 9aecf76824a614a951e0b2eb826457fe9e174d1f Mon Sep 17 00:00:00 2001 From: Xavi Artigas Date: Tue, 3 Mar 2020 11:09:47 +0100 Subject: [PATCH 21/27] doxygen docs: fix multiple defined @section's Section names must be globally unique. We rarely reference sections so we don't actually need to use @section and a simple header suffices. --- doc/ephysics_examples.dox | 48 ++++++++++++++++----------------- src/bin/edje/edje_cc_handlers.c | 4 +-- src/lib/emotion/Emotion.h | 2 +- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/doc/ephysics_examples.dox b/doc/ephysics_examples.dox index cddf3c8bdf..6d99ed78ee 100644 --- a/doc/ephysics_examples.dox +++ b/doc/ephysics_examples.dox @@ -196,7 +196,7 @@ /** * @page test_bouncing_ball_c test_bouncing_ball.c * - * @section ephysics-test-h ephysics_test.h + * # ephysics_test.h * @include ephysics_test.h * * @section test-bouncing-ball-c test_bouncing_ball.c @@ -271,7 +271,7 @@ /** * @page test_bouncing_text_c test_bouncing_text.c * - * @section ephysics-test-h ephysics_test.h + * # ephysics_test.h * @include ephysics_test.h * * @section test-bouncing_text-c test_bouncing_text.c @@ -323,7 +323,7 @@ * @skip struct _Camera_Data { * @until }; * - * @section add-camera Adding a Camera + * # Adding a Camera * * To move the camera in this example, we'll use an animator. * @@ -355,7 +355,7 @@ * @until ephysics_camera_position_set(camera, x, y * @skipline } * - * @section add-uptfloor Updating the floor + * # Updating the floor * * Here we'll use 2 floor images to give the impression of an infinite ground. * @@ -402,7 +402,7 @@ /** * @page test_camera_c test_camera.c * - * @section ephysics-test-h ephysics_test.h + * # ephysics_test.h * @include ephysics_test.h * * @section test-camera-c test_camera.c @@ -454,7 +454,7 @@ * @skip struct _Track_Data { * @until }; * - * @section add-camera Adding a Camera + * # Adding a Camera * * In this example we'll use 3 kinds of tracking, to change this values we'll * have an Elementary spinner widget and handle it on this function. @@ -480,7 +480,7 @@ * @skip ephysics_camera_body_track(camera, body * @until } * - * @section add-uptfloor Updating the floor + * # Updating the floor * * Here we'll use 2 floor images to give the impression of an infinite ground. * @@ -536,7 +536,7 @@ /** * @page test_camera_track_c test_camera_track.c * - * @section ephysics-test-h ephysics_test.h + * # ephysics_test.h * @include ephysics_test.h * * @section test-camera-track-c test_camera_track.c @@ -583,7 +583,7 @@ * @skip struct _Collision_Data { * @until }; * - * @section add-callbacks Adding the Callback + * # Adding the Callback * * Calling ephysics_body_event_callback_add() * will register a callback to a type of physics body event. @@ -632,7 +632,7 @@ /** * @page test_collision_detection_c test_collision_detection.c * - * @section ephysics-test-h ephysics_test.h + * # ephysics_test.h * @include ephysics_test.h * * @section test-collision_detection-c test_collision_detection.c @@ -671,7 +671,7 @@ * already covered in * @ref tutorial_ephysics_bouncing_ball * - * @section add-callbacks Adding the balls + * # Adding the balls * @dontinclude test_collision_filter.c * * We'll use two arrays (color and size) to distinguish the groups. @@ -711,7 +711,7 @@ /** * @page test_collision_filter_c test_collision_filter.c * - * @section ephysics-test-h ephysics_test.h + * # ephysics_test.h * @include ephysics_test.h * * @section test-collision_filter-c test_collision_filter.c @@ -748,7 +748,7 @@ * covered in * @ref tutorial_ephysics_bouncing_ball * - * @section add-callbacks Adding Callbacks + * # Adding Callbacks * @dontinclude test_delete.c * * Calling ephysics_body_event_callback_add() @@ -800,7 +800,7 @@ /** * @page test_delete_c test_delete.c * - * @section ephysics-test-h ephysics_test.h + * # ephysics_test.h * @include ephysics_test.h * * @section test-delete-c test_delete.c @@ -858,7 +858,7 @@ /** * @page test_constraint_c test_constraint.c * - * @section ephysics-test-h ephysics_test.h + * # ephysics_test.h * @include ephysics_test.h * * @section test-constraint-c test_constraint.c @@ -932,7 +932,7 @@ /** * @page test_forces_c test_forces.c * - * @section ephysics-test-h ephysics_test.h + * # ephysics_test.h * @include ephysics_test.h * * @section test-forces-c test_forces.c @@ -998,7 +998,7 @@ /** * @page test_growing_balls_c test_growing_balls.c * - * @section ephysics-test-h ephysics_test.h + * # ephysics_test.h * @include ephysics_test.h * * @section test-growing-balls-c test_growing_balls.c @@ -1069,7 +1069,7 @@ /** * @page test_no_gravity_c test_no_gravity.c * - * @section ephysics-test-h ephysics_test.h + * # ephysics_test.h * @include ephysics_test.h * * @section test-no-gravity-c test_no_gravity.c @@ -1372,7 +1372,7 @@ /** * @page test_rotating_forever_c test_rotating_forever.c * - * @section ephysics-test-h ephysics_test.h + * # ephysics_test.h * @include ephysics_test.h * * @section test-rotating-forever-c test_rotating_forever.c @@ -1417,7 +1417,7 @@ * @skip struct _Velocity_Data { * @until }; * - * @section add-callbacks Adding the Callbacks + * # Adding the Callbacks * * Calling ephysics_body_event_callback_add() * will register a callback to a type of physics body event. @@ -1491,7 +1491,7 @@ /** * @page test_velocity_c test_velocity.c * - * @section ephysics-test-h ephysics_test.h + * # ephysics_test.h * @include ephysics_test.h * * @section test-velocity-c test_velocity.c @@ -1588,7 +1588,7 @@ /** * @page test_shapes_c test_shapes.c * - * @section ephysics-test-h ephysics_test.h + * # ephysics_test.h * @include ephysics_test.h * * @section test-shapes-c test_shapes.c @@ -1673,7 +1673,7 @@ /** * @page test_sleeping_threshold_c test_sleeping_threshold.c * - * @section ephysics-test-h ephysics_test.h + * # ephysics_test.h * @include ephysics_test.h * * @section test-sleeping-threshold-c test_sleeping_threshold.c @@ -1769,7 +1769,7 @@ /** * @page test_slider_c test_slider.c * - * @section ephysics-test-h ephysics_test.h + * # ephysics_test.h * @include ephysics_test.h * * @section test-slider-c test_slider.c diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c index eb5cbd9e8b..22c621f1e8 100644 --- a/src/bin/edje/edje_cc_handlers.c +++ b/src/bin/edje/edje_cc_handlers.c @@ -2561,7 +2561,7 @@ _handle_vector_image(void) free(name); } -/** @edcsubsection{toplevel_images, +/** @edcsubsection{toplevel_images2, * Images} */ /** @@ -3848,7 +3848,7 @@ st_size_class_max(void) /** @edcsection{collections,Collections Blocks} */ -/** @edcsubsection{collections, +/** @edcsubsection{sub_collections, * Collections} */ /** diff --git a/src/lib/emotion/Emotion.h b/src/lib/emotion/Emotion.h index cb566d0a6a..d246491153 100644 --- a/src/lib/emotion/Emotion.h +++ b/src/lib/emotion/Emotion.h @@ -336,7 +336,7 @@ EAPI extern Emotion_Version *emotion_version; * @li "position_update" - Emitted when emotion_object_position_set is called * @li "decode_stop" - Emitted after the last frame is decoded * - * @section Examples + * @section Emotion_Examples * * The following examples exemplify the emotion usage. There's also the * emotion_test binary that is distributed with this library and cover the From c5b1694985bd9cfd74042c666605df911ecd7474 Mon Sep 17 00:00:00 2001 From: Xavi Artigas Date: Tue, 3 Mar 2020 17:49:23 +0100 Subject: [PATCH 22/27] doxygen docs: fix insufficiently namespaced group names These led to clashes, since group names must be globally unique. --- src/lib/elementary/elm_code_diff_widget.h | 2 +- src/lib/elementary/elm_code_line.h | 2 +- src/lib/elementary/elm_code_text.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/elementary/elm_code_diff_widget.h b/src/lib/elementary/elm_code_diff_widget.h index 7a6f2d6412..4387f9dbb2 100644 --- a/src/lib/elementary/elm_code_diff_widget.h +++ b/src/lib/elementary/elm_code_diff_widget.h @@ -12,7 +12,7 @@ extern "C" { /** * @brief UI Loading functions. - * @defgroup Init Creating a diff widget to render an Elm Code backend + * @defgroup Elm_Code_Diff_Init Creating a diff widget to render an Elm Code backend * when it's referencing a diff file * * @{ diff --git a/src/lib/elementary/elm_code_line.h b/src/lib/elementary/elm_code_line.h index 3703a4a4d8..5f42174041 100644 --- a/src/lib/elementary/elm_code_line.h +++ b/src/lib/elementary/elm_code_line.h @@ -40,7 +40,7 @@ EAPI void elm_code_line_free(Elm_Code_Line *line); /** * @brief Line manipulation functions. - * @defgroup Content Elementary Code Line + * @defgroup Elm_Code_Line_Content Elementary Code Line * @{ * * Functions for changing the content of lines in an Elm_Code_File diff --git a/src/lib/elementary/elm_code_text.h b/src/lib/elementary/elm_code_text.h index 97d67653fb..b79d30f3a5 100644 --- a/src/lib/elementary/elm_code_text.h +++ b/src/lib/elementary/elm_code_text.h @@ -14,7 +14,7 @@ extern "C" { /** * @brief Line text handling functions. - * @defgroup Text access and manipulation within lines + * @defgroup Elm_Code_Text access and manipulation within lines * * @{ * From 43f98b2d46eef463a6cbef55c265aaba1fb1345b Mon Sep 17 00:00:00 2001 From: Xavi Artigas Date: Tue, 3 Mar 2020 18:46:36 +0100 Subject: [PATCH 23/27] doxygen docs: Fix several group problems @ingroup before @addgroup, circular group dependencies... --- src/lib/eina/eina_hamster.h | 17 +--- src/lib/elementary/elm_color_class.h | 1 - src/lib/embryo/Embryo.h | 146 +++++++++++++-------------- 3 files changed, 74 insertions(+), 90 deletions(-) diff --git a/src/lib/eina/eina_hamster.h b/src/lib/eina/eina_hamster.h index e5b7129f04..3d0ce2bcdb 100644 --- a/src/lib/eina/eina_hamster.h +++ b/src/lib/eina/eina_hamster.h @@ -20,24 +20,13 @@ #define EINA_HAMSTER_H_ /** - * @addtogroup Eina_Hamster_Group Hamster + * @defgroup Eina_Hamster_Group Hamster * * @brief These functions provide hamster calls. * * @{ */ -/** - * @addtogroup Eina_Core_Group Core - * - * @{ - */ - -/** - * @defgroup Eina_Hamster_Group Hamster - */ - - /** * @brief Gets the hamster count. * @@ -47,10 +36,6 @@ */ EAPI int eina_hamster_count(void); -/** - * @} - */ - /** * @} */ diff --git a/src/lib/elementary/elm_color_class.h b/src/lib/elementary/elm_color_class.h index 97a503148d..8d97f2bce8 100644 --- a/src/lib/elementary/elm_color_class.h +++ b/src/lib/elementary/elm_color_class.h @@ -3,7 +3,6 @@ /** * @defgroup Elm_Color_Class_Group Color Class Editor - * @ingroup Elm_Color_Class_Group * @brief This group provides a UI for editing color classes in applications. * * @{ diff --git a/src/lib/embryo/Embryo.h b/src/lib/embryo/Embryo.h index 21177bddfc..84e39aca46 100644 --- a/src/lib/embryo/Embryo.h +++ b/src/lib/embryo/Embryo.h @@ -521,6 +521,13 @@ EAPI Embryo_Program *embryo_program_load(const char *file); * @ingroup Embryo_Program_Creation_Group */ EAPI void embryo_program_free(Embryo_Program *ep); + +/** + * @defgroup Embryo_Func_Group Function Functions + * @ingroup Embryo + * + * Functions that deal with Embryo program functions. + */ /** * Adds a native program call to the given Embryo program. @@ -529,20 +536,7 @@ EAPI void embryo_program_free(Embryo_Program *ep); * @param func The function to use when the call is made. * @ingroup Embryo_Func_Group */ - -/** - * @defgroup Embryo_Func_Group Function Functions - * @ingroup Embryo - * - * Functions that deal with Embryo program functions. - */ EAPI void embryo_program_native_call_add(Embryo_Program *ep, const char *name, Embryo_Cell (*func) (Embryo_Program *ep, Embryo_Cell *params)); - -/** - * Resets the current virtual machine session of the given program. - * @param ep The given program. - * @ingroup Embryo_Program_VM_Group - */ /** * @defgroup Embryo_Program_VM_Group Virtual Machine Functions @@ -563,6 +557,12 @@ EAPI void embryo_program_native_call_add(Embryo_Program *ep, const c * The current virtual machine session can be destroyed by calling * @ref embryo_program_vm_pop. */ + +/** + * Resets the current virtual machine session of the given program. + * @param ep The given program. + * @ingroup Embryo_Program_VM_Group + */ EAPI void embryo_program_vm_reset(Embryo_Program *ep); /** @@ -586,13 +586,6 @@ EAPI void embryo_program_vm_push(Embryo_Program *ep); * @ingroup Embryo_Program_VM_Group */ EAPI void embryo_program_vm_pop(Embryo_Program *ep); - -/** - * Ensures that the given unsigned short integer is in the small - * endian format. - * @param v Pointer to the given integer. - * @ingroup Embryo_Swap_Group - */ /** * @defgroup Embryo_Swap_Group Byte Swapping Functions @@ -603,6 +596,13 @@ EAPI void embryo_program_vm_pop(Embryo_Program *ep); * used to ensure that the virtual machine operates correctly on big * endian machines. */ + +/** + * Ensures that the given unsigned short integer is in the small + * endian format. + * @param v Pointer to the given integer. + * @ingroup Embryo_Swap_Group + */ EAPI void embryo_swap_16(unsigned short *v); /** @@ -622,6 +622,15 @@ EAPI void embryo_swap_32(unsigned int *v); */ EAPI Embryo_Function embryo_program_function_find(Embryo_Program *ep, const char *name); +/** + * @defgroup Embryo_Public_Variable_Group Public Variable Access Functions + * @ingroup Embryo + * + * In an Embryo program, a global variable can be declared public, as + * described in @ref Small_Scope_Subsection. The functions here allow + * the host program to access these public variables. + */ + /** * Retrieves the location of the public variable in the given program * with the given name. @@ -631,15 +640,6 @@ EAPI Embryo_Function embryo_program_function_find(Embryo_Program *ep, const cha * otherwise. * @ingroup Embryo_Public_Variable_Group */ - -/** - * @defgroup Embryo_Public_Variable_Group Public Variable Access Functions - * @ingroup Embryo - * - * In an Embryo program, a global variable can be declared public, as - * described in @ref Small_Scope_Subsection. The functions here allow - * the host program to access these public variables. - */ EAPI Embryo_Cell embryo_program_variable_find(Embryo_Program *ep, const char *name); /** @@ -660,13 +660,6 @@ EAPI int embryo_program_variable_count_get(Embryo_Program *ep); * @ingroup Embryo_Public_Variable_Group */ EAPI Embryo_Cell embryo_program_variable_get(Embryo_Program *ep, int num); - -/** - * Sets the error code for the given program to the given code. - * @param ep The given program. - * @param error The given error code. - * @ingroup Embryo_Error_Group - */ /** * @defgroup Embryo_Error_Group Error Functions @@ -674,6 +667,13 @@ EAPI Embryo_Cell embryo_program_variable_get(Embryo_Program *ep, int num); * * Functions that set and retrieve error codes in Embryo programs. */ + +/** + * Sets the error code for the given program to the given code. + * @param ep The given program. + * @param error The given error code. + * @ingroup Embryo_Error_Group + */ EAPI void embryo_program_error_set(Embryo_Program *ep, Embryo_Error error); /** @@ -683,13 +683,6 @@ EAPI void embryo_program_error_set(Embryo_Program *ep, Embryo_Error * @ingroup Embryo_Error_Group */ EAPI Embryo_Error embryo_program_error_get(Embryo_Program *ep); - -/** - * Sets the data associated to the given program. - * @param ep The given program. - * @param data New bytecode data. - * @ingroup Embryo_Program_Data_Group - */ /** * @defgroup Embryo_Program_Data_Group Program Data Functions @@ -698,6 +691,13 @@ EAPI Embryo_Error embryo_program_error_get(Embryo_Program *ep); * Functions that set and retrieve data associated with the given * program. */ + +/** + * Sets the data associated to the given program. + * @param ep The given program. + * @param data New bytecode data. + * @ingroup Embryo_Program_Data_Group + */ EAPI void embryo_program_data_set(Embryo_Program *ep, void *data); /** @@ -715,6 +715,13 @@ EAPI void *embryo_program_data_get(Embryo_Program *ep); * @ingroup Embryo_Error_Group */ EAPI const char *embryo_error_string_get(Embryo_Error error); + +/** + * @defgroup Embryo_Data_String_Group Embryo Data String Functions + * @ingroup Embryo + * + * Functions that operate on strings in the memory of a virtual machine. + */ /** * Retrieves the length of the string starting at the given cell. @@ -723,13 +730,6 @@ EAPI const char *embryo_error_string_get(Embryo_Error error); * @return The length of the string. @c 0 is returned if there is an error. * @ingroup Embryo_Data_String_Group */ - -/** - * @defgroup Embryo_Data_String_Group Embryo Data String Functions - * @ingroup Embryo - * - * Functions that operate on strings in the memory of a virtual machine. - */ EAPI int embryo_data_string_length_get(Embryo_Program *ep, Embryo_Cell *str_cell); /** @@ -760,6 +760,15 @@ EAPI void embryo_data_string_set(Embryo_Program *ep, const char *src * @ingroup Embryo_Data_String_Group */ EAPI Embryo_Cell *embryo_data_address_get(Embryo_Program *ep, Embryo_Cell addr); + +/** + * @defgroup Embryo_Heap_Group Heap Functions + * @ingroup Embryo + * + * The heap is an area of memory that can be allocated for program + * use at runtime. The heap functions here change the amount of heap + * memory available. + */ /** * Increases the size of the heap of the given virtual machine by the given @@ -770,15 +779,6 @@ EAPI Embryo_Cell *embryo_data_address_get(Embryo_Program *ep, Embryo_Cell ad * @c EMBRYO_CELL_NONE otherwise. * @ingroup Embryo_Heap_Group */ - -/** - * @defgroup Embryo_Heap_Group Heap Functions - * @ingroup Embryo - * - * The heap is an area of memory that can be allocated for program - * use at runtime. The heap functions here change the amount of heap - * memory available. - */ EAPI Embryo_Cell embryo_data_heap_push(Embryo_Program *ep, int cells); /** @@ -789,13 +789,6 @@ EAPI Embryo_Cell embryo_data_heap_push(Embryo_Program *ep, int cells); * @ingroup Embryo_Heap_Group */ EAPI void embryo_data_heap_pop(Embryo_Program *ep, Embryo_Cell down_to); - -/** - * Returns the number of virtual machines are running for the given program. - * @param ep The given program. - * @return The number of virtual machines running. - * @ingroup Embryo_Run_Group - */ /** * @defgroup Embryo_Run_Group Program Run Functions @@ -804,6 +797,13 @@ EAPI void embryo_data_heap_pop(Embryo_Program *ep, Embryo_Cell down_ * Functions that are involved in actually running functions in an * Embryo program. */ + +/** + * Returns the number of virtual machines are running for the given program. + * @param ep The given program. + * @return The number of virtual machines running. + * @ingroup Embryo_Run_Group + */ EAPI int embryo_program_recursion_get(Embryo_Program *ep); /** @@ -900,6 +900,13 @@ EAPI void embryo_program_max_cycle_run_set(Embryo_Program *ep, int m */ EAPI int embryo_program_max_cycle_run_get(Embryo_Program *ep); +/** + * @defgroup Embryo_Parameter_Group Function Parameter Functions + * @ingroup Embryo + * + * Functions that set parameters for the next function that is called. + */ + /** * Pushes an Embryo_Cell onto the function stack to use as a parameter for * the next function that is called in the given program. @@ -908,13 +915,6 @@ EAPI int embryo_program_max_cycle_run_get(Embryo_Program *ep); * @return @c 1 if successful. @c 0 otherwise. * @ingroup Embryo_Parameter_Group */ - -/** - * @defgroup Embryo_Parameter_Group Function Parameter Functions - * @ingroup Embryo - * - * Functions that set parameters for the next function that is called. - */ EAPI int embryo_parameter_cell_push(Embryo_Program *ep, Embryo_Cell cell); /** From 0fb7acabc2b63658e95ddb5bfc0a150530342ba1 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 3 Mar 2020 13:42:43 -0500 Subject: [PATCH 24/27] efl-wl: ensure that child_added event is called only when a parent is set Reviewers: devilhorns Reviewed By: devilhorns Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11443 --- src/lib/efl_wl/efl_wl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/efl_wl/efl_wl.c b/src/lib/efl_wl/efl_wl.c index 4b1afa64ec..304d9d8dd8 100644 --- a/src/lib/efl_wl/efl_wl.c +++ b/src/lib/efl_wl/efl_wl.c @@ -3239,7 +3239,8 @@ shell_surface_toplevel_set_parent(struct wl_client *client EINA_UNUSED, struct w if (parent_resource) pcs = wl_resource_get_user_data(parent_resource); comp_surface_reparent(cs, pcs); - evas_object_smart_callback_call(cs->c->obj, "child_added", cs->obj); + if (parent_resource) + evas_object_smart_callback_call(cs->c->obj, "child_added", cs->obj); } static void From d9560ffcd96e3e26ba2893d7140e7c982ee7292e Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 3 Mar 2020 13:42:47 -0500 Subject: [PATCH 25/27] efl-wl: add toplevel_added event for adding a new toplevel surface Summary: Depends on D11443 Reviewers: devilhorns Reviewed By: devilhorns Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11444 --- src/lib/efl_wl/Efl_Wl.h | 1 + src/lib/efl_wl/efl_wl.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/lib/efl_wl/Efl_Wl.h b/src/lib/efl_wl/Efl_Wl.h index 3bf4aeea20..a866a4ee13 100644 --- a/src/lib/efl_wl/Efl_Wl.h +++ b/src/lib/efl_wl/Efl_Wl.h @@ -44,6 +44,7 @@ typedef enum * Add a compositor widget to the given canvas. * * The following smart callbacks will trigger on the compositor object: + * "toplevel_added" - A toplevel surface has been added; event info is Evas_Object *surface @since 1.24 * "child_added" - A toplevel surface with a parent has been added; event info is Evas_Object *surface * "popup_added" - A popup surface has been added; event info is Evas_Object *surface * "seat_added" - A compositor seat has been added; event info is Eo *dev diff --git a/src/lib/efl_wl/efl_wl.c b/src/lib/efl_wl/efl_wl.c index 304d9d8dd8..df5cfadee3 100644 --- a/src/lib/efl_wl/efl_wl.c +++ b/src/lib/efl_wl/efl_wl.c @@ -3334,6 +3334,7 @@ shell_surface_toplevel_create(struct wl_client *client EINA_UNUSED, struct wl_re cs->role = wl_resource_create(client, &xdg_toplevel_interface, 1, id); wl_resource_set_implementation(cs->role, &shell_surface_toplevel_interface, cs, shell_surface_toplevel_impl_destroy); cs->shell.new = 1; + evas_object_smart_callback_call(cs->c->obj, "toplevel_added", cs->obj); } static void From 01b818c5b0833360ecd2f1af3b92f5d8981410e3 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Mon, 2 Mar 2020 19:02:09 +0000 Subject: [PATCH 26/27] avahi - let's disable by default as there doesn't seem to be a use i asked why we should have it by default etc. and what it's needed for. i cant't find any... and no answer soc off by default to trim efl down. --- meson_options.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson_options.txt b/meson_options.txt index 338c8f386b..2c6d138981 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -6,7 +6,7 @@ option('audio', option('avahi', type : 'boolean', - value : true, + value : false, description : 'Avahi (zeroconf) support in efl' ) From b8473486990846faf9c0828853f7615cce81aff9 Mon Sep 17 00:00:00 2001 From: Alastair Poole Date: Wed, 4 Mar 2020 01:41:43 +0000 Subject: [PATCH 27/27] elm_code: Improve efficiency of the widget. For now, only create textgrids when needed. Also improve other regions of the widget. This will improve large file support and also some rendering of the widget. This improves performance 1-2 times. However, there must be a reasonable redesign regarding the current use of textgrids. --- src/lib/elementary/elm_code_widget.c | 74 +++++++++++++------- src/lib/elementary/elm_code_widget_private.h | 1 + 2 files changed, 51 insertions(+), 24 deletions(-) diff --git a/src/lib/elementary/elm_code_widget.c b/src/lib/elementary/elm_code_widget.c index 9b488caaba..292a902d77 100644 --- a/src/lib/elementary/elm_code_widget.c +++ b/src/lib/elementary/elm_code_widget.c @@ -325,6 +325,8 @@ _elm_code_widget_cursor_update(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd elm_layout_signal_emit(pd->cursor_rect, "elm,action,focus", "elm"); } + evas_object_smart_calculate(pd->scroller); + evas_object_smart_calculate(pd->gridbox); evas_object_geometry_get(widget, NULL, &oy, NULL, &oh); if ((cy < oy) || (cy > (oy + oh - ch))) @@ -412,7 +414,6 @@ _elm_code_widget_fill_line(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd, El w = elm_code_widget_columns_get(widget); grid = eina_list_nth(pd->grids, line->number - 1); cells = evas_object_textgrid_cellrow_get(grid, 0); - length = elm_code_widget_line_text_column_width_get(widget, line); chrpos = 0; chr = (char *)elm_code_line_text_get(line, NULL); @@ -701,13 +702,24 @@ _elm_code_widget_cursor_move(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd, { Elm_Code *code; Elm_Code_Line *line_obj; - unsigned int oldrow, position, length; + unsigned int oldrow, position, length, first_row, last_row; + int cw, ch; const char *text; oldrow = pd->cursor_line; + pd->cursor_col = col; pd->cursor_line = line; + if (line > eina_list_count(pd->grids) && !pd->selection && !pd->selection->in_progress) + { + if (_elm_code_widget_viewport_get(widget, pd, &first_row, &last_row)) + { + _elm_code_widget_cell_size_get(widget, &cw, &ch); + _elm_code_widget_scroll_by(widget, 0, ch * (line - last_row)); + } + } + code = pd->code; line_obj = elm_code_file_line_get(code->file, line); position = elm_code_widget_line_text_position_for_column_get(widget, line_obj, col); @@ -727,7 +739,6 @@ _elm_code_widget_cursor_move(Elm_Code_Widget *widget, Elm_Code_Widget_Data *pd, elm_layout_signal_emit(pd->cursor_rect, "elm,action,show,cursor", "elm"); } - EOLIAN static Eina_Bool _elm_code_widget_position_at_coordinates_get(Eo *obj, Elm_Code_Widget_Data *pd, Evas_Coord x, Evas_Coord y, @@ -808,8 +819,6 @@ _elm_code_widget_geometry_for_position_get(Elm_Code_Widget *widget, Elm_Code_Wid gutter = efl_ui_code_widget_text_left_gutter_width_get(widget); grid = eina_list_nth(pd->grids, row - 1); - evas_object_smart_calculate(pd->scroller); - evas_object_smart_calculate(pd->gridbox); evas_object_geometry_get(grid, x, y, NULL, NULL); if (x) @@ -2017,20 +2026,19 @@ _elm_code_widget_ensure_n_grid_rows(Elm_Code_Widget *widget, int rows) evas_object_textgrid_font_set(grid, pd->font_name, pd->font_size * elm_config_scale_get()); } - - elm_box_recalculate(pd->gridbox); } static void _elm_code_widget_resize(Elm_Code_Widget *widget, Elm_Code_Line *newline) { + Eina_List *item, *lines; + Elm_Code_Widget_Data *pd; Elm_Code_Line *line; - Eina_List *item; Evas_Object *grid; Evas_Coord ww, wh, old_width, old_height; - int w, h, cw = 0, ch = 0, gutter; - unsigned int line_width; - Elm_Code_Widget_Data *pd; + int w = 0, h, cw = 0, ch = 0, gutter; + unsigned int i, n, line_width, first_row = 1, last_row = 256; + Eina_Bool viewport = EINA_FALSE; pd = efl_data_scope_get(widget, ELM_CODE_WIDGET_CLASS); gutter = efl_ui_code_widget_text_left_gutter_width_get(widget); @@ -2045,18 +2053,34 @@ _elm_code_widget_resize(Elm_Code_Widget *widget, Elm_Code_Line *newline) old_width = ww; old_height = wh; - w = 0; - h = elm_code_file_lines_get(pd->code->file); - EINA_LIST_FOREACH(pd->code->file->lines, item, line) + n = h = elm_code_file_lines_get(pd->code->file); + + if (_elm_code_widget_viewport_get(widget, pd, &first_row, &last_row)) + viewport = EINA_TRUE; + + /* Grow by one page at a time where possible. */ + n = (last_row + (last_row - first_row)) < n ? + last_row + (last_row - first_row) : n; + + /* Calculate the maximum width of our lines. */ + + lines = eina_list_nth_list(pd->code->file->lines, first_row - 1); + for (i = 0; i < n; i++) { + line = eina_list_data_get(lines); + if (!line) break; line_width = elm_code_widget_line_text_column_width_get(widget, line); + if ((int) line_width + gutter + 1 > w) w = (int) line_width + gutter + 1; + + lines = eina_list_next(lines); } - _elm_code_widget_ensure_n_grid_rows(widget, h); + _elm_code_widget_ensure_n_grid_rows(widget, n); _elm_code_widget_cell_size_get(widget, &cw, &ch); + if (w*cw > ww) ww = w*cw; if (h*ch > wh) @@ -2073,15 +2097,15 @@ _elm_code_widget_resize(Elm_Code_Widget *widget, Elm_Code_Line *newline) evas_object_size_hint_min_set(grid, ww, ch); } - if (!newline) + /* Here we expand our scroller when there are less grids than lines of text. */ + elm_box_unpack(pd->gridbox, pd->expander); + evas_object_size_hint_min_set(pd->expander, ww, (h * ch) - (eina_list_count(pd->grids) * ch)); + elm_box_pack_end(pd->gridbox, pd->expander); + + if (!newline && viewport) { - unsigned int first_row, last_row; - - if (!_elm_code_widget_viewport_get(widget, pd, &first_row, &last_row)) - return ; - - _elm_code_widget_fill_range(widget, pd, first_row, last_row, NULL); - + /* Where possible render additional lines to the viewport. */ + _elm_code_widget_fill_range(widget, pd, first_row, last_row + 64 < (unsigned int) h ? last_row + 64 : last_row, NULL); return; } @@ -2089,7 +2113,6 @@ _elm_code_widget_resize(Elm_Code_Widget *widget, Elm_Code_Line *newline) _elm_code_widget_scroll_by(widget, (pd->gravity_x == 1.0 && ww > old_width) ? ww - old_width : 0, (pd->gravity_y == 1.0 && wh > old_height) ? wh - old_height : 0); - elm_box_recalculate(pd->gridbox); } EOAPI void @@ -2430,6 +2453,9 @@ _elm_code_widget_efl_canvas_group_group_add(Eo *obj, Elm_Code_Widget_Data *pd) elm_object_content_set(scroller, gridrows); pd->gridbox = gridrows; + pd->expander = evas_object_rectangle_add(evas_object_evas_get(scroller)); + elm_box_pack_end(pd->gridbox, pd->expander); + _elm_code_widget_efl_ui_widget_theme_apply(obj, pd); evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _elm_code_widget_resize_cb, obj); diff --git a/src/lib/elementary/elm_code_widget_private.h b/src/lib/elementary/elm_code_widget_private.h index 3398ad370f..d64e5d67c7 100644 --- a/src/lib/elementary/elm_code_widget_private.h +++ b/src/lib/elementary/elm_code_widget_private.h @@ -24,6 +24,7 @@ typedef struct Eina_List *grids; unsigned int col_count; Evas_Object *scroller, *gridbox, *background; + Evas_Object *expander; const char *font_name; Evas_Font_Size font_size;