[EGIT] [core/efl] master 01/06: eina: add eina_future_all_iterator and eina_promise_all_iterator.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=373f2ad7974a064daabcc7ba74db8b553ecfc1e0 commit 373f2ad7974a064daabcc7ba74db8b553ecfc1e0 Author: Cedric BAIL Date: Wed Jan 22 10:22:06 2020 -0800 eina: add eina_future_all_iterator and eina_promise_all_iterator. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D11180 --- src/lib/eina/eina_promise.c | 69 +++-- src/lib/eina/eina_promise.h | 32 + 2 files changed, 99 insertions(+), 2 deletions(-) diff --git a/src/lib/eina/eina_promise.c b/src/lib/eina/eina_promise.c index f32d835fe4..ece5ad0c96 100644 --- a/src/lib/eina/eina_promise.c +++ b/src/lib/eina/eina_promise.c @@ -8,6 +8,7 @@ #include "eina_mempool.h" #include "eina_promise_private.h" #include "eina_internal.h" +#include "eina_iterator.h" #include #include @@ -1223,7 +1224,7 @@ _race_then_cb(void *data, const Eina_Value v, //This is not allowed! assert(v.type != _VALUE_TYPE_PROMISE); found = _future_unset(>base, , dead_ptr); - assert(found); + assert(found); (void) found; if (ctx->dispatching) return EINA_VALUE_EMPTY; ctx->dispatching = EINA_TRUE; @@ -1262,7 +1263,7 @@ _all_then_cb(void *data, const Eina_Value v, assert(v.type != _VALUE_TYPE_PROMISE); found = _future_unset(>base, , dead_ptr); - assert(found); + assert(found); (void) found; ctx->processed++; eina_value_array_set(>values, i, v); @@ -1325,6 +1326,70 @@ promise_proxy_of_future_array_create(Eina_Future *array[], return EINA_FALSE; } +EAPI Eina_Promise * +eina_promise_all_iterator(Eina_Iterator *it) +{ + All_Promise_Ctx *ctx; + Eina_Future *f; + unsigned int i = 1; + Eina_Bool r; + + EINA_SAFETY_ON_NULL_RETURN_VAL(it, NULL); + ctx = calloc(1, sizeof(All_Promise_Ctx)); + EINA_SAFETY_ON_NULL_GOTO(ctx, err_ctx); + r = eina_value_array_setup(>values, EINA_VALUE_TYPE_VALUE, 0); + EINA_SAFETY_ON_FALSE_GOTO(r, err_array); + r = eina_iterator_next(it, (void**) ); + EINA_SAFETY_ON_FALSE_GOTO(r, err_array); + + ctx->base.promise = eina_promise_new(_scheduler_get(f), _all_promise_cancel, ctx); + EINA_SAFETY_ON_NULL_GOTO(ctx->base.promise, err_array); + + ctx->base.futures_len = 1; + ctx->base.futures = calloc(1, sizeof (Eina_Future *)); + EINA_SAFETY_ON_NULL_GOTO(ctx->base.futures, err_futures); + + ctx->base.futures[0] = eina_future_then(f, _all_then_cb, ctx, NULL); + + EINA_ITERATOR_FOREACH(it, f) + { +Eina_Future **tmp; + +ctx->base.futures_len++; +tmp = realloc(ctx->base.futures, ctx->base.futures_len * sizeof (Eina_Future *)); + +EINA_SAFETY_ON_NULL_GOTO(tmp, err_futures); +ctx->base.futures = tmp; +ctx->base.futures[i] = eina_future_then(f, _all_then_cb, ctx, NULL); +EINA_SAFETY_ON_NULL_GOTO(ctx->base.futures[i++], err_futures); + } + + for (i = 0; i < ctx->base.futures_len; i++) + { +Eina_Value v = { 0 }; +//Stub values... +r = eina_value_setup(, EINA_VALUE_TYPE_INT); +EINA_SAFETY_ON_FALSE_GOTO(r, err_futures); +r = eina_value_array_append(>values, v); +eina_value_flush(); +EINA_SAFETY_ON_FALSE_GOTO(r, err_futures); + } + return ctx->base.promise; + + err_futures: + while (i >= 1) _eina_future_free(ctx->base.futures[--i]); + free(ctx->base.futures); + ctx->base.futures = NULL; + + eina_mempool_free(_promise_mp, ctx->base.promise); + eina_value_flush(>values); + err_array: + free(ctx); + err_ctx: + eina_iterator_free(it); + return NULL; +} + EAPI Eina_Promise * eina_promise_all_array(Eina_Future *array[]) { diff --git a/src/lib/eina/eina_promise.h b/src/lib/eina/eina_promise.h index 9de125463e..548d162aa0 100644 --- a/src/lib/eina/eina_promise.h +++ b/src/lib/eina/eina_promise.h @@ -1371,6 +1371,22 @@ EAPI Eina_Future_Desc eina_future_cb_easy_from_desc(const Eina_Future_Cb_Easy_De */ EAPI Eina_Promise *eina_promise_all_array(Eina_Future *array[]) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; +/** + * Creates an all promise from an iterator. + * + * Creates a promise that is resolved once all the futures + * from the @p iterator are resolved. + * The promise is resolved with an Eina_Value type array which + * contains EINA_VALUE_TYPE_VALUE elements. The result array is + * ordered according to the @p iterator order. + * + * @param[in] iterator An iterator of futures. Will be destroyed after the call. + * @return A promise or @c NULL on error. + * @note On error all the futures will be CANCELED. + * @see eina_future_all_iterator() + */ +EAPI Eina_Promise *eina_promise_all_iterator(Eina_Iterator *iterator) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; + /** * Creates a race promise. * @
[EGIT] [core/efl] master 04/06: ecore: refactor unpacking/packing code used in conjonction with eina_future_all*.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=eaeb96cc3d11b6f107aef822ef6f0fbae5ceaa03 commit eaeb96cc3d11b6f107aef822ef6f0fbae5ceaa03 Author: Cedric BAIL Date: Fri Jan 24 10:59:01 2020 -0800 ecore: refactor unpacking/packing code used in conjonction with eina_future_all*. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D11184 --- src/lib/ecore/ecore_internal.h | 33 + src/lib/ecore/efl_filter_model.c | 35 +-- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/lib/ecore/ecore_internal.h b/src/lib/ecore/ecore_internal.h index 32a9472188..9f6e55eb24 100644 --- a/src/lib/ecore/ecore_internal.h +++ b/src/lib/ecore/ecore_internal.h @@ -129,6 +129,39 @@ _efl_composite_lookup(const Efl_Class *self, Eo *parent, Efl_Model *view, unsign EFL_COMPOSITE_REMEMBER_RETURN(remember, view); } +/* Result from eina_future_all_* is an EINA_VALUE_TYPE_ARRAY that contain Eina_Value of + Eo Model. It is expected that children slice get return an EINA_VALUE_TYPE_ARRAY that + contain Eo Model directly. +*/ +static inline Eina_Value +_efl_future_all_repack(Eo *o EINA_UNUSED, void *data EINA_UNUSED, const Eina_Value v) +{ + unsigned int i, len; + Eina_Value created = EINA_VALUE_EMPTY; + Eina_Value r = EINA_VALUE_EMPTY; + + eina_value_array_setup(, EINA_VALUE_TYPE_OBJECT, 4); + + EINA_VALUE_ARRAY_FOREACH(, len, i, created) + { +Eo *target = NULL; + +if (eina_value_type_get() != EINA_VALUE_TYPE_OBJECT) + goto on_error; + +target = eina_value_object_get(); +if (!target) goto on_error; + +eina_value_array_append(, target); + } + + return r; + + on_error: + eina_value_flush(); + return eina_value_error_init(EFL_MODEL_ERROR_UNKNOWN); +} + #undef EAPI #define EAPI diff --git a/src/lib/ecore/efl_filter_model.c b/src/lib/ecore/efl_filter_model.c index cc18dca89b..4ef3316947 100644 --- a/src/lib/ecore/efl_filter_model.c +++ b/src/lib/ecore/efl_filter_model.c @@ -314,39 +314,6 @@ _filter_remove_array(Eo *o EINA_UNUSED, void *data, const Eina_Value v) return eina_value_object_init(target); } -/* Result from eina_future_all_array is an EINA_VALUE_TYPE_ARRAY that contain Eina_Value of - Eo Model. It is expected that children slice get return an EINA_VALUE_TYPE_ARRAY that - contain Eo Model directly. -*/ -static Eina_Value -_filter_cleanup_array(Eo *o EINA_UNUSED, void *data EINA_UNUSED, const Eina_Value v) -{ - unsigned int i, len; - Eina_Value created = EINA_VALUE_EMPTY; - Eina_Value r = EINA_VALUE_EMPTY; - - eina_value_array_setup(, EINA_VALUE_TYPE_OBJECT, 4); - - EINA_VALUE_ARRAY_FOREACH(, len, i, created) - { -Eo *target = NULL; - -if (eina_value_type_get() != EINA_VALUE_TYPE_OBJECT) - goto on_error; - -target = eina_value_object_get(); -if (!target) goto on_error; - -eina_value_array_append(, target); - } - - return r; - - on_error: - eina_value_flush(); - return eina_value_error_init(EFL_MODEL_ERROR_UNKNOWN); -} - static Eina_Future * _efl_filter_model_efl_model_children_slice_get(Eo *obj, Efl_Filter_Model_Data *pd, unsigned int start, unsigned int count) @@ -389,7 +356,7 @@ _efl_filter_model_efl_model_children_slice_get(Eo *obj, Efl_Filter_Model_Data *p } r[i] = EINA_FUTURE_SENTINEL; - f = efl_future_then(obj, eina_future_all_array(r), .success = _filter_cleanup_array); + f = efl_future_then(obj, eina_future_all_array(r), .success = _efl_future_all_repack); free(r); free(mapping); --
[EGIT] [core/efl] master 02/06: eina: add test for eina_future_all_iterator.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=c7508d3d521b548429c8f00e0018c3565a3c8299 commit c7508d3d521b548429c8f00e0018c3565a3c8299 Author: Cedric BAIL Date: Wed Jan 22 10:23:53 2020 -0800 eina: add test for eina_future_all_iterator. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D11181 --- src/tests/ecore/efl_app_test_promise.c | 29 + 1 file changed, 29 insertions(+) diff --git a/src/tests/ecore/efl_app_test_promise.c b/src/tests/ecore/efl_app_test_promise.c index e1a74d6ab5..424c278704 100644 --- a/src/tests/ecore/efl_app_test_promise.c +++ b/src/tests/ecore/efl_app_test_promise.c @@ -775,6 +775,34 @@ EFL_START_TEST(efl_test_promise_future_all) } EFL_END_TEST +EFL_START_TEST(efl_test_promise_future_all_iterator) +{ + Eina_Future *futures[11]; + Eina_Iterator *it; + unsigned int i, futures_called = 0, len = EINA_C_ARRAY_LENGTH(futures); + + fail_if(!ecore_init()); + for (i = 0; i < len; i++) + { +Eina_Future *f; +if (i % 2 == 0) + f = _str_future_get(); +else + f = _int_future_get(); +fail_if(!f); +futures[i] = eina_future_then(f, _future_all_count, _called); +fail_if(!futures[i]); + } + + it = EINA_C_ARRAY_ITERATOR_NEW(futures); + fail_if(!eina_future_then(eina_future_all_iterator(it), _all_cb, )); + + ecore_main_loop_begin(); + ecore_shutdown(); + fail_if(futures_called != len); +} +EFL_END_TEST + EFL_START_TEST(efl_test_promise_future_race) { Race_Ctx ctx = { 0 }; @@ -1446,6 +1474,7 @@ void efl_app_test_promise(TCase *tc) tcase_add_test(tc, efl_test_promise_future_convert); tcase_add_test(tc, efl_test_promise_future_easy); tcase_add_test(tc, efl_test_promise_future_all); + tcase_add_test(tc, efl_test_promise_future_all_iterator); tcase_add_test(tc, efl_test_promise_future_race); tcase_add_test(tc, efl_test_promise_future_ignore_error); tcase_add_test(tc, efl_test_promise_future_success); --
[EGIT] [core/efl] master 05/06: efl: add Efl.Model.Children_Index_Get.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=2e41a13166789670602bc005a7e6a9f0815ecd77 commit 2e41a13166789670602bc005a7e6a9f0815ecd77 Author: Cedric BAIL Date: Fri Jan 24 11:01:03 2020 -0800 efl: add Efl.Model.Children_Index_Get. This allow for fetching random children in a model. A simple fallback is provided by Efl.Loop_Model that will allow all model to provide this feature in a non optimized way. Later on this can be speeded up. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D11185 --- src/lib/ecore/efl_loop_model.c | 36 src/lib/ecore/efl_loop_model.eo | 1 + src/lib/efl/interfaces/efl_model.eo | 12 3 files changed, 49 insertions(+) diff --git a/src/lib/ecore/efl_loop_model.c b/src/lib/ecore/efl_loop_model.c index d3e52a63fb..88d8574285 100644 --- a/src/lib/ecore/efl_loop_model.c +++ b/src/lib/ecore/efl_loop_model.c @@ -108,6 +108,42 @@ _efl_loop_model_efl_model_property_ready_get(Eo *obj, void *pd EINA_UNUSED, cons return efl_future_then(obj, f); } +static Eina_Value +_unpack_from_array(void *data EINA_UNUSED, Eina_Value v, const Eina_Future *f EINA_UNUSED) +{ + Eo *object = NULL; + + if (eina_value_type_get() == EINA_VALUE_TYPE_ERROR) return v; + if (eina_value_type_get() != EINA_VALUE_TYPE_ARRAY) return eina_value_error_init(EINVAL); + if (eina_value_array_count() != 1) return eina_value_error_init(EINVAL); + + eina_value_array_get(, 0, ); + + return eina_value_object_init(object); +} + +static Eina_Future * +_efl_loop_model_efl_model_children_index_get(Eo *obj, void *pd EINA_UNUSED, Eina_Iterator *indexes) +{ + Eina_Future *r; + Eina_Array futures; + unsigned int idx; + + eina_array_step_set(, sizeof (Eina_Array), 8); + + EINA_ITERATOR_FOREACH(indexes, idx) + eina_array_push(, eina_future_then(efl_model_children_slice_get(obj, idx, 1), _unpack_from_array, NULL)); + eina_iterator_free(indexes); + + r = efl_future_then(obj, eina_future_all_iterator(eina_array_iterator_new()), + .success = _efl_future_all_repack, + .success_type = EINA_VALUE_TYPE_ARRAY); + + eina_array_flush(); + + return r; +} + static void _noref_death(void *data EINA_UNUSED, const Efl_Event *event) { diff --git a/src/lib/ecore/efl_loop_model.eo b/src/lib/ecore/efl_loop_model.eo index 2285b56f1b..06af337ecf 100644 --- a/src/lib/ecore/efl_loop_model.eo +++ b/src/lib/ecore/efl_loop_model.eo @@ -20,5 +20,6 @@ abstract Efl.Loop_Model extends Efl.Loop_Consumer implements Efl.Model Efl.Object.invalidate; Efl.Model.property_ready_get; Efl.Model.property { get; set; } + Efl.Model.children_index_get; } } diff --git a/src/lib/efl/interfaces/efl_model.eo b/src/lib/efl/interfaces/efl_model.eo index ee04879f68..e669d50ade 100644 --- a/src/lib/efl/interfaces/efl_model.eo +++ b/src/lib/efl/interfaces/efl_model.eo @@ -141,6 +141,18 @@ interface Efl.Model /* XXX: is this right? */ return: future>; [[Array of children]] } + children_index_get { + [[Get children as specified by iterator. + +Provided index have to be between 0 and @.children_count.get. + +This function might rely on @.children_slice_get as a fallback. + ]] +params { + @in indices: iterator; [[Indices of the requested children.]] +} +return: future>; [[Array of children]] + } @property children_count { [[Number of children. --
[EGIT] [core/efl] master 03/06: eina: do not warn when calling eina_inarray_pop on empty inarray to match eina_array_pop.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=5d20a3bc6db0071c6fe063553d59b946917315dd commit 5d20a3bc6db0071c6fe063553d59b946917315dd Author: Cedric BAIL Date: Thu Jan 30 15:16:22 2020 -0800 eina: do not warn when calling eina_inarray_pop on empty inarray to match eina_array_pop. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D11253 --- src/lib/eina/eina_inarray.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/eina/eina_inarray.c b/src/lib/eina/eina_inarray.c index 709ae6ff36..e900e05b6e 100644 --- a/src/lib/eina/eina_inarray.c +++ b/src/lib/eina/eina_inarray.c @@ -532,7 +532,7 @@ EAPI void * eina_inarray_pop(Eina_Inarray *array) { EINA_MAGIC_CHECK_INARRAY(array, NULL); - EINA_SAFETY_ON_TRUE_RETURN_VAL(array->len == 0, NULL); + if (array->len == 0) return NULL; if (!_eina_inarray_resize(array, array->len - 1)) return NULL; array->len--; --
[EGIT] [core/efl] master 02/13: elementary: make focus manager update_children and update_order an internal function to not expose list<>.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=fa0fb44d09755d439ae0ebc092448bf920b7e4aa commit fa0fb44d09755d439ae0ebc092448bf920b7e4aa Author: Cedric BAIL Date: Thu Jan 2 12:10:56 2020 -0800 elementary: make focus manager update_children and update_order an internal function to not expose list<>. Reviewed-by: Daniel Kolesa Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D11045 --- src/lib/elementary/efl_ui_focus_manager_calc.c | 22 +- src/lib/elementary/efl_ui_focus_manager_calc.eo | 19 --- src/lib/elementary/elm_priv.h | 4 src/tests/elementary/efl_ui_test_focus_common.h | 2 ++ 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/src/lib/elementary/efl_ui_focus_manager_calc.c b/src/lib/elementary/efl_ui_focus_manager_calc.c index 7be3913474..9c104ab7a9 100644 --- a/src/lib/elementary/efl_ui_focus_manager_calc.c +++ b/src/lib/elementary/efl_ui_focus_manager_calc.c @@ -2061,7 +2061,27 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_dirty_logic_unfreeze(Eo *obj, Ef } } +static void +_efl_ui_focus_manager_calc_update_children_ownership_fallback(Efl_Ui_Focus_Object *parent, Eina_List *children) +{ + (void)parent; + eina_list_free(children); +} + +EOAPI EFL_FUNC_BODYV_FALLBACK(efl_ui_focus_manager_calc_update_children, Eina_Bool, 0, _efl_ui_focus_manager_calc_update_children_ownership_fallback(parent, children);, EFL_FUNC_CALL(parent, children), Efl_Ui_Focus_Object *parent, Eina_List *children); + +static void +_efl_ui_focus_manager_calc_update_order_ownership_fallback(Efl_Ui_Focus_Object *parent, Eina_List *children) +{ + (void)parent; + eina_list_free(children); +} + +EOAPI EFL_VOID_FUNC_BODYV_FALLBACK(efl_ui_focus_manager_calc_update_order, _efl_ui_focus_manager_calc_update_order_ownership_fallback(parent, children);, EFL_FUNC_CALL(parent, children), Efl_Ui_Focus_Object *parent, Eina_List *children); + #define EFL_UI_FOCUS_MANAGER_CALC_EXTRA_OPS \ - EFL_OBJECT_OP_FUNC(efl_dbg_info_get, _efl_ui_focus_manager_calc_efl_object_dbg_info_get) + EFL_OBJECT_OP_FUNC(efl_dbg_info_get, _efl_ui_focus_manager_calc_efl_object_dbg_info_get), \ + EFL_OBJECT_OP_FUNC(efl_ui_focus_manager_calc_update_children, _efl_ui_focus_manager_calc_update_children), \ + EFL_OBJECT_OP_FUNC(efl_ui_focus_manager_calc_update_order, _efl_ui_focus_manager_calc_update_order) #include "efl_ui_focus_manager_calc.eo.c" diff --git a/src/lib/elementary/efl_ui_focus_manager_calc.eo b/src/lib/elementary/efl_ui_focus_manager_calc.eo index cd9ad90fa5..ed86b7b05c 100644 --- a/src/lib/elementary/efl_ui_focus_manager_calc.eo +++ b/src/lib/elementary/efl_ui_focus_manager_calc.eo @@ -55,25 +55,6 @@ class @beta Efl.Ui.Focus.Manager_Calc extends Efl.Object implements Efl.Ui.Focus } return : bool; [[$true if successful, $false otherwise.]] } -update_children { -[[Sets the list of children to a different order.]] -params { -parent : Efl.Ui.Focus.Object; [[The parent to update.]] -children : list @move; [[The list of children with the new order.]] -} -return : bool; [[$true if successful, $false otherwise.]] -} -update_order { -[[Sets the list of children to a different order. - - Objects in the list which are not children of $parent are ignored. - Compare to @.update_children. -]] -params { -parent : Efl.Ui.Focus.Object; [[The parent to update.]] -children : list @move; [[The list of objects with the new order.]] -} -} unregister { [[Unregister the given item from the focus graph.]] params { diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h index 5aa18c3e62..87e6bdb0bf 100644 --- a/src/lib/elementary/elm_priv.h +++ b/src/lib/elementary/elm_priv.h @@ -852,6 +852,10 @@ void _elm_win_wl_cursor_set(Evas_Object *obj, const char *cursor void _efl_ui_focus_manager_redirect_events_del(Efl_Ui_Focus_Manager *manager, Eo *obj); void _efl_ui_focus_manager_redirect_events_add(Efl_Ui_Focus_Manager *manager, Eo *obj); +EOAPI Eina_Bool efl_ui_focus_manager_calc_update_children(Eo *obj, Efl_Ui_Focus_Object *parent, Eina_List *children EFL_TRANSFER_OWNERSHIP); +EOAPI void efl_ui_focus_manager_calc_update_order(Eo *obj, Efl_Ui_Focus_Object *parent, Eina_List *children EFL_TRANSFER_OWNERSHIP); + + void _efl_access_shutdown(void); /* Combobox: no proper support for Efl.Part API yet. */ diff --git a/src/tests/elementary/efl_ui_test_focus_common.h b/src/tests/elementary/efl_ui_test_focus_common.h index ceda6a0074..bf6cf44cb0 100644 --- a/src/tests/elementary/efl_ui_test_focus_common.h +++ b/src/
[EGIT] [core/efl] master 01/13: ecore_con: remove use of list<> from Efl.Net.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=81cbe8bdc80084433cefec4896734ce32fdfc379 commit 81cbe8bdc80084433cefec4896734ce32fdfc379 Author: Cedric BAIL Date: Thu Jan 2 11:48:45 2020 -0800 ecore_con: remove use of list<> from Efl.Net. Reviewed-by: Marcel Hollerbach Reviewed-by: Mike Blumenkrantz Differential Revision: https://phab.enlightenment.org/D11044 --- src/examples/ecore/efl_net_control_example.c | 4 ++-- src/lib/ecore_con/efl_net_control-connman.c | 9 +++-- src/lib/ecore_con/efl_net_control_manager.eo | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/examples/ecore/efl_net_control_example.c b/src/examples/ecore/efl_net_control_example.c index 408ea8e6c9..f634953467 100644 --- a/src/examples/ecore/efl_net_control_example.c +++ b/src/examples/ecore/efl_net_control_example.c @@ -466,7 +466,6 @@ _ctl_agent_request_input(void *data EINA_UNUSED, const Efl_Event *event) char buf[100]; Eo *ctl = event->object; Efl_Net_Control_Agent_Request_Input *ri = event->info; - Eina_List *n; Efl_Net_Control_Agent_Request_Input_Information *info; char *name = NULL; char *username = NULL; @@ -475,10 +474,11 @@ _ctl_agent_request_input(void *data EINA_UNUSED, const Efl_Event *event) char *wps = NULL; Eina_Slice ssid_slice = { }; size_t len; + unsigned int n; printf("INFO: Needs agent input!\n"); - EINA_LIST_FOREACH(ri->informational, n, info) + EINA_ACCESSOR_FOREACH(ri->informational, n, info) printf("INFO: - %s: %s\n", info->name, info->value); diff --git a/src/lib/ecore_con/efl_net_control-connman.c b/src/lib/ecore_con/efl_net_control-connman.c index 8334d4d0b2..ceb3541f31 100644 --- a/src/lib/ecore_con/efl_net_control-connman.c +++ b/src/lib/ecore_con/efl_net_control-connman.c @@ -212,6 +212,7 @@ _efl_net_control_agent_request_input(const Eldbus_Service_Interface *service, co Efl_Net_Control_Agent_Request_Input event = { }; Efl_Net_Control_Agent_Request_Input_Information *info; Eldbus_Message_Iter *array, *entry; + Eina_Array infos; const char *path; DBG("Agent %p requested input %s", o, eldbus_message_path_get(msg)); @@ -231,6 +232,8 @@ _efl_net_control_agent_request_input(const Eldbus_Service_Interface *service, co if (!eldbus_message_arguments_get(msg, "oa{sv}", , )) goto err; + eina_array_step_set(, sizeof (Eina_Array), 4); + event.informational = eina_array_accessor_new(); event.access_point = _efl_net_control_access_point_find(pd, path); while (eldbus_message_iter_get_and_next(array, 'e', )) @@ -261,7 +264,7 @@ _efl_net_control_agent_request_input(const Eldbus_Service_Interface *service, co { info = _efl_net_control_agent_informational_get(name, var); if (info) - event.informational = eina_list_append(event.informational, info); + eina_array_push(, info); else WRN("Unknown field name '%s'", name); } @@ -270,7 +273,9 @@ _efl_net_control_agent_request_input(const Eldbus_Service_Interface *service, co pd->agent_request_input.msg = eldbus_message_ref((Eldbus_Message *)msg); efl_event_callback_call(o, EFL_NET_CONTROL_MANAGER_EVENT_AGENT_REQUEST_INPUT, ); - EINA_LIST_FREE(event.informational, info) free(info); + eina_accessor_free(event.informational); + while ((info = eina_array_pop())) free(info); + eina_array_flush(); return NULL; /* reply later */ diff --git a/src/lib/ecore_con/efl_net_control_manager.eo b/src/lib/ecore_con/efl_net_control_manager.eo index 3c84235bf7..eb0a61477b 100644 --- a/src/lib/ecore_con/efl_net_control_manager.eo +++ b/src/lib/ecore_con/efl_net_control_manager.eo @@ -36,7 +36,7 @@ struct @beta Efl.Net.Control.Agent_Request_Input { access_point: Efl.Net.Control.Access_Point; [[The access point which triggered this request.]] fields: Efl.Net.Control.Agent_Request_Input_Field; [[Bitwise OR of fields present in this request.]] passphrase_type: string; [[Extra detail for the passphrase field, such as wep, psk, response (IEEE802.X GTC/OTP), string...]] -informational: list; [[Such as the previous passphrase, VPN host]] +informational: accessor; [[Such as the previous passphrase, VPN host]] } struct @beta Efl.Net.Control.Agent_Error { --
[EGIT] [core/efl] master 01/01: eolian: enforce that list<> can only be used with @beta API.
xartigas pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=5e93a878b701f95e43f4b2c4945e782eb4a1d9a6 commit 5e93a878b701f95e43f4b2c4945e782eb4a1d9a6 Author: Cedric BAIL Date: Thu Jan 2 15:41:36 2020 -0800 eolian: enforce that list<> can only be used with @beta API. Reviewed-by: Daniel Kolesa Differential Revision: https://phab.enlightenment.org/D11050 --- src/lib/eolian/Eolian.h| 5 + src/lib/eolian/database_validate.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h index db0421634a..7f19ff93e7 100644 --- a/src/lib/eolian/Eolian.h +++ b/src/lib/eolian/Eolian.h @@ -336,7 +336,12 @@ typedef enum EOLIAN_TYPE_BUILTIN_ARRAY, EOLIAN_TYPE_BUILTIN_FUTURE, EOLIAN_TYPE_BUILTIN_ITERATOR, +#ifdef EFL_BETA_API_SUPPORT EOLIAN_TYPE_BUILTIN_LIST, +#else + // Placeholder when using release API only. Done to prevent offseting the value below. + EOLIAN_TYPE_BUILTIN_BETA_PLACEHOLDER1, +#endif EOLIAN_TYPE_BUILTIN_ANY_VALUE, EOLIAN_TYPE_BUILTIN_ANY_VALUE_REF, diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c index b1af2185ef..1e7b072c9d 100644 --- a/src/lib/eolian/database_validate.c +++ b/src/lib/eolian/database_validate.c @@ -400,9 +400,9 @@ _validate_type(Validate_State *vals, Eolian_Type *tp, Eina_Bool by_ref, int kwid = eo_lexer_keyword_str_to_id(tp->base.name); if (kwid > KW_void) tp->ownable = EINA_TRUE; -if (kwid == KW_hash && vals->stable) +if ((kwid == KW_hash || kwid == KW_list) && vals->stable) { - _eo_parser_log(>base, "hashes not allowed in stable context"); + _eo_parser_log(>base, "hashes and lists not allowed in stable context"); return EINA_FALSE; } Eolian_Type *itp = tp->base_type; --
[EGIT] [core/efl] master 04/05: elementary: do not use list<> in Efl.Ui.Focus_Manager.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=ae8b9123286a3d33cb5f217de7f5fa8fa532549c commit ae8b9123286a3d33cb5f217de7f5fa8fa532549c Author: Cedric BAIL Date: Fri Jan 3 11:22:12 2020 -0800 elementary: do not use list<> in Efl.Ui.Focus_Manager. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D11051 --- src/lib/elementary/efl_ui_focus_manager.c | 8 +-- src/lib/elementary/efl_ui_focus_manager.eo | 8 +-- src/lib/elementary/efl_ui_focus_manager_calc.c | 83 -- src/lib/elementary/efl_ui_widget.c | 2 +- src/tests/elementary/efl_ui_test_focus.c | 18 -- 5 files changed, 87 insertions(+), 32 deletions(-) diff --git a/src/lib/elementary/efl_ui_focus_manager.c b/src/lib/elementary/efl_ui_focus_manager.c index 31afb9dc98..8f63f8e25c 100644 --- a/src/lib/elementary/efl_ui_focus_manager.c +++ b/src/lib/elementary/efl_ui_focus_manager.c @@ -8,10 +8,10 @@ EAPI void efl_ui_focus_relation_free(Efl_Ui_Focus_Relations *rel) { - eina_list_free(rel->right); - eina_list_free(rel->left); - eina_list_free(rel->top); - eina_list_free(rel->down); + eina_iterator_free(rel->right); + eina_iterator_free(rel->left); + eina_iterator_free(rel->top); + eina_iterator_free(rel->down); free(rel); } diff --git a/src/lib/elementary/efl_ui_focus_manager.eo b/src/lib/elementary/efl_ui_focus_manager.eo index 5bb11e7036..dd95256b6d 100644 --- a/src/lib/elementary/efl_ui_focus_manager.eo +++ b/src/lib/elementary/efl_ui_focus_manager.eo @@ -4,10 +4,10 @@ import eina_types; struct @beta @free(efl_ui_focus_relation_free) Efl.Ui.Focus.Relations { [[Structure holding the graph of relations between focusable objects. ]] -right : list @move; [[List of objects to the right.]] -left : list @move; [[List of objects to the left.]] -top : list @move; [[List of objects above.]] -down : list @move; [[List of objects below.]] +right : iterator @move; [[List of objects to the right.]] +left : iterator @move; [[List of objects to the left.]] +top : iterator @move; [[List of objects above.]] +down : iterator @move; [[List of objects below.]] next : Efl.Ui.Focus.Object; [[Next object.]] prev : Efl.Ui.Focus.Object; [[Previous object.]] parent : Efl.Ui.Focus.Object; [[Parent object.]] diff --git a/src/lib/elementary/efl_ui_focus_manager_calc.c b/src/lib/elementary/efl_ui_focus_manager_calc.c index efb67fcabf..7be3913474 100644 --- a/src/lib/elementary/efl_ui_focus_manager_calc.c +++ b/src/lib/elementary/efl_ui_focus_manager_calc.c @@ -1789,18 +1789,6 @@ _efl_ui_focus_manager_calc_efl_object_finalize(Eo *obj, Efl_Ui_Focus_Manager_Cal return result; } -static Eina_List* -_convert(Border b) -{ - Eina_List *n, *par = NULL; - Node *node; - - EINA_LIST_FOREACH(b.one_direction, n, node) - par = eina_list_append(par, node->focusable); - - return par; -} - EOLIAN static Efl_Ui_Focus_Object* _efl_ui_focus_manager_calc_efl_ui_focus_manager_manager_focus_get(const Eo *obj EINA_UNUSED, Efl_Ui_Focus_Manager_Calc_Data *pd) { @@ -1815,6 +1803,63 @@ _efl_ui_focus_manager_calc_efl_ui_focus_manager_manager_focus_get(const Eo *obj return upper->focusable; } +typedef struct _Eina_Iterator_Focusable Eina_Iterator_Focusable; +struct _Eina_Iterator_Focusable +{ + Eina_Iterator iterator; + + Eina_Iterator *redirect; +}; + +static Eina_Bool +_node_focusable_iterator_next(Eina_Iterator_Focusable *it, void **data) +{ + Node *node = NULL; + Eina_Bool r; + + if (!it->redirect) return EINA_FALSE; + + r = eina_iterator_next(it->redirect, (void **) ); + if (r && data) *data = node->focusable; + + return r; +} + +static Eina_List * +_node_focusable_iterator_get_container(Eina_Iterator_Focusable *it) +{ + if (!it->redirect) return NULL; + + return eina_iterator_container_get(it->redirect); +} + +static void +_node_focusable_iterator_free(Eina_Iterator_Focusable *it) +{ + eina_iterator_free(it->redirect); + EINA_MAGIC_SET(>iterator, 0); + free(it); +} + +static Eina_Iterator * +_node_focusable_iterator_new(Eina_List *nodes) +{ + Eina_Iterator_Focusable *it; + + it = calloc(1, sizeof (Eina_Iterator_Focusable)); + if (!it) return NULL; + + EINA_MAGIC_SET(>iterator, EINA_MAGIC_ITERATOR); + it->redirect = eina_list_iterator_new(nodes); + + it->iterator.version = EINA_ITERATOR_VERSION; + it->iterator.next = FUNC_ITERATOR_NEXT(_node_focusable_iterator_next); + it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_node_focusable_iterator_get_container); + it->iterator.free = FUNC_ITERATOR_FREE(_node_focusable_iterator_free); + + return >iterator; +} + EOLIAN static Efl_Ui_Focus_Relations* _efl_ui_focus_manager_calc_efl_ui_focus_manager_fetch(Eo *obj, E
[EGIT] [core/efl] master 02/05: efl: mark @beta Efl.Gfx.Event.Render_Post.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=4d65c84329d5bc81143554b25d4b003d69f4e863 commit 4d65c84329d5bc81143554b25d4b003d69f4e863 Author: Cedric BAIL Date: Thu Jan 2 15:27:56 2020 -0800 efl: mark @beta Efl.Gfx.Event.Render_Post. This is an oversight during last release. It should not affect anyone as all the user of this type are marked @beta themself. Reviewed-by: Mike Blumenkrantz Reviewed-by: Daniel Kolesa Differential Revision: https://phab.enlightenment.org/D11049 --- src/lib/efl/interfaces/efl_gfx_types.eot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/efl/interfaces/efl_gfx_types.eot b/src/lib/efl/interfaces/efl_gfx_types.eot index 75d70e6e90..e9189aad31 100644 --- a/src/lib/efl/interfaces/efl_gfx_types.eot +++ b/src/lib/efl/interfaces/efl_gfx_types.eot @@ -184,7 +184,7 @@ enum Efl.Gfx.Change_Flag all = 0x [[All properties got changed.]] } -struct Efl.Gfx.Event.Render_Post +struct @beta Efl.Gfx.Event.Render_Post { [[Data sent along a "render,post" event, after a frame has been rendered. @since 1.23]] updated_area: list; [[A list of rectangles that were --
[EGIT] [core/efl] master 03/05: eolian: enforce that list<> can only be used with @beta API.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=6b110e578d24b2a99c4c1b158433327a0a43ce1a commit 6b110e578d24b2a99c4c1b158433327a0a43ce1a Author: Cedric BAIL Date: Thu Jan 2 15:41:36 2020 -0800 eolian: enforce that list<> can only be used with @beta API. Reviewed-by: Daniel Kolesa Differential Revision: https://phab.enlightenment.org/D11050 --- src/lib/eolian/Eolian.h| 5 + src/lib/eolian/database_validate.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h index db0421634a..7f19ff93e7 100644 --- a/src/lib/eolian/Eolian.h +++ b/src/lib/eolian/Eolian.h @@ -336,7 +336,12 @@ typedef enum EOLIAN_TYPE_BUILTIN_ARRAY, EOLIAN_TYPE_BUILTIN_FUTURE, EOLIAN_TYPE_BUILTIN_ITERATOR, +#ifdef EFL_BETA_API_SUPPORT EOLIAN_TYPE_BUILTIN_LIST, +#else + // Placeholder when using release API only. Done to prevent offseting the value below. + EOLIAN_TYPE_BUILTIN_BETA_PLACEHOLDER1, +#endif EOLIAN_TYPE_BUILTIN_ANY_VALUE, EOLIAN_TYPE_BUILTIN_ANY_VALUE_REF, diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c index b1af2185ef..1e7b072c9d 100644 --- a/src/lib/eolian/database_validate.c +++ b/src/lib/eolian/database_validate.c @@ -400,9 +400,9 @@ _validate_type(Validate_State *vals, Eolian_Type *tp, Eina_Bool by_ref, int kwid = eo_lexer_keyword_str_to_id(tp->base.name); if (kwid > KW_void) tp->ownable = EINA_TRUE; -if (kwid == KW_hash && vals->stable) +if ((kwid == KW_hash || kwid == KW_list) && vals->stable) { - _eo_parser_log(>base, "hashes not allowed in stable context"); + _eo_parser_log(>base, "hashes and lists not allowed in stable context"); return EINA_FALSE; } Eolian_Type *itp = tp->base_type; --
[EGIT] [core/efl] master 01/05: evas: prepare separation of POST_RENDER event from being an unified and legacy event at the same time.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=948da9ace617af088c1e2dd0d215010f31c00081 commit 948da9ace617af088c1e2dd0d215010f31c00081 Author: Cedric BAIL Date: Thu Jan 2 15:26:44 2020 -0800 evas: prepare separation of POST_RENDER event from being an unified and legacy event at the same time. Reviewed-by: Mike Blumenkrantz Reviewed-by: Daniel Kolesa Differential Revision: https://phab.enlightenment.org/D11048 --- src/lib/evas/Evas_Common.h | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib/evas/Evas_Common.h b/src/lib/evas/Evas_Common.h index b1cecf11ba..7122e0b194 100644 --- a/src/lib/evas/Evas_Common.h +++ b/src/lib/evas/Evas_Common.h @@ -302,7 +302,12 @@ typedef enum _Evas_Engine_Render_Mode EVAS_RENDER_MODE_NONBLOCKING = 1, /**< The rendering is non blocking mode*/ } Evas_Engine_Render_Mode; /**< behaviour of the renderer*/ -typedef Efl_Gfx_Event_Render_Post Evas_Event_Render_Post; /**< Event info sent after a frame was rendered. @since 1.18 */ +typedef struct _Evas_Event_Render_Post Evas_Event_Render_Post; /**< Event info sent after a frame was rendered. @since 1.18 */ +struct _Evas_Event_Render_Post +{ + Eina_List *updated_area; /**< A list of rectangles that were updated in the + * canvas. */ +}; typedef enum _Evas_Device_Class { --
[EGIT] [core/efl] master 01/01: eolian: move list<> tests to be @beta and preserve enough meaningful that are not @beta.
felipealmeida pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=1d28ff6a76f65284b467f832c2f577fe9f656b6f commit 1d28ff6a76f65284b467f832c2f577fe9f656b6f Author: Cedric BAIL Date: Thu Jan 2 15:23:14 2020 -0800 eolian: move list<> tests to be @beta and preserve enough meaningful that are not @beta. Reviewed-by: Daniel Kolesa Reviewed-by: Felipe Magno de Almeida Differential Revision: https://phab.enlightenment.org/D11046 --- src/tests/eolian/data/complex_type.eo | 4 ++-- src/tests/eolian/data/object_impl.eo| 4 ++-- src/tests/eolian/data/object_impl_add.eo| 2 +- src/tests/eolian/data/object_impl_add_ref.c | 2 +- src/tests/eolian/data/object_impl_ref.c | 2 +- src/tests/eolian/data/typedef.eo| 2 +- src/tests/eolian/data/typedef_ref.h | 2 +- src/tests/eolian/data/typedef_ref_stub.h| 2 +- src/tests/eolian/eolian_generation.c| 1 + src/tests/eolian/eolian_parsing.c | 2 +- 10 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/tests/eolian/data/complex_type.eo b/src/tests/eolian/data/complex_type.eo index 9cb6a1faf1..82613a1641 100644 --- a/src/tests/eolian/data/complex_type.eo +++ b/src/tests/eolian/data/complex_type.eo @@ -1,6 +1,6 @@ class Complex_Type { methods { - @property a { + @property a @beta { set { return: list > @move; } @@ -10,7 +10,7 @@ class Complex_Type { value: list @move; } } - foo { + foo @beta { params { buf: mstring @move; sl: slice; diff --git a/src/tests/eolian/data/object_impl.eo b/src/tests/eolian/data/object_impl.eo index 7fe8ce2e24..aa708a8bd7 100644 --- a/src/tests/eolian/data/object_impl.eo +++ b/src/tests/eolian/data/object_impl.eo @@ -1,6 +1,6 @@ abstract Object_Impl extends Base { methods { - @property a { + @property a @beta { set { values { value: const(list); @@ -23,7 +23,7 @@ abstract Object_Impl extends Base { /* set as virtual pure - no implementation expected */ } values { -value: list @move; +value: iterator @move; } } constructor_1 { diff --git a/src/tests/eolian/data/object_impl_add.eo b/src/tests/eolian/data/object_impl_add.eo index c1e82e2365..b8113a2f01 100644 --- a/src/tests/eolian/data/object_impl_add.eo +++ b/src/tests/eolian/data/object_impl_add.eo @@ -2,7 +2,7 @@ class Object_Impl_Add extends Base { data: Object_Impl_Data; methods { - @property c { + @property c @beta { set { } get { diff --git a/src/tests/eolian/data/object_impl_add_ref.c b/src/tests/eolian/data/object_impl_add_ref.c index f6b8fa5927..55f57578bb 100644 --- a/src/tests/eolian/data/object_impl_add_ref.c +++ b/src/tests/eolian/data/object_impl_add_ref.c @@ -20,7 +20,7 @@ _object_impl_a_get(const Eo *obj, Object_Impl_Data *pd, const char *part) } EOLIAN static void -_object_impl_b_set(Eo *obj, Object_Impl_Data *pd, Eina_List *value) +_object_impl_b_set(Eo *obj, Object_Impl_Data *pd, Eina_Iterator *value) { } diff --git a/src/tests/eolian/data/object_impl_ref.c b/src/tests/eolian/data/object_impl_ref.c index ddc0d7ccd5..32a331529f 100644 --- a/src/tests/eolian/data/object_impl_ref.c +++ b/src/tests/eolian/data/object_impl_ref.c @@ -20,7 +20,7 @@ _object_impl_a_get(const Eo *obj, Object_Impl_Data *pd, const char *part) } EOLIAN static void -_object_impl_b_set(Eo *obj, Object_Impl_Data *pd, Eina_List *value) +_object_impl_b_set(Eo *obj, Object_Impl_Data *pd, Eina_Iterator *value) { } diff --git a/src/tests/eolian/data/typedef.eo b/src/tests/eolian/data/typedef.eo index 916a39fcfc..cb97dd12ad 100644 --- a/src/tests/eolian/data/typedef.eo +++ b/src/tests/eolian/data/typedef.eo @@ -1,5 +1,5 @@ type Evas.Coord: int; /* Simple type definition */ -type List_Objects: list; /* A little more complex */ +type List_Objects: iterator; /* A little more complex */ type Evas.Coord2: Evas.Coord; type Evas.Coord3: Evas.Coord2; diff --git a/src/tests/eolian/data/typedef_ref.h b/src/tests/eolian/data/typedef_ref.h index dd3f3ad85e..2a3b888394 100644 --- a/src/tests/eolian/data/typedef_ref.h +++ b/src/tests/eolian/data/typedef_ref.h @@ -13,7 +13,7 @@ typedef Eo Typedef; typedef int Evas_Coord; -typedef Eina_List *List_Objects; +typedef Eina_Iterator *List_Objects; typedef Evas_Coord Evas_Coord2; diff --git a/src/tests/eolian/data/typedef_ref_stub.h b/src/tests/eolian/data/typedef_ref_stub.h index 0f6f4ec38b..1b18c46031 100644 --- a/src/tests/eolian/data/typedef_ref_stub.h +++ b/src/tests/eolian/data/typedef_ref_stub.h @@ -5,7 +5,7 @@ typedef Eo Typedef; typedef int Evas_Coord; -typedef Eina_List *List_Objects; +typedef Eina_Iterator *List_Objects; typedef Evas_Coord Evas_Coord2; diff --git a/src/tes
[EGIT] [core/efl] master 01/01: eolian_cxx: move tests of list<> to be protected by @beta.
felipealmeida pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=0f49f5e472528bfc992a14ecfc504a2aa2290741 commit 0f49f5e472528bfc992a14ecfc504a2aa2290741 Author: Cedric BAIL Date: Thu Jan 2 15:24:12 2020 -0800 eolian_cxx: move tests of list<> to be protected by @beta. Reviewed-by: Daniel Kolesa Reviewed-by: Felipe Magno de Almeida Differential Revision: https://phab.enlightenment.org/D11047 --- src/tests/eolian_cxx/complex.eo | 36 - src/tests/eolian_cxx/eolian_cxx_test_binding.cc | 13 ++--- src/tests/eolian_cxx/generic.c | 13 - src/tests/eolian_cxx/generic.eo | 13 +++-- 4 files changed, 51 insertions(+), 24 deletions(-) diff --git a/src/tests/eolian_cxx/complex.eo b/src/tests/eolian_cxx/complex.eo index a87391d83b..4ec79fb0af 100644 --- a/src/tests/eolian_cxx/complex.eo +++ b/src/tests/eolian_cxx/complex.eo @@ -3,47 +3,47 @@ class Complex extends Efl.Object data: Complex_Data; methods { // container test - inptrcont { + inptrcont @beta { params { l: list; } } - inclasscont { + inclasscont @beta { params { l: list; } } - incontcont { + incontcont @beta { params { l: list>; } } - incontcontown { + incontcontown @beta { params { l: list> @move; } } - incontowncontown { + incontowncontown @beta { params { l: list @move> @move; } } - incontowncont { + incontowncont @beta { params { l: list @move>; } } - instringcont { + instringcont @beta { params { l: list; } } - instringowncont { + instringowncont @beta { params { l: list; } } - instringcontown { + instringcontown @beta { params { l: list @move; } @@ -89,42 +89,42 @@ class Complex extends Efl.Object } } // out - outclasscont { + outclasscont @beta { params { @out l: list; } } - outcontcont { + outcontcont @beta { params { @out l: list>; } } - outcontcontown { + outcontcontown @beta { params { @out l: list> @move; } } - outcontowncontown { + outcontowncontown @beta { params { @out l: list @move> @move; } } - outcontowncont { + outcontowncont @beta { params { @out l: list @move>; } } - outstringcont { + outstringcont @beta { params { @out l: list; } } - outstringowncont { + outstringowncont @beta { params { @out l: list; } } - outstringcontown { + outstringcontown @beta { params { @out l: list @move; } @@ -169,7 +169,7 @@ class Complex extends Efl.Object @out l: accessor @move; } } - foo { + foo @beta { params { l: list; } diff --git a/src/tests/eolian_cxx/eolian_cxx_test_binding.cc b/src/tests/eolian_cxx/eolian_cxx_test_binding.cc index c6e0381551..98020bf919 100644 --- a/src/tests/eolian_cxx/eolian_cxx_test_binding.cc +++ b/src/tests/eolian_cxx/eolian_cxx_test_binding.cc @@ -21,6 +21,7 @@ #include +#define GENERIC_BETA #include #include #include @@ -160,8 +161,8 @@ EFL_START_TEST(eolian_cxx_test_type_callback) efl::eo::eo_init i; bool event1 = false, event2 = false, event3 = false, event4 = false -, event5 = false; - +, event5 = false, event6 = false; + nonamespace::Generic g(efl::eo::instantiate); efl::eolian::event_add(g.prefix_event1_event, g, [&] (nonamespace::Generic) { @@ -183,22 +184,28 @@ EFL_START_TEST(eolian_cxx_test_type_callback) // FIXME eina::range_array is incompatible with eina::string_view //ck_assert(*e.begin() == efl::eina::string_view{"42"}); }); - efl::eolian::event_add(g.prefix_event5_event, g, [&] (nonamespace::Generic, Generic_Event) + efl::eolian::event_add(g.prefix_event5_event, g, [&] (nonamespace::Generic, Generic_Beta_Event) { event5 = true; }); + efl::eolian::event_add(g.prefix_event6_event, g, [&] (nonamespace::Generic, Generic_Event) + { + event6 = true; + }); g.call_event1(); g.call_event2();
[EGIT] [core/efl] master 04/04: elementary: enable collection view test to wait for "child.selected" event.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=33c3cb3667be8ea2889998a10459d98fceba139f commit 33c3cb3667be8ea2889998a10459d98fceba139f Author: Cedric BAIL Date: Fri Jan 3 15:36:22 2020 -0800 elementary: enable collection view test to wait for "child.selected" event. Reviewed-by: Mike Blumenkrantz Differential Revision: https://phab.enlightenment.org/D11015 --- src/tests/elementary/efl_ui_test_collection_view.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tests/elementary/efl_ui_test_collection_view.c b/src/tests/elementary/efl_ui_test_collection_view.c index 8740fdb623..d064203ffb 100644 --- a/src/tests/elementary/efl_ui_test_collection_view.c +++ b/src/tests/elementary/efl_ui_test_collection_view.c @@ -139,11 +139,11 @@ EFL_START_TEST(test_efl_ui_collection_view_select) sel_val = efl_model_property_get(model, "child.selected"); ck_assert(eina_value_type_get(sel_val) == EINA_VALUE_TYPE_ERROR); + efl_future_then(model, efl_model_property_ready_get(model, "child.selected"), .success = _quit); + click_object_at(lv, 50, 5); - get_me_to_those_events(lv); + ecore_main_loop_begin(); - //efl_future_then(model, efl_model_property_ready_get(model, "child.selected"), .success = _quit); - //ecore_main_loop_begin(); sel_val = efl_model_property_get(model, "child.selected"); ck_assert(eina_value_type_get(sel_val) == EINA_VALUE_TYPE_ULONG); ck_assert(eina_value_ulong_get(sel_val, )); --
[EGIT] [core/efl] master 01/04: elementary: properly propagate "child.selected" change.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=9ac976b079dae2e0355216af26f671837c9e5dc2 commit 9ac976b079dae2e0355216af26f671837c9e5dc2 Author: Cedric BAIL Date: Fri Jan 3 15:35:17 2020 -0800 elementary: properly propagate "child.selected" change. Reviewed-by: Mike Blumenkrantz Differential Revision: https://phab.enlightenment.org/D11013 --- src/lib/elementary/efl_ui_select_model.c | 38 ++-- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/src/lib/elementary/efl_ui_select_model.c b/src/lib/elementary/efl_ui_select_model.c index 6852b50b40..fde6cca4c7 100644 --- a/src/lib/elementary/efl_ui_select_model.c +++ b/src/lib/elementary/efl_ui_select_model.c @@ -24,10 +24,15 @@ struct _Efl_Ui_Select_Model_Data Efl_Ui_Select_Model *last_model; Efl_Ui_Select_Mode selection; - - Eina_Bool none : 1; }; +static void +_efl_ui_select_model_apply_last_model(Eo *obj, Efl_Ui_Select_Model_Data *pd, Eo *last_model) +{ + efl_replace(>last_model, last_model); + efl_model_properties_changed(obj, "child.selected"); +} + static void _efl_ui_select_model_child_removed(void *data, const Efl_Event *event) { @@ -35,7 +40,7 @@ _efl_ui_select_model_child_removed(void *data, const Efl_Event *event) Efl_Model_Children_Event *ev = event->info; if (ev->child == pd->last_model) - efl_replace(>last_model, NULL); + _efl_ui_select_model_apply_last_model(event->object, pd, NULL); } static Eo* @@ -49,7 +54,6 @@ _efl_ui_select_model_efl_object_constructor(Eo *obj, efl_boolean_model_boolean_add(obj, "selected", EINA_FALSE); efl_event_callback_add(obj, EFL_MODEL_EVENT_CHILD_REMOVED, _efl_ui_select_model_child_removed, pd); - pd->none = EINA_TRUE; parent = efl_parent_get(obj); if (efl_isa(parent, EFL_UI_SELECT_MODEL_CLASS)) @@ -64,7 +68,6 @@ _efl_ui_select_model_efl_object_invalidate(Eo *obj, { efl_replace(>fallback_model, NULL); efl_replace(>last_model, NULL); - pd->none = EINA_TRUE; efl_invalidate(efl_super(obj, EFL_UI_SELECT_MODEL_CLASS)); } @@ -75,7 +78,7 @@ _efl_ui_select_model_fallback(Efl_Ui_Select_Model_Data *pd) Eina_Value selected; if (!pd->parent) return; - if (!pd->parent->none) return; + if (!pd->parent->last_model) return; if (!pd->parent->fallback_model) return; // I think it only make sense to trigger the fallback on single mode if (pd->parent->selection != EFL_UI_SELECT_MODE_SINGLE) return; @@ -129,8 +132,7 @@ _commit_change(Eo *child, void *data EINA_UNUSED, const Eina_Value v) if (selflag) { // select case -pd->none = EINA_FALSE; -efl_replace(>last_model, child); +_efl_ui_select_model_apply_last_model(parent, pd, child); efl_event_callback_call(child, EFL_UI_SELECT_MODEL_EVENT_SELECTED, child); } else @@ -139,8 +141,7 @@ _commit_change(Eo *child, void *data EINA_UNUSED, const Eina_Value v) // There should only be one model which represent the same data at all in memory if (pd->last_model == child) // direct comparison of pointer is ok { - efl_replace(>last_model, NULL); - pd->none = EINA_TRUE; + _efl_ui_select_model_apply_last_model(parent, pd, NULL); // Just in case we need to refill the fallback _efl_ui_select_model_fallback(pd); @@ -401,13 +402,12 @@ _efl_ui_select_model_efl_model_property_set(Eo *obj, { if (pd->parent->last_model == obj && !newflag) { - efl_replace(>last_model, NULL); - pd->parent->none = EINA_TRUE; + _efl_ui_select_model_apply_last_model(efl_parent_get(obj), pd->parent, NULL); _efl_ui_select_model_fallback(pd); } } - else + else if (pd->parent->last_model) { Eo *parent; unsigned long selected = 0; @@ -431,6 +431,10 @@ _efl_ui_select_model_efl_model_property_set(Eo *obj, .error = _untangle_error, .free = _untangle_free); } + else + { + _efl_ui_select_model_apply_last_model(efl_parent_get(obj), pd->parent, obj); + } } return efl_future_then(efl_ref(obj), chain, @@ -450,10 +454,10 @@ _efl_ui_select_model_efl_model_property_get(const Eo *obj, Efl_Ui_Select_Model_D // Last selected child if (eina_streq("child.selected", property)) { -if (pd->none) - return eina_value_error_new(EFL_MODEL_ERROR_INC
[EGIT] [core/efl] master 02/04: elementary: add proper test for "child.selected" propagation.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=52d0452f0ddfd0c9c4305c71914b963fab7d2230 commit 52d0452f0ddfd0c9c4305c71914b963fab7d2230 Author: Cedric BAIL Date: Fri Jan 3 15:35:49 2020 -0800 elementary: add proper test for "child.selected" propagation. Reviewed-by: Mike Blumenkrantz Differential Revision: https://phab.enlightenment.org/D11014 --- src/tests/elementary/efl_ui_test_select_model.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tests/elementary/efl_ui_test_select_model.c b/src/tests/elementary/efl_ui_test_select_model.c index 12d5e6e148..78259085a3 100644 --- a/src/tests/elementary/efl_ui_test_select_model.c +++ b/src/tests/elementary/efl_ui_test_select_model.c @@ -102,8 +102,11 @@ EFL_START_TEST(efl_test_select_model) model = efl_add_ref(EFL_UI_SELECT_MODEL_CLASS, efl_main_loop_get(), efl_ui_view_model_set(efl_added, base_model)); ck_assert(!!model); - future = efl_model_property_set(model, "child.selected", eina_value_int_new(2)); + + future = efl_model_property_ready_get(model, "child.selected"); eina_future_then(future, _wait_propagate, NULL, NULL); + + efl_model_property_set(model, "child.selected", eina_value_int_new(2)); ecore_main_loop_begin(); future = efl_model_children_slice_get(model, 0, efl_model_children_count_get(model)); @@ -120,6 +123,8 @@ EFL_START_TEST(efl_test_select_model) EINA_ITERATOR_FOREACH(it, index) fail_if(*index == 2); eina_iterator_free(it); + + efl_model_property_set(model, "child.selected", eina_value_int_new(1)); } EFL_END_TEST --
[EGIT] [core/efl] master 01/02: evas: don't initialize font multiple time.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=4e6fd08306702784e9f8f12f2f278c6567c52dcc commit 4e6fd08306702784e9f8f12f2f278c6567c52dcc Author: Cedric BAIL Date: Fri Dec 27 13:50:48 2019 -0800 evas: don't initialize font multiple time. After splitting font family and size set operation, expedite lost a 10% speed due to doing a double initialization (Once when the family is set and one when the size is set). This was noticable in a few tight running tests. This patch enforce that no initialization is called until the size and the family are set. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D10976 --- src/lib/evas/canvas/evas_object_text.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/evas/canvas/evas_object_text.c b/src/lib/evas/canvas/evas_object_text.c index 6cacf8e899..e016585591 100644 --- a/src/lib/evas/canvas/evas_object_text.c +++ b/src/lib/evas/canvas/evas_object_text.c @@ -410,6 +410,8 @@ _evas_text_font_reload(Eo *eo_obj, Evas_Text_Data *o) Eina_Bool source_invisible = EINA_FALSE; Eina_List *was = NULL; + if (o->cur.size == 0 || (!o->cur.font && !o->cur.source)) return ; + if (!(obj->layer->evas->is_frozen)) { pass = evas_event_passes_through(eo_obj, obj); --
[EGIT] [core/efl] master 02/02: elementary: make sure that our index for the maximum number of object is actually unsigned int bound.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=4624b56bedad0d19426f55470649ade41cf55753 commit 4624b56bedad0d19426f55470649ade41cf55753 Author: Cedric BAIL Date: Thu Dec 19 10:47:57 2019 -0800 elementary: make sure that our index for the maximum number of object is actually unsigned int bound. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D10927 --- src/lib/elementary/efl_ui_collection.c | 5 ++-- src/lib/elementary/efl_ui_collection_view.c| 10 +++ .../elementary/efl_ui_position_manager_entity.eo | 3 +- src/lib/elementary/efl_ui_position_manager_grid.c | 35 +++--- src/lib/elementary/efl_ui_position_manager_list.c | 27 - 5 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/lib/elementary/efl_ui_collection.c b/src/lib/elementary/efl_ui_collection.c index 53afb10743..53eb344d4e 100644 --- a/src/lib/elementary/efl_ui_collection.c +++ b/src/lib/elementary/efl_ui_collection.c @@ -1208,8 +1208,9 @@ _efl_ui_collection_focus_manager_efl_ui_focus_manager_request_move(Eo *obj, Efl_ if (ITEM_IS_OUTSIDE_VISIBLE(item_id)) { -int new_id = efl_ui_position_manager_entity_relative_item(collection_pd->pos_man, efl_ui_item_index_get(item), direction); -if (new_id == -1) +unsigned int new_id; + +if (!efl_ui_position_manager_entity_relative_item(collection_pd->pos_man, efl_ui_item_index_get(item), direction, _id)) { new_item = NULL; } diff --git a/src/lib/elementary/efl_ui_collection_view.c b/src/lib/elementary/efl_ui_collection_view.c index 6cf7635223..433f5d3511 100644 --- a/src/lib/elementary/efl_ui_collection_view.c +++ b/src/lib/elementary/efl_ui_collection_view.c @@ -2430,12 +2430,12 @@ _efl_ui_collection_view_focus_manager_efl_ui_focus_manager_request_move(Eo *obj, if (ITEM_IS_OUTSIDE_VISIBLE(item_id)) { -int new_id; +unsigned int new_id; -new_id = efl_ui_position_manager_entity_relative_item(cpd->manager, - item_id, - direction); -if (new_id < 0) +if (!efl_ui_position_manager_entity_relative_item(cpd->manager, + item_id, + direction, + _id)) { new_item = NULL; } diff --git a/src/lib/elementary/efl_ui_position_manager_entity.eo b/src/lib/elementary/efl_ui_position_manager_entity.eo index f75711f915..368e7cb034 100644 --- a/src/lib/elementary/efl_ui_position_manager_entity.eo +++ b/src/lib/elementary/efl_ui_position_manager_entity.eo @@ -107,8 +107,9 @@ interface @beta Efl.Ui.Position_Manager.Entity extends Efl.Ui.Layout_Orientable params { current_id : uint; [[The id where the direction is oriented at]] direction : Efl.Ui.Focus.Direction; [[The direction where the new id is]] + @out index: uint; [[The relative item index after the translation has been applied.]] } -return : int; [[The id of the item in that direction, or -1 if there is no item in that direction]] +return : bool; [[$true if there is a next item, $false otherwise.]] } } events { diff --git a/src/lib/elementary/efl_ui_position_manager_grid.c b/src/lib/elementary/efl_ui_position_manager_grid.c index 2cec569d44..59aabbe2b2 100644 --- a/src/lib/elementary/efl_ui_position_manager_grid.c +++ b/src/lib/elementary/efl_ui_position_manager_grid.c @@ -738,35 +738,34 @@ _efl_ui_position_manager_grid_efl_ui_position_manager_entity_position_single_ite return geom; } -EOLIAN static int -_efl_ui_position_manager_grid_efl_ui_position_manager_entity_relative_item(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_Grid_Data *pd, unsigned int current_id, Efl_Ui_Focus_Direction direction) +EOLIAN static Eina_Bool +_efl_ui_position_manager_grid_efl_ui_position_manager_entity_relative_item(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_Grid_Data *pd, unsigned int current_id, Efl_Ui_Focus_Direction direction, unsigned int *index) { - int new_id = current_id; switch(direction) { case EFL_UI_FOCUS_DIRECTION_RIGHT: case EFL_UI_FOCUS_DIRECTION_NEXT: - new_id += 1; -break; + if (current_id + 1 >= pd->size) return EINA_FALSE; + current_id += 1; + break; case EFL_UI_FOCUS_DIRECTION_LEFT: case EFL_UI_FOCUS_DIRECTION_PREVIOUS: - new_id -= 1; -break; + if (current_id == 0) return EINA_FALSE; + current_id -= 1; + break; case EFL_UI_FOCUS_DIRECTION_UP: - /
[EGIT] [core/efl] master 01/02: elementary: improve focus memory for Efl.Ui.CollectionView.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=6756485476c0182e46b13471ba74a87a00c47702 commit 6756485476c0182e46b13471ba74a87a00c47702 Author: Cedric BAIL Date: Thu Nov 14 17:11:03 2019 -0800 elementary: improve focus memory for Efl.Ui.CollectionView. This patch will make the CollectionView remember at all time the last focus object and the last item in the list. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D10677 --- src/lib/elementary/efl_ui_collection_view.c | 166 1 file changed, 144 insertions(+), 22 deletions(-) diff --git a/src/lib/elementary/efl_ui_collection_view.c b/src/lib/elementary/efl_ui_collection_view.c index 75210982ce..6cf7635223 100644 --- a/src/lib/elementary/efl_ui_collection_view.c +++ b/src/lib/elementary/efl_ui_collection_view.c @@ -79,6 +79,11 @@ struct _Efl_Ui_Collection_View_Data Eina_List *requests; // Array of Efl_Ui_Collection_Request in progress + struct { + Efl_Gfx_Entity *last; // The last item of the collection, so focus can start by the end if necessary. + Efl_Gfx_Entity *previously; // The previously selected item in the collection, so focus can come back to it. + } focus; + unsigned int start_id; unsigned int end_id; @@ -293,6 +298,9 @@ _all_cleanup(Efl_Ui_Collection_View *obj, Efl_Ui_Collection_View_Data *pd) } #endif + efl_replace(>focus.previously, NULL); + efl_replace(>focus.last, NULL); + EINA_LIST_FOREACH_SAFE(pd->requests, l, ll, request) eina_future_cancel(request->f); } @@ -485,6 +493,33 @@ _entity_fetch_cb(Eo *obj, void *data EINA_UNUSED, const Eina_Value v) return eina_future_as_value(r); } +static inline unsigned int +_lookup_entity_index(Efl_Gfx_Entity *entity, Efl_Model **model) +{ + Efl_Model *fetch; + + fetch = efl_ui_view_model_get(entity); + if (model) *model = fetch; + return efl_composite_model_index_get(fetch); +} + +static void +_last_entity_update(Efl_Ui_Collection_View_Data *pd, Efl_Gfx_Entity *entity) +{ + Efl_Model *new_model, *old_model; + unsigned int new_index, old_index; + + if (!pd->focus.last) goto replace; + + new_index = _lookup_entity_index(entity, _model); + old_index = _lookup_entity_index(pd->focus.last, _model); + + if (new_index <= old_index) return; + + replace: + efl_replace(>focus.last, entity); +} + static inline Eina_Bool _entity_propagate(Efl_Model *model, Efl_Gfx_Entity *entity) { @@ -634,6 +669,9 @@ _entity_fetched_cb(Eo *obj, void *data, const Eina_Value v) evas_event_thaw(e); evas_event_thaw_eval(e); + // Check if the last child is also the list item in the list + _last_entity_update(pd, child); + // Currently position manager will flush its entire size cache on update, so only do // it when necessary to improve performance. if (updated_size || request->need_size) @@ -667,6 +705,54 @@ _entity_free_cb(Eo *o, void *data, const Eina_Future *dead_future EINA_UNUSED) free(request); } +static Eina_Bool +_focus_lookup(Efl_Ui_Collection_View_Data *pd, unsigned int search_index, + Efl_Gfx_Entity **entity, Efl_Model **model) +{ + unsigned int idx; + + if (entity) *entity = pd->focus.last; + if (pd->focus.last) + { +idx = _lookup_entity_index(pd->focus.last, model); +if (idx == search_index) return EINA_TRUE; + } + if (entity) *entity = pd->focus.previously; + if (pd->focus.previously) + { +idx = _lookup_entity_index(pd->focus.previously, model); +if (idx == search_index) return EINA_TRUE; + } + + if (entity) *entity = NULL; + if (model) *model = NULL; + return EINA_FALSE; +} + +static Efl_Ui_Collection_Item_Lookup * +_build_from_focus(Efl_Ui_Collection_View_Data *pd, unsigned int search_index, + Efl_Model **model) +{ + Efl_Ui_Collection_Item_Lookup *insert; + Efl_Gfx_Entity *entity = NULL; + + // Not found in the cache lookup, but just maybe + if (!_focus_lookup(pd, search_index, , model)) return NULL; + + // Lucky us, let's add it to the cache + insert = calloc(1, sizeof (Efl_Ui_Collection_Item_Lookup)); + if (!insert) return NULL; + + insert->index = search_index; + insert->item.model = efl_ref(*model); + insert->item.entity = efl_ref(entity); + + pd->cache = eina_rbtree_inline_insert(pd->cache, EINA_RBTREE_GET(insert), + _cache_tree_cmp, NULL); + + return insert; +} + static Eina_List * _cache_size_fetch(Eina_List *requests, Efl_Ui_Collection_Request **request, Efl_Ui_Collection_View_Data *pd, @@ -675,7 +761,7 @@ _cache_size_fetch(Eina_List *requests, Efl_Ui_Collection_Request **request, Eina_Size2D item_base) { Efl_Ui_Collection_Item_Lookup *lookup; - Efl_Model *model; + Ef
[EGIT] [core/efl] master 01/01: elementary: enforce container type check for efl_ui_item_index_get and improve documentation.
zmike pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=7d16c344c17a81e268d8d0bd945444b73487631b commit 7d16c344c17a81e268d8d0bd945444b73487631b Author: Cedric BAIL Date: Tue Dec 24 09:20:11 2019 -0500 elementary: enforce container type check for efl_ui_item_index_get and improve documentation. Summary: Depends on D10927 Reviewers: bu5hm4n, segfaultxavi, SanghyeonLee Reviewed By: SanghyeonLee Subscribers: zmike, #reviewers, #committers Tags: #efl Maniphest Tasks: T8351 Differential Revision: https://phab.enlightenment.org/D10945 --- src/lib/elementary/efl_ui_item.c | 2 ++ src/lib/elementary/efl_ui_item.eo | 6 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/elementary/efl_ui_item.c b/src/lib/elementary/efl_ui_item.c index 5d86dc934d..85b50ee758 100644 --- a/src/lib/elementary/efl_ui_item.c +++ b/src/lib/elementary/efl_ui_item.c @@ -147,6 +147,8 @@ _efl_ui_item_efl_object_destructor(Eo *obj, Efl_Ui_Item_Data *pd EINA_UNUSED) EOLIAN static int _efl_ui_item_index_get(const Eo *obj, Efl_Ui_Item_Data *pd) { + EINA_SAFETY_ON_NULL_RETURN_VAL(pd->container, -1); + EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(pd->container, EFL_PACK_LINEAR_INTERFACE), -1); return efl_pack_index_get(pd->container, obj); } diff --git a/src/lib/elementary/efl_ui_item.eo b/src/lib/elementary/efl_ui_item.eo index e692f12a74..016636dfa0 100644 --- a/src/lib/elementary/efl_ui_item.eo +++ b/src/lib/elementary/efl_ui_item.eo @@ -27,7 +27,11 @@ abstract Efl.Ui.Item extends Efl.Ui.Layout_Base implements Efl.Ui.Selectable, Ef @property index { [[The index of this item inside its container. - The container must be set through the @Efl.Ui.Item.container property.]] + The container must be set through the @Efl.Ui.Item.container property and be exposing an @Efl.Pack_Linear interface. + If the container is not an @Efl.Pack_Linear, -1 will be returned. + + Finally, it is a very slow API that must not be used in any performance constrained case. + ]] get {} values { index : int; [[The index where to find this item in its @.container.]] --
[EGIT] [core/efl] master 01/01: elementary: make sure Efl.Ui.Multi_Selectable_Index_Range use unsigned int for index too.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=0a399b3ca37dcd9f8c4d722f091b783302f37c47 commit 0a399b3ca37dcd9f8c4d722f091b783302f37c47 Author: Cedric BAIL Date: Wed Dec 18 11:34:00 2019 -0800 elementary: make sure Efl.Ui.Multi_Selectable_Index_Range use unsigned int for index too. T8469 Reviewed-by: SangHyeon Jade Lee Differential Revision: https://phab.enlightenment.org/D10910 --- .../elementary/efl_ui_multi_selectable_index_range.eo| 12 ++-- src/lib/elementary/efl_ui_select_model.c | 16 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/lib/elementary/efl_ui_multi_selectable_index_range.eo b/src/lib/elementary/efl_ui_multi_selectable_index_range.eo index 797e7bcee6..fd683fbd06 100644 --- a/src/lib/elementary/efl_ui_multi_selectable_index_range.eo +++ b/src/lib/elementary/efl_ui_multi_selectable_index_range.eo @@ -16,13 +16,13 @@ interface Efl.Ui.Multi_Selectable_Index_Range extends Efl.Ui.Multi_Selectable selected_ndx_iterator_new { [[Gets an iterator over the indices of all the selected children. ]] - return: iterator @move @no_unused; [[The iterator gives the indices of the selected children. + return: iterator @move @no_unused; [[The iterator gives the indices of the selected children. It is valid until any change is made to the selection state.]] } unselected_ndx_iterator_new { [[Gets an iterator over the indices of all the unselected children. ]] - return: iterator @move @no_unused; [[The iterator gives the indices of the unselected children. + return: iterator @move @no_unused; [[The iterator gives the indices of the unselected children. It is valid until any change is made to the selection state.]] } ndx_range_select @beta { @@ -34,8 +34,8 @@ interface Efl.Ui.Multi_Selectable_Index_Range extends Efl.Ui.Multi_Selectable $NULL is not allowed as either of the parameters. ]] params { - a : uint64; [[One side of the range.]] - b : uint64; [[The other side of the range.]] + a : uint; [[One side of the range.]] + b : uint; [[The other side of the range.]] } } ndx_range_unselect @beta { @@ -48,8 +48,8 @@ interface Efl.Ui.Multi_Selectable_Index_Range extends Efl.Ui.Multi_Selectable Both of the passed values will also be unselected. ]] params { - a : uint64; [[One side of the range.]] - b : uint64; [[The other side of the range.]] + a : uint; [[One side of the range.]] + b : uint; [[The other side of the range.]] } } } diff --git a/src/lib/elementary/efl_ui_select_model.c b/src/lib/elementary/efl_ui_select_model.c index 016f720a15..6852b50b40 100644 --- a/src/lib/elementary/efl_ui_select_model.c +++ b/src/lib/elementary/efl_ui_select_model.c @@ -536,7 +536,7 @@ static void _efl_ui_select_model_efl_ui_multi_selectable_all_select(Eo *obj, Efl_Ui_Select_Model_Data *pd EINA_UNUSED) { - unsigned long count, i; + unsigned int count, i; // Not the fastest way to implement it, but will reuse more code and be easier as a v1. // It also make it not very async which could be noticable. @@ -544,7 +544,7 @@ _efl_ui_select_model_efl_ui_multi_selectable_all_select(Eo *obj, for (i = 0; i < count; i++) { -Eina_Value p = eina_value_ulong_init(i); +Eina_Value p = eina_value_uint_init(i); efl_model_property_set(obj, "child.selected", ); @@ -554,17 +554,17 @@ _efl_ui_select_model_efl_ui_multi_selectable_all_select(Eo *obj, static void _efl_ui_select_model_efl_ui_multi_selectable_all_unselect(Eo *obj, - Efl_Ui_Select_Model_Data *pd EINA_UNUSED) + Efl_Ui_Select_Model_Data *pd EINA_UNUSED) { - uint64_t count = efl_model_children_count_get(obj); + unsigned int count = efl_model_children_count_get(obj); efl_ui_multi_selectable_ndx_range_unselect(obj, 0, count - 1); } static void _efl_ui_select_model_efl_ui_multi_selectable_index_range_ndx_range_select(Eo *obj, - Efl_Ui_Select_Model_Data *pd EINA_UNUSED, -uint64_t a, uint64_t b) + Efl_Ui_Select_Model_Data *pd EINA_UNUSED, + unsigned int a, unsigned int b) { unsigned
[EGIT] [core/efl] master 01/01: efl: make sure all index for Efl_Model are unsigned int.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=52aa2f629f9e63c22d9fa641daf30f9ff8f957ee commit 52aa2f629f9e63c22d9fa641daf30f9ff8f957ee Author: Cedric BAIL Date: Thu Dec 12 17:13:30 2019 -0800 efl: make sure all index for Efl_Model are unsigned int. T8469 Reviewed-by: SangHyeon Jade Lee Differential Revision: https://phab.enlightenment.org/D10869 --- src/lib/ecore/efl_boolean_model.c | 6 +- src/lib/ecore/efl_filter_model.c| 24 +++ src/lib/elementary/efl_ui_collection_view.c | 94 - src/tests/elementary/efl_ui_test_select_model.c | 2 +- 4 files changed, 63 insertions(+), 63 deletions(-) diff --git a/src/lib/ecore/efl_boolean_model.c b/src/lib/ecore/efl_boolean_model.c index 552baf1096..9e61ce398d 100644 --- a/src/lib/ecore/efl_boolean_model.c +++ b/src/lib/ecore/efl_boolean_model.c @@ -406,8 +406,8 @@ struct _Eina_Iterator_Boolean Efl_Boolean_Model_Storage_Range *sr; Eina_Iterator *infix; - uint64_t index; - uint64_t total; + unsigned int index; + unsigned int total; Eina_Bool request; }; @@ -423,7 +423,7 @@ _efl_boolean_model_iterator_storage_index_find(Eina_Iterator_Boolean *it) while (offset < it->sr->length) { -uint64_t upidx; +unsigned int upidx; upidx = offset >> 3; diff --git a/src/lib/ecore/efl_filter_model.c b/src/lib/ecore/efl_filter_model.c index a382b7bd92..cc18dca89b 100644 --- a/src/lib/ecore/efl_filter_model.c +++ b/src/lib/ecore/efl_filter_model.c @@ -11,8 +11,8 @@ struct _Efl_Filter_Model_Mapping { EINA_RBTREE; - uint64_t original; - uint64_t mapped; + unsigned int original; + unsigned int mapped; EINA_REFCOUNT; }; @@ -28,10 +28,10 @@ struct _Efl_Filter_Model_Data void *data; EflFilterModel cb; Eina_Free_Cb free_cb; - uint64_t count; + unsigned int count; } filter; - uint64_t counted; + unsigned int counted; Eina_Bool counting_started : 1; Eina_Bool processed : 1; }; @@ -54,7 +54,7 @@ _filter_mapping_looking_cb(const Eina_Rbtree *node, const void *key, int length EINA_UNUSED, void *data EINA_UNUSED) { const Efl_Filter_Model_Mapping *n = (const Efl_Filter_Model_Mapping *) node; - const uint64_t *k = key; + const unsigned int *k = key; return n->mapped - *k; } @@ -85,7 +85,7 @@ struct _Efl_Filter_Request Efl_Filter_Model_Data *pd; Efl_Model *parent; Efl_Model *child; - uint64_t index; + unsigned int index; }; static Efl_Filter_Model * @@ -243,7 +243,7 @@ _efl_filter_model_child_removed(void *data, const Efl_Event *event) Efl_Filter_Model_Mapping *mapping; Efl_Filter_Model_Data *pd = data; Efl_Model_Children_Event *ev = event->info; - uint64_t removed = ev->index; + unsigned int removed = ev->index; mapping = (void *)eina_rbtree_inline_lookup(pd->mapping, , sizeof (uint64_t), @@ -370,10 +370,10 @@ _efl_filter_model_efl_model_children_slice_get(Eo *obj, Efl_Filter_Model_Data *p for (i = 0; i < count; i++) { -uint64_t lookup = start + i; +unsigned int lookup = start + i; mapping[i] = (void *)eina_rbtree_inline_lookup(pd->mapping, - , sizeof (uint64_t), + , sizeof (unsigned int), _filter_mapping_looking_cb, NULL); if (!mapping[i]) goto on_error; } @@ -410,7 +410,7 @@ typedef struct _Efl_Filter_Model_Result Efl_Filter_Model_Result; struct _Efl_Filter_Model_Result { Efl_Filter_Model_Data *pd; - uint64_t count; + unsigned int count; Efl_Model *targets[1]; }; @@ -422,7 +422,7 @@ _efl_filter_model_array_result_request(Eo *o EINA_UNUSED, void *data, const Eina Efl_Filter_Model_Data *pd = req->pd; unsigned int i, len; Eina_Value request = EINA_VALUE_EMPTY; - uint64_t pcount = pd->filter.count; + unsigned int pcount = pd->filter.count; EINA_VALUE_ARRAY_FOREACH(, len, i, request) { @@ -465,7 +465,7 @@ static void _efl_filter_model_array_result_free(Eo *o EINA_UNUSED, void *data, const Eina_Future *dead_future EINA_UNUSED) { Efl_Filter_Model_Result *req = data; - uint64_t i; + unsigned int i; for (i = 0; i < req->count; i++) efl_unref(req->targets[i]); diff --git a/src/lib/elementary/efl_ui_collection_view.c b/src/lib/elementary/efl_ui_collection_view.c index 2598849f36..75210982ce 100644 --- a/src/lib/elementary/efl_ui_collection_view.c +++ b/src/lib/elementary/efl_ui_collection_view.c @@ -38,7 +38,7 @@ struct _Efl_Ui_Collection_Item_Lookup { EINA_RBTREE; - uint64_t index; + unsigned int index; Efl_Ui_Collection_Item item; };
[EGIT] [core/efl] master 01/04: elementary: reduce event generation during object creation by Efl.Ui.WidgetFactory.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=b9e0d25a4c44cbeae5e2a18380113181281c9f3e commit b9e0d25a4c44cbeae5e2a18380113181281c9f3e Author: Cedric BAIL Date: Fri Nov 15 10:55:09 2019 -0800 elementary: reduce event generation during object creation by Efl.Ui.WidgetFactory. We can not freeze the canvas in all scenario as we are sometime building widget fully asynchronously which prevent holding events on the canvas. Still it is better to do it for the case we can. Reviewed-by: SangHyeon Jade Lee Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D10685 --- src/lib/elementary/efl_ui_widget_factory.c | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/lib/elementary/efl_ui_widget_factory.c b/src/lib/elementary/efl_ui_widget_factory.c index 5ab9477a85..43c9d27c5e 100644 --- a/src/lib/elementary/efl_ui_widget_factory.c +++ b/src/lib/elementary/efl_ui_widget_factory.c @@ -279,6 +279,10 @@ _efl_ui_widget_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Widget_Factory_Data { Efl_Ui_Widget *w = NULL; Eina_Value r; +Evas *e; + +e = evas_object_evas_get(obj); +evas_event_freeze(e); eina_value_array_setup(, EINA_VALUE_TYPE_OBJECT, 4); @@ -286,11 +290,19 @@ _efl_ui_widget_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Widget_Factory_Data { w = _efl_ui_widget_create(obj, pd->klass, pd->parenting_widget, model); - if (!w) return efl_loop_future_rejected(obj, ENOMEM); + if (!w) + { + evas_event_thaw(e); + evas_event_thaw_eval(e); + return efl_loop_future_rejected(obj, ENOMEM); + } eina_value_array_append(, w); } eina_iterator_free(models); +evas_event_thaw(e); +evas_event_thaw_eval(e); + return efl_loop_future_resolved(obj, r); } --
[EGIT] [core/efl] master 04/04: elementary: improve data layout for Efl.Ui.PositionManager*.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=8331ea048cfafd7afc007456d7b38209e862c3b0 commit 8331ea048cfafd7afc007456d7b38209e862c3b0 Author: Cedric BAIL Date: Fri Nov 15 11:19:28 2019 -0800 elementary: improve data layout for Efl.Ui.PositionManager*. Reviewed-by: SangHyeon Jade Lee Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D10688 --- src/lib/elementary/efl_ui_position_manager_grid.c | 31 +-- src/lib/elementary/efl_ui_position_manager_list.c | 19 +- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/src/lib/elementary/efl_ui_position_manager_grid.c b/src/lib/elementary/efl_ui_position_manager_grid.c index 949cd66e26..2cec569d44 100644 --- a/src/lib/elementary/efl_ui_position_manager_grid.c +++ b/src/lib/elementary/efl_ui_position_manager_grid.c @@ -13,32 +13,37 @@ Efl_Ui_Position_Manager_Grid_Data *pd = efl_data_scope_get(obj, MY_CLASS); typedef struct { - unsigned int size; - unsigned int groups; + Api_Callbacks callbacks; + + Eina_Inarray *group_cache; + int *size_cache; + Eo *last_group; + Eina_Future *rebuild_absolut_size; + Efl_Ui_Win *window; + Evas *canvas; + + Vis_Segment prev_run; + Eina_Rect viewport; Eina_Vector2 scroll_position; - Efl_Ui_Layout_Orientation dir; - Vis_Segment prev_run; - unsigned int prev_consumed_space; Eina_Size2D max_min_size; Eina_Size2D last_viewport_size; Eina_Size2D prev_min_size; - Eina_Inarray *group_cache; + Efl_Ui_Layout_Orientation dir; + + unsigned int size; + unsigned int groups; + unsigned int prev_consumed_space; + Eina_Bool group_cache_dirty; - int *size_cache; Eina_Bool size_cache_dirty; - Eo *last_group; - Eina_Future *rebuild_absolut_size; - Efl_Ui_Win *window; - Evas *canvas; - Api_Callbacks callbacks; } Efl_Ui_Position_Manager_Grid_Data; typedef struct { - Eina_Bool real_group; Eina_Size2D group_header_size; int items; + Eina_Bool real_group; } Group_Cache_Line; static inline void diff --git a/src/lib/elementary/efl_ui_position_manager_list.c b/src/lib/elementary/efl_ui_position_manager_list.c index bd9dd95a08..3980e127ef 100644 --- a/src/lib/elementary/efl_ui_position_manager_list.c +++ b/src/lib/elementary/efl_ui_position_manager_list.c @@ -14,20 +14,25 @@ Efl_Ui_Position_Manager_List_Data *pd = efl_data_scope_get(obj, MY_CLASS); typedef struct { - unsigned int size; + Api_Callbacks callbacks; + Eina_Future *rebuild_absolut_size; + int *size_cache; + Efl_Gfx_Entity *last_group; + Efl_Ui_Win *window; + Evas *canvas; + + Vis_Segment prev_run; + Eina_Rect viewport; Eina_Size2D abs_size; Eina_Vector2 scroll_position; + Efl_Ui_Layout_Orientation dir; - int *size_cache; + + unsigned int size; int average_item_size; int maximum_min_size; - Vis_Segment prev_run; - Efl_Gfx_Entity *last_group; - Efl_Ui_Win *window; - Evas *canvas; - Api_Callbacks callbacks; } Efl_Ui_Position_Manager_List_Data; /* --
[EGIT] [core/efl] master 03/04: elementary: reduce events triggered by Efl.Ui.PositionManager.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=2b324779c996b38f9514c6e6f29c23b1ac6e2b28 commit 2b324779c996b38f9514c6e6f29c23b1ac6e2b28 Author: Cedric BAIL Date: Fri Nov 15 11:05:36 2019 -0800 elementary: reduce events triggered by Efl.Ui.PositionManager. Reviewed-by: SangHyeon Jade Lee Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D10687 --- src/lib/elementary/efl_ui_collection.c | 1 + src/lib/elementary/efl_ui_collection_view.c| 2 ++ .../elementary/efl_ui_position_manager_data_access_v1.eo | 1 + src/lib/elementary/efl_ui_position_manager_grid.c | 9 +++-- src/lib/elementary/efl_ui_position_manager_list.c | 14 -- src/tests/elementary/efl_ui_test_position_manager_common.c | 1 + 6 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/lib/elementary/efl_ui_collection.c b/src/lib/elementary/efl_ui_collection.c index 3e54f79b24..43b1b19521 100644 --- a/src/lib/elementary/efl_ui_collection.c +++ b/src/lib/elementary/efl_ui_collection.c @@ -961,6 +961,7 @@ _efl_ui_collection_position_manager_set(Eo *obj, Efl_Ui_Collection_Data *pd, Efl { case 1: efl_ui_position_manager_data_access_v1_data_access_set(pd->pos_man, +efl_provider_find(obj, EFL_UI_WIN_CLASS), >obj_accessor, _obj_accessor_get_at, NULL, >size_accessor, _size_accessor_get_at, NULL, eina_list_count(pd->items)); diff --git a/src/lib/elementary/efl_ui_collection_view.c b/src/lib/elementary/efl_ui_collection_view.c index 14122c5771..dcf8f91462 100644 --- a/src/lib/elementary/efl_ui_collection_view.c +++ b/src/lib/elementary/efl_ui_collection_view.c @@ -1648,6 +1648,7 @@ _efl_ui_collection_view_position_manager_set(Eo *obj, Efl_Ui_Collection_View_Dat { case 1: efl_ui_position_manager_data_access_v1_data_access_set(pd->manager, +efl_provider_find(obj, EFL_UI_WIN_CLASS), efl_ref(obj), _batch_entity_cb, _unref_cb, efl_ref(obj), _batch_size_cb, _unref_cb, count); @@ -1992,6 +1993,7 @@ _efl_ui_collection_view_model_changed(void *data, const Efl_Event *event) { case 1: efl_ui_position_manager_data_access_v1_data_access_set(pd->manager, + efl_provider_find(data, EFL_UI_WIN_CLASS), efl_ref(data), _batch_entity_cb, _unref_cb, efl_ref(data), _batch_size_cb, _unref_cb, count); diff --git a/src/lib/elementary/efl_ui_position_manager_data_access_v1.eo b/src/lib/elementary/efl_ui_position_manager_data_access_v1.eo index ab55c09c38..d7d42c4ad0 100644 --- a/src/lib/elementary/efl_ui_position_manager_data_access_v1.eo +++ b/src/lib/elementary/efl_ui_position_manager_data_access_v1.eo @@ -116,6 +116,7 @@ interface @beta Efl.Ui.Position_Manager.Data_Access_V1 { set { } values { + canvas: Efl.Ui.Win; [[Will use this object to freeze/thaw canvas events.]] obj_access : Efl.Ui.Position_Manager.Object_Batch_Callback; [[Function callback for canvas objects, even if the start_id is valid, the returned objects may be $NULL.]] diff --git a/src/lib/elementary/efl_ui_position_manager_grid.c b/src/lib/elementary/efl_ui_position_manager_grid.c index 7b0ed303f5..949cd66e26 100644 --- a/src/lib/elementary/efl_ui_position_manager_grid.c +++ b/src/lib/elementary/efl_ui_position_manager_grid.c @@ -30,6 +30,8 @@ typedef struct { Eina_Bool size_cache_dirty; Eo *last_group; Eina_Future *rebuild_absolut_size; + Efl_Ui_Win *window; + Evas *canvas; Api_Callbacks callbacks; } Efl_Ui_Position_Manager_Grid_Data; @@ -769,7 +771,7 @@ _efl_ui_position_manager_grid_efl_ui_position_manager_entity_version(Eo *obj EIN } EOLIAN static void -_efl_ui_position_manager_grid_efl_ui_position_manager_data_access_v1_data_access_set(Eo *obj, Efl_Ui_Position_Manager_Grid_Data *pd, void *obj_access_data, Efl_Ui_Position_Manager_Object_Batch_Callback obj_access, Eina_Free_Cb obj_access_free_cb, void *size_access_data, Efl_Ui_Position_Manager_Size_Batch_Callback size_access, Eina_Free_Cb size_access_free_cb, int size) +_efl_ui_position_manager_grid_efl_ui_position_manager_data_access_v1_data_access_set(Eo *obj, Efl_Ui_Position_Manager_Grid_Data *pd, Efl_Ui_Win *canvas, void *obj_access_data, Efl_Ui_Position_Manager_Object_Batch_Callback obj_access, Eina_Free_Cb obj_access_free_cb, void *size_access_data, Efl_Ui_Position_Manager_Size_Batch_Callback size_access, Eina_Free_Cb size_access_free_cb, int size) { // Cleanup cache first _group_cache_invalidate(obj, pd)
[EGIT] [core/efl] master 02/04: elementary: reduce event trigger during object creation stage in Efl.Ui.CollectionView.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=d62e2585bb7f5661470bf694ee26eef9192ef06b commit d62e2585bb7f5661470bf694ee26eef9192ef06b Author: Cedric BAIL Date: Fri Nov 15 11:02:01 2019 -0800 elementary: reduce event trigger during object creation stage in Efl.Ui.CollectionView. Once the object are created, the CollectionView will do a few modifiction on them before giving this object to the position manager to deal with. Reducing events should slightly improve performance. Reviewed-by: SangHyeon Jade Lee Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D10686 --- src/lib/elementary/efl_ui_collection_view.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/lib/elementary/efl_ui_collection_view.c b/src/lib/elementary/efl_ui_collection_view.c index 4aca77ceb2..14122c5771 100644 --- a/src/lib/elementary/efl_ui_collection_view.c +++ b/src/lib/elementary/efl_ui_collection_view.c @@ -520,6 +520,10 @@ _entity_fetched_cb(Eo *obj, void *data, const Eina_Value v) unsigned int i, len; uint64_t updated_size_start_id = 0, updated_entity_start_id = 0; Eina_Bool updated_size = EINA_FALSE, updated_entity = EINA_FALSE; + Evas *e; + + e = evas_object_evas_get(obj); + evas_event_freeze(e); EINA_VALUE_ARRAY_FOREACH(, len, i, child) { @@ -627,6 +631,9 @@ _entity_fetched_cb(Eo *obj, void *data, const Eina_Value v) } } + evas_event_thaw(e); + evas_event_thaw_eval(e); + // Currently position manager will flush its entire size cache on update, so only do // it when necessary to improve performance. if (updated_size || request->need_size) --
[EGIT] [core/efl] master 05/07: eina: introduce an explicit eina_cow_done with no call to GC.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=e4765e3806eb37e5d2b2fae202550c14bb90ce23 commit e4765e3806eb37e5d2b2fae202550c14bb90ce23 Author: Cedric BAIL Date: Thu Dec 5 18:55:06 2019 -0800 eina: introduce an explicit eina_cow_done with no call to GC. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D10817 --- src/lib/eina/eina_cow.h | 18 ++ 1 file changed, 18 insertions(+) diff --git a/src/lib/eina/eina_cow.h b/src/lib/eina/eina_cow.h index 800371b1ad..4836d3e870 100644 --- a/src/lib/eina/eina_cow.h +++ b/src/lib/eina/eina_cow.h @@ -176,6 +176,24 @@ EAPI Eina_Bool eina_cow_gc(Eina_Cow *cow); } \ while (0); +/** + * @def EINA_COW_WRITE_END_NOGC + * @brief Definition for the macro to close the writeable pointer without triggering the GC. + * + * @param[in,out] Cow The Eina_Cow where the const pointer came from. + * @param[in] Read The const pointer to get a writable handler from. + * @param[in] Write The name of the variable where to put the writeable pointer to. + * + * @since 1.8.0 + * + * @note This macro closes the scope opened by EINA_COW_WRITE_BEGIN(). + */ +#define EINA_COW_WRITE_END_NOGC(Cow, Read, Write) \ + eina_cow_done(Cow, ((const Eina_Cow_Data**)&(Read)), Write, \ + EINA_FALSE);\ +} \ + while (0); + /** * @} */ --
[EGIT] [core/efl] master 03/07: evas: reduce useless allocation during destruction of image.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=119cb085fadb55adf71bd20f2ca30056bc1f commit 119cb085fadb55adf71bd20f2ca30056bc1f Author: Cedric BAIL Date: Thu Dec 5 16:35:23 2019 -0800 evas: reduce useless allocation during destruction of image. Evas image use a GC to reduce duplicated state accross multiple object. Still during shutdown we do clean it up and free it. There is no point to push that down the GC if we are to just free it after. Relying on the fact that dynamic content will avoid triggering the GC altogether as their content change to frequently and is expected to be uniq among other objects, we can avoid unecessary allocation during the destruction by just switching that early on during the destructor. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D10815 --- src/lib/evas/canvas/evas_object_image.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c index 4653aff177..192c4285d5 100644 --- a/src/lib/evas/canvas/evas_object_image.c +++ b/src/lib/evas/canvas/evas_object_image.c @@ -1677,10 +1677,13 @@ evas_object_image_init(Evas_Object *eo_obj) } EOLIAN static void -_efl_canvas_image_internal_efl_object_destructor(Eo *eo_obj, Evas_Image_Data *o EINA_UNUSED) +_efl_canvas_image_internal_efl_object_destructor(Eo *eo_obj, Evas_Image_Data *o) { Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); + // To avoid unecessary GC storage triggered during shutdown, we mark the content as dynamic + o->content_hint = EFL_GFX_IMAGE_CONTENT_HINT_DYNAMIC; + if (obj->legacy.ctor) evas_object_image_video_surface_set(eo_obj, NULL); efl_gfx_image_stretch_region_set(eo_obj, NULL, NULL); --
[EGIT] [core/efl] master 04/07: evas: avoid unecessary Eina_Cow GC during image destruction.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=939b0f1a9cc149e0b5090d3733e473f5edf5214f commit 939b0f1a9cc149e0b5090d3733e473f5edf5214f Author: Cedric BAIL Date: Thu Dec 5 18:54:10 2019 -0800 evas: avoid unecessary Eina_Cow GC during image destruction. If the stretch zone are NULL to start with, there is no reason to modify them and this should avoid us a trip to the GC. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D10816 --- src/lib/evas/canvas/evas_object_image.c | 24 ++-- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c index 192c4285d5..fa3a4a8462 100644 --- a/src/lib/evas/canvas/evas_object_image.c +++ b/src/lib/evas/canvas/evas_object_image.c @@ -753,18 +753,22 @@ _efl_canvas_image_internal_efl_gfx_image_stretch_region_set(Eo *eo_obj, Evas_Ima // we do change it, we have to make sure nobody is accessing them anymore by // blocking rendering. evas_object_async_block(obj); - EINA_COW_IMAGE_STATE_WRITE_BEGIN(pd, state_write) - { - if (state_write->free_stretch) free(state_write->stretch.horizontal.region); - state_write->stretch.horizontal.region = NULL; + if (pd->cur->stretch.horizontal.region || + pd->cur->stretch.vertical.region) + { +EINA_COW_IMAGE_STATE_WRITE_BEGIN(pd, state_write) +{ + if (state_write->free_stretch) free(state_write->stretch.horizontal.region); + state_write->stretch.horizontal.region = NULL; - if (state_write->free_stretch) free(state_write->stretch.vertical.region); - state_write->stretch.vertical.region = NULL; + if (state_write->free_stretch) free(state_write->stretch.vertical.region); + state_write->stretch.vertical.region = NULL; - state_write->free_stretch = EINA_FALSE; - state_write->stretch_loaded = EINA_FALSE; - } - EINA_COW_IMAGE_STATE_WRITE_END(pd, state_write); + state_write->free_stretch = EINA_FALSE; + state_write->stretch_loaded = EINA_FALSE; +} +EINA_COW_IMAGE_STATE_WRITE_END(pd, state_write); + } if (!horizontal && !vertical) return 0; if (!horizontal || !vertical) goto on_error; --
[EGIT] [core/efl] master 06/07: evas: do not call Eina_Cow GC during invalidate it is pointless.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=330b72bc6a2506f74703040ec21b680e2d6c86b2 commit 330b72bc6a2506f74703040ec21b680e2d6c86b2 Author: Cedric BAIL Date: Thu Dec 5 18:55:25 2019 -0800 evas: do not call Eina_Cow GC during invalidate it is pointless. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D10818 --- src/lib/evas/canvas/evas_object_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c index d5b20aed22..6b78b581e7 100644 --- a/src/lib/evas/canvas/evas_object_main.c +++ b/src/lib/evas/canvas/evas_object_main.c @@ -1077,7 +1077,7 @@ _efl_canvas_object_efl_object_invalidate(Eo *eo_obj, Evas_Object_Protected_Data EINA_LIST_FREE(events->events_whitelist, dev) efl_event_callback_del(dev, EFL_EVENT_DEL, _whitelist_events_device_remove_cb, obj); } -EINA_COW_WRITE_END(evas_object_events_cow, obj->events, events); +EINA_COW_WRITE_END_NOGC(evas_object_events_cow, obj->events, events); EINA_INLIST_FREE(pointer_grabs, pdata) { @@ -1123,7 +1123,7 @@ _efl_canvas_object_efl_object_invalidate(Eo *eo_obj, Evas_Object_Protected_Data EINA_LIST_FREE(proxy_src->proxy_textures, texture) evas_canvas3d_texture_source_set(texture, NULL); } - EINA_COW_WRITE_END(evas_object_proxy_cow, obj->proxy, proxy_src); + EINA_COW_WRITE_END_NOGC(evas_object_proxy_cow, obj->proxy, proxy_src); } } --
[EGIT] [core/efl] master 02/07: evas: efl_gfx_image_stretch_region_set need access to image state before it is freed.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=574d1192bb41c744c92fe0fd69380b2080dbb038 commit 574d1192bb41c744c92fe0fd69380b2080dbb038 Author: Cedric BAIL Date: Thu Dec 5 16:01:17 2019 -0800 evas: efl_gfx_image_stretch_region_set need access to image state before it is freed. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D10814 --- src/lib/evas/canvas/evas_object_image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c index 3a6a7dfba4..4653aff177 100644 --- a/src/lib/evas/canvas/evas_object_image.c +++ b/src/lib/evas/canvas/evas_object_image.c @@ -1683,8 +1683,8 @@ _efl_canvas_image_internal_efl_object_destructor(Eo *eo_obj, Evas_Image_Data *o if (obj->legacy.ctor) evas_object_image_video_surface_set(eo_obj, NULL); - evas_object_image_free(eo_obj, obj); efl_gfx_image_stretch_region_set(eo_obj, NULL, NULL); + evas_object_image_free(eo_obj, obj); efl_destructor(efl_super(eo_obj, MY_CLASS)); } --
[EGIT] [core/efl] master 01/07: eo: only forward event if someone is listening.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=115a9a22b1d25d8d3b2d433994cc6756174b11b9 commit 115a9a22b1d25d8d3b2d433994cc6756174b11b9 Author: Cedric BAIL Date: Thu Dec 5 13:57:52 2019 -0800 eo: only forward event if someone is listening. This limit long chain of useless event forwarding when nobody is listening at the end of the pipe. Differential Revision: https://phab.enlightenment.org/D10813 --- src/lib/eo/eo_base_class.c | 137 - 1 file changed, 134 insertions(+), 3 deletions(-) diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c index 66e6032830..9fd4d2b08b 100644 --- a/src/lib/eo/eo_base_class.c +++ b/src/lib/eo/eo_base_class.c @@ -23,6 +23,18 @@ static int event_freeze_count = 0; typedef struct _Eo_Callback_Description Eo_Callback_Description; typedef struct _Efl_Event_Callback_Frame Efl_Event_Callback_Frame; +typedef struct _Efl_Event_Forwarder Efl_Event_Forwarder; + +struct _Efl_Event_Forwarder +{ + const Efl_Event_Description *desc; + Eo *source; + Eo *new_obj; + + short priority; + + Eina_Bool inserted : 1; +}; struct _Efl_Event_Callback_Frame { @@ -41,6 +53,7 @@ typedef struct Eo ***wrefs; Eina_Hash *providers; Eina_Hash *schedulers; + Eina_Hash *forwarders; } Efl_Object_Extension; #define EFL_OBJECT_EVENT_CALLBACK(Event) Eina_Bool event_cb_##Event : 1; @@ -124,6 +137,8 @@ typedef struct if ((pd)->event_frame) (pd)->event_frame = (pd)->event_frame->next; \ } while (0) +static void _efl_event_forwarder_callback(void *data, const Efl_Event *event); + static int _eo_nostep_alloc = -1; static void @@ -162,7 +177,8 @@ _efl_object_extension_noneed(Efl_Object_Data *pd) (ext->wrefs) || (ext->composite_parent) || (ext->providers) || - (ext->schedulers)) return; + (ext->schedulers) || + (ext->forwarders)) return; _efl_object_extension_free(pd->ext); pd->ext = NULL; } @@ -172,6 +188,13 @@ _efl_object_invalidate(Eo *obj_id, Efl_Object_Data *pd) { _efl_pending_futures_clear(pd); + if (pd->ext && pd->ext->forwarders) + { +eina_hash_free(pd->ext->forwarders); +pd->ext->forwarders = NULL; +_efl_object_extension_noneed(pd); + } + if (pd->ext && pd->ext->providers) { eina_hash_free(pd->ext->providers); @@ -1282,6 +1305,24 @@ _special_event_count_inc(Eo *obj_id, Efl_Object_Data *pd, const Efl_Callback_Arr EO_OBJ_DONE(obj_id); } + if (pd->ext && pd->ext->forwarders) + { +Efl_Event_Forwarder *forwarder; +Eina_List *l; + +// Check if some event need to be forwarded now +EINA_LIST_FOREACH(eina_hash_find(pd->ext->forwarders, it->desc), l, forwarder) + { + if (!forwarder->source) continue; + if (forwarder->inserted) continue; + efl_event_callback_priority_add(forwarder->source, + forwarder->desc, + forwarder->priority, + _efl_event_forwarder_callback, obj_id); + forwarder->inserted = EINA_TRUE; + } + } + if (update_hash) { unsigned char event_hash; @@ -2193,6 +2234,27 @@ _efl_event_forwarder_callback(void *data, const Efl_Event *event) } } +static void +_forwarders_list_clean(void *data) +{ + Efl_Event_Forwarder *forwarder; + Eina_List *l = data; + + EINA_LIST_FREE(l, forwarder) + { +if (forwarder->source) + { + if (forwarder->inserted) + efl_event_callback_del(forwarder->source, + forwarder->desc, + _efl_event_forwarder_callback, + forwarder->new_obj); + efl_wref_del(forwarder->source, >source); + } +free(forwarder); + } +} + EOLIAN static void _efl_object_event_callback_forwarder_priority_add(Eo *obj, Efl_Object_Data *pd EINA_UNUSED, const Efl_Event_Description *desc, @@ -2201,8 +2263,50 @@ _efl_object_event_callback_forwarder_priority_add(Eo *obj, Efl_Object_Data *pd E { EO_OBJ_POINTER_RETURN(new_obj, new_data); EO_OBJ_DONE(new_obj); + Efl_Event_Forwarder *forwarder; + Efl_Object_Extension *ext; + Efl_Object_Data *dpd; + Eina_List *l; + + dpd = efl_data_scope_safe_get(new_obj, EFL_OBJECT_CLASS); + EINA_SAFETY_ON_NULL_RETURN(dpd); + + ext = _efl_object_extension_need(dpd); + EINA_SAFETY_ON_NULL_RETURN(ext); + + // Prevent double insertion f
[EGIT] [tools/expedite] master 01/01: Migrate to new font family API.
cedric pushed a commit to branch master. http://git.enlightenment.org/tools/expedite.git/commit/?id=08dd13567eed3b99f62154be25e878c6d835ea7b commit 08dd13567eed3b99f62154be25e878c6d835ea7b Author: Cedric BAIL Date: Fri Dec 6 09:29:22 2019 -0800 Migrate to new font family API. --- src/bin/proxy_text_fixed.c | 3 ++- src/bin/proxy_text_random.c | 3 ++- src/bin/proxy_textblock.c | 3 ++- src/bin/snapshot_widgets_file_icons.c | 3 ++- src/bin/text_basic.c| 3 ++- src/bin/text_change.c | 3 ++- src/bin/text_styles.c | 3 ++- src/bin/text_styles_different_strings.c | 3 ++- src/bin/ui.c| 9 ++--- src/bin/widgets_file_icons.c| 3 ++- src/bin/widgets_file_icons_2.c | 3 ++- src/bin/widgets_file_icons_2_grouped.c | 3 ++- src/bin/widgets_file_icons_2_same.c | 3 ++- src/bin/widgets_file_icons_2_same_grouped.c | 3 ++- src/bin/widgets_file_icons_3.c | 3 ++- src/bin/widgets_file_icons_4.c | 3 ++- src/bin/widgets_list_1.c| 3 ++- src/bin/widgets_list_1_grouped.c| 3 ++- src/bin/widgets_list_2.c| 3 ++- src/bin/widgets_list_2_grouped.c| 3 ++- src/bin/widgets_list_3.c| 3 ++- src/bin/widgets_list_3_grouped.c| 3 ++- src/bin/widgets_list_4.c| 3 ++- src/bin/widgets_list_4_grouped.c| 3 ++- 24 files changed, 52 insertions(+), 26 deletions(-) diff --git a/src/bin/proxy_text_fixed.c b/src/bin/proxy_text_fixed.c index 4b19988..ee83d08 100644 --- a/src/bin/proxy_text_fixed.c +++ b/src/bin/proxy_text_fixed.c @@ -29,7 +29,8 @@ static void _setup(void) { o = evas_object_text_add(evas); o_texts[i] = o; -efl_text_font_set(o, "Vera-Bold", 20); +efl_text_font_family_set(o, "Vera-Bold"); +efl_text_font_size_set(o, 20); efl_text_set(o, "This is a test string"); evas_object_text_style_set(o, st); efl_gfx_color_set(o, 255, 255, 255, 255); diff --git a/src/bin/proxy_text_random.c b/src/bin/proxy_text_random.c index c052f5b..b2a0795 100644 --- a/src/bin/proxy_text_random.c +++ b/src/bin/proxy_text_random.c @@ -38,7 +38,8 @@ static void _setup(void) strs[rnd() % (sizeof(strs) / sizeof(char *))], strs[rnd() % (sizeof(strs) / sizeof(char *))]); - efl_text_font_set(o, "Vera-Bold", 20); + efl_text_font_family_set(o, "Vera-Bold"); + efl_text_font_size_set(o, 20); efl_text_set(o, buf); efl_gfx_color_set(o, 0, 0, 0, 255); exp_size_get(o, , ); diff --git a/src/bin/proxy_textblock.c b/src/bin/proxy_textblock.c index cf72e65..479fde2 100644 --- a/src/bin/proxy_textblock.c +++ b/src/bin/proxy_textblock.c @@ -33,7 +33,8 @@ static void _setup(void) { o = efl_add(EFL_CANVAS_TEXT_CLASS, evas); o_texts[i] = o; -efl_text_font_set(o, "Vera-Bold", 12); +efl_text_font_family_set(o, "Vera-Bold"); +efl_text_font_size_set(o, 12); efl_text_wrap_set(o, EFL_TEXT_FORMAT_WRAP_WORD); efl_text_multiline_set(o, 1); efl_text_set(o, diff --git a/src/bin/snapshot_widgets_file_icons.c b/src/bin/snapshot_widgets_file_icons.c index 8eeabd2..f9b9833 100644 --- a/src/bin/snapshot_widgets_file_icons.c +++ b/src/bin/snapshot_widgets_file_icons.c @@ -64,7 +64,8 @@ static void _setup(void) o = evas_object_text_add(evas); o_texts[i] = o; -efl_text_font_set(o, "Vera-Bold", 10); +efl_text_font_family_set(o, "Vera-Bold"); +efl_text_font_size_set(o, 10); efl_text_set(o, icons[i % 13]); evas_object_text_style_set(o, EVAS_TEXT_STYLE_FAR_SOFT_SHADOW); efl_gfx_color_set(o, 255, 255, 255, 255); diff --git a/src/bin/text_basic.c b/src/bin/text_basic.c index 6b0a42b..2c8838b 100644 --- a/src/bin/text_basic.c +++ b/src/bin/text_basic.c @@ -27,7 +27,8 @@ static void _setup(void) { o = evas_object_text_add(evas); o_texts[i] = o; -efl_text_font_set(o, "Vera-Bold", 20); +efl_text_font_family_set(o, "Vera-Bold"); +efl_text_font_size_set(o, 20); efl_text_set(o, "This is a test string"); efl_gfx_color_set(o, 0, 0, 0, 255); efl_gfx_entity_visible_set(o, EINA_TRUE); diff --git a/src/bin/text_change.c b/src/bin/text_change.c index e7f8ef0..c5eca96 100644 --- a/src/bin/text_change.c +++ b/src/bin/text_change.c @@ -34,7 +34,8 @@ static void _setup(void) { o = evas_object_text_add(evas); o_texts[i] = o; - efl_text_font_set(o, "Vera-Bold", 20); + efl_text_font_family_set(o, "Vera-Bold"); +efl_text_font_size_set(o, 20);
[EGIT] [core/efl] master 01/06: elementary: small improvement on example migrating them to newer unified API.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=003ce06e85ba0f1597a26405ead92f2e01607177 commit 003ce06e85ba0f1597a26405ead92f2e01607177 Author: Cedric BAIL Date: Sat Nov 23 01:09:13 2019 -0800 elementary: small improvement on example migrating them to newer unified API. --- src/examples/elementary/layout_property_bind.c | 46 +- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/src/examples/elementary/layout_property_bind.c b/src/examples/elementary/layout_property_bind.c index f9c5cf979e..8dc68a564a 100644 --- a/src/examples/elementary/layout_property_bind.c +++ b/src/examples/elementary/layout_property_bind.c @@ -27,6 +27,8 @@ struct _Layout_Model_Data }; typedef struct _Layout_Model_Data Layout_Model_Data; +static Evas_Object *win = NULL; + static Eina_Value _wait_for_image(Eo *o EINA_UNUSED, void *data, const Eina_Value v) { @@ -50,22 +52,32 @@ _cleanup_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void } static void -_list_selected_cb(void *data EINA_UNUSED, const Efl_Event *event) +_list_pressed_item_cb(void *data EINA_UNUSED, const Efl_Event *event) { Layout_Model_Data *priv = data; - Eo *child = event->info; - - printf("LIST selected model\n"); - efl_ui_view_model_set(priv->provider, child); + Efl_Ui_Item_Clickable_Pressed *pressed = event->info; + Efl_Ui_Item *item = pressed->item; + Efl_Model *model = efl_ui_view_model_get(item); + + printf("LIST pressed model `%s` from item `%s`.\n", + efl_debug_name_get(model), + efl_debug_name_get(item)); + efl_ui_view_model_set(priv->provider, model); } static void _update_cb(void *data, Evas_Object *obj EINA_UNUSED, void *ev EINA_UNUSED) { Layout_Model_Data *priv = data; + Efl_Model *newone; const char *text = elm_object_text_get(priv->entry); - elm_layout_text_set(priv->label, "default", text); + newone = efl_add(EFL_IO_MODEL_CLASS, win, +efl_io_model_path_set(efl_added, text)); + efl_ui_view_model_set(priv->fileview, newone); + efl_del(priv->model); + priv->model = newone; + } static void @@ -103,7 +115,8 @@ EAPI_MAIN int elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) { Layout_Model_Data *priv; - Evas_Object *win, *panes, *bxr, *genlist; + Evas_Object *panes, *bxr; + Efl_Ui_Factory *factory; Eo *img_factory; char *dirname; @@ -122,16 +135,19 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) if (argv[1] != NULL) dirname = argv[1]; else dirname = EFL_MODEL_TEST_FILENAME_PATH; - priv->model = efl_add_ref(EFL_IO_MODEL_CLASS, win, efl_io_model_path_set(efl_added, dirname)); + priv->model = efl_add(EFL_IO_MODEL_CLASS, win, efl_io_model_path_set(efl_added, dirname)); + + factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win); + efl_ui_widget_factory_item_class_set(factory, EFL_UI_LIST_DEFAULT_ITEM_CLASS); + efl_ui_property_bind(factory, "efl.text", "filename"); - genlist = elm_genlist_add(win); - priv->fileview = efl_add_ref(ELM_VIEW_LIST_CLASS, win, elm_view_list_genlist_set(efl_added, genlist, ELM_GENLIST_ITEM_NONE, NULL)); - elm_view_list_property_connect(priv->fileview, "filename", "elm.text"); - elm_view_list_model_set(priv->fileview, priv->model); - _widget_init(genlist); - elm_object_part_content_set(panes, "left", genlist); + priv->fileview = efl_add(EFL_UI_LIST_VIEW_CLASS, panes, +efl_ui_collection_view_factory_set(efl_added, factory), +efl_ui_view_model_set(efl_added, priv->model)); + _widget_init(priv->fileview); + elm_object_part_content_set(panes, "left", priv->fileview); elm_panes_content_left_size_set(panes, 0.3); - efl_event_callback_add(priv->fileview, ELM_VIEW_LIST_EVENT_MODEL_SELECTED, _list_selected_cb, priv); + efl_event_callback_add(priv->fileview, EFL_UI_EVENT_ITEM_PRESSED, _list_pressed_item_cb, priv); bxr = elm_box_add(win); priv->bxr = bxr; --
[EGIT] [core/efl] master 01/03: eina: refactor and simplify vpath.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=9c992c05d5494764df209faf1a36c04972814628 commit 9c992c05d5494764df209faf1a36c04972814628 Author: Cedric BAIL Date: Fri May 10 14:28:49 2019 -0700 eina: refactor and simplify vpath. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8882 --- src/lib/eina/eina_vpath.c | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/lib/eina/eina_vpath.c b/src/lib/eina/eina_vpath.c index aa7b46bddb..87b85662d9 100644 --- a/src/lib/eina/eina_vpath.c +++ b/src/lib/eina/eina_vpath.c @@ -258,18 +258,10 @@ _eina_vpath_resolve(const char *path, char *str, size_t size) { const char *p, *end, *meta; char *name; -int max_len = strlen(path); Eina_Bool found = EINA_FALSE; -for (p = path + 2; p <= path + max_len - 2; p++) - { - if ((p[0] ==':') && (p[1] == ')')) - { - end = p; - found = EINA_TRUE; - break; - } - } +end = p = strstr(path + 2, ":)"); +if (p) found = EINA_TRUE; p += 2; if (!found) --
[EGIT] [core/efl] master 03/03: eina: add tests for the new Vpath syntax.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=c75415ae369f5988975bc6e40378d9de5e2ccef0 commit c75415ae369f5988975bc6e40378d9de5e2ccef0 Author: Cedric BAIL Date: Fri May 10 14:42:57 2019 -0700 eina: add tests for the new Vpath syntax. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8884 --- src/tests/eina/eina_test_vpath.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/tests/eina/eina_test_vpath.c b/src/tests/eina/eina_test_vpath.c index 851c47ee2b..cad61bd831 100644 --- a/src/tests/eina/eina_test_vpath.c +++ b/src/tests/eina/eina_test_vpath.c @@ -21,8 +21,8 @@ EFL_START_TEST(eina_test_vpath_valid) snprintf(test, sizeof(test), "%s/bla", eina_environment_home_get()); ck_assert_str_eq(eina_vpath_resolve("(:home:)/bla"), test); + ck_assert_str_eq(eina_vpath_resolve("${home}/bla"), test); ck_assert_str_eq(eina_vpath_resolve("/test/for/the/last/case"), "/test/for/the/last/case"); - } EFL_END_TEST @@ -33,6 +33,13 @@ EFL_START_TEST(eina_test_vpath_invalid) ck_assert_ptr_eq(eina_vpath_resolve("(:"), NULL); ck_assert_ptr_eq(eina_vpath_resolve("(:home:)"), NULL); ck_assert_ptr_eq(eina_vpath_resolve("(:wrong_meta_key:)/"), NULL); + ck_assert_ptr_eq(eina_vpath_resolve("${asdfasdfafasdf"), NULL); + ck_assert_ptr_eq(eina_vpath_resolve("${missing_slash}"), NULL); + ck_assert_ptr_eq(eina_vpath_resolve("${"), NULL); + ck_assert_ptr_eq(eina_vpath_resolve("${home}"), NULL); + ck_assert_ptr_eq(eina_vpath_resolve("${wrong_meta_key}/"), NULL); + ck_assert_ptr_eq(eina_vpath_resolve("${home:)"), NULL); + ck_assert_ptr_eq(eina_vpath_resolve("${wrong_meta_key:)/"), NULL); } EFL_END_TEST @@ -47,6 +54,10 @@ EFL_START_TEST(eina_test_vpath_snprintf) eina_vpath_resolve_snprintf(buf, sizeof(buf), "(:home:)/%s/%d/", string, x); snprintf(cmp, sizeof(cmp), "%s/%s/%d/", eina_environment_home_get(), string, x); ck_assert_str_eq(buf, cmp); + + eina_vpath_resolve_snprintf(buf, sizeof(buf), "${home}/%s/%d/", string, x); + snprintf(cmp, sizeof(cmp), "%s/%s/%d/", eina_environment_home_get(), string, x); + ck_assert_str_eq(buf, cmp); } EFL_END_TEST --
[EGIT] [core/efl] master 02/03: eina: update vpath to also support a more classic syntax for variable.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=370917751f83bcaf65b56fde8d1a2b0d47b1d676 commit 370917751f83bcaf65b56fde8d1a2b0d47b1d676 Author: Cedric BAIL Date: Fri May 10 14:37:24 2019 -0700 eina: update vpath to also support a more classic syntax for variable. This enable vpath to recognize also ${} as a variable. It does mimic what Efl.ViewModel provide with Efl.ViewModel.PropertyText and various other language. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8883 --- src/lib/eina/eina_vpath.c | 30 +++--- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/lib/eina/eina_vpath.c b/src/lib/eina/eina_vpath.c index 87b85662d9..0717e928e0 100644 --- a/src/lib/eina/eina_vpath.c +++ b/src/lib/eina/eina_vpath.c @@ -254,37 +254,53 @@ _eina_vpath_resolve(const char *path, char *str, size_t size) } } // (:xxx:)/* ... <- meta hash table - else if ((path[0] == '(') && (path[1] == ':')) + else if (((path[0] == '(') && (path[1] == ':')) || +((path[0] == '$') && (path[1] == '{'))) { const char *p, *end, *meta; +const char *msg_start, *msg_end; char *name; +int offset; Eina_Bool found = EINA_FALSE; -end = p = strstr(path + 2, ":)"); +if (path[0] == '(') + { + end = p = strstr(path + 2, ":)"); + offset = 2; + msg_start = "(:"; + msg_end = ":)"; + } +else + { + end = p = strchr(path + 2, '}'); + offset = 1; + msg_start = "${"; + msg_end = "}"; + } if (p) found = EINA_TRUE; -p += 2; +p += offset; if (!found) { - ERR("(: Needs to have a matching ':)'\nThe string was: %s", path); + ERR("'%s' Needs to have a matching '%s'\nThe string was: %s", msg_start, msg_end, path); return 0; } if (*p != '/') { - ERR("A / is expected after :)\nThe string was: %s", path); + ERR("A / is expected after '%s'\nThe string was: %s", msg_end, path); return 0; } if (found) { name = alloca(end - path); - strncpy(name, path + 2, end - path - 2); + strncpy(name, path + 2, end - path - offset); name[end - path - 2] = 0; meta = _eina_vpath_data_get(name); if (meta) { - return snprintf(str, size, "%s%s", meta, end + 2); + return snprintf(str, size, "%s%s", meta, end + offset); } else { --
[EGIT] [core/efl] master 02/02: ecore: forgotten autotools update.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=e23e7be07c19ee96bd51615250031c163b2aba50 commit e23e7be07c19ee96bd51615250031c163b2aba50 Author: Cedric BAIL Date: Fri May 10 17:58:33 2019 -0700 ecore: forgotten autotools update. --- src/Makefile_Ecore.am | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Makefile_Ecore.am b/src/Makefile_Ecore.am index 649dbbec28..4c3b5fd937 100644 --- a/src/Makefile_Ecore.am +++ b/src/Makefile_Ecore.am @@ -49,7 +49,8 @@ ecore_eolian_files_public = \ lib/ecore/efl_view_model.eo \ lib/ecore/efl_core_env.eo \ lib/ecore/efl_core_proc_env.eo \ - lib/ecore/efl_core_command_line.eo + lib/ecore/efl_core_command_line.eo \ + lib/ecore/efl_filter_model.eo ecore_test_eolian_files = \ tests/ecore/efl_app_test_cml.eo \ @@ -157,6 +158,7 @@ lib/ecore/efl_composite_model_private.h \ lib/ecore/efl_model_accessor_view.c \ lib/ecore/efl_model_accessor_view_private.h \ lib/ecore/efl_view_model.c \ +lib/ecore/efl_filter_model.c \ lib/ecore/efl_linear_interpolator.c \ lib/ecore/efl_accelerate_interpolator.c \ lib/ecore/efl_decelerate_interpolator.c \ --
[EGIT] [core/efl] master 01/03: ecore: add Efl.Filter_Model
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=fd35f6c193a7da2ad600e723f16308a5499fd6f4 commit fd35f6c193a7da2ad600e723f16308a5499fd6f4 Author: Cedric BAIL Date: Wed Apr 3 17:25:06 2019 -0700 ecore: add Efl.Filter_Model This model provide facility to filter the content of composited model. Reviewed-by: SangHyeon Jade Lee Differential Revision: https://phab.enlightenment.org/D8797 --- src/lib/ecore/Ecore_Eo.h | 1 + src/lib/ecore/efl_filter_model.c | 569 ++ src/lib/ecore/efl_filter_model.eo | 31 +++ src/lib/ecore/meson.build | 2 + 4 files changed, 603 insertions(+) diff --git a/src/lib/ecore/Ecore_Eo.h b/src/lib/ecore/Ecore_Eo.h index 6e872d9d2c..363868c1a4 100644 --- a/src/lib/ecore/Ecore_Eo.h +++ b/src/lib/ecore/Ecore_Eo.h @@ -119,6 +119,7 @@ EAPI Eo *efl_main_loop_get(void); #include "efl_composite_model.eo.h" #include "efl_boolean_model.eo.h" #include "efl_select_model.eo.h" +#include "efl_filter_model.eo.h" #include "efl_view_model.eo.h" /** diff --git a/src/lib/ecore/efl_filter_model.c b/src/lib/ecore/efl_filter_model.c new file mode 100644 index 00..9f2511cfa0 --- /dev/null +++ b/src/lib/ecore/efl_filter_model.c @@ -0,0 +1,569 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "efl_composite_model_private.h" + +typedef struct _Efl_Filter_Model_Mapping Efl_Filter_Model_Mapping; +struct _Efl_Filter_Model_Mapping +{ + EINA_RBTREE; + + uint64_t original; + uint64_t mapped; + + EINA_REFCOUNT; +}; + +typedef struct _Efl_Filter_Model_Data Efl_Filter_Model_Data; +struct _Efl_Filter_Model_Data +{ + Efl_Filter_Model_Mapping *self; + + Eina_Rbtree *mapping; + + struct { + void *data; + EflFilterModel cb; + Eina_Free_Cb free_cb; + uint64_t count; + } filter; + + uint64_t counted; + Eina_Bool counting_started : 1; + Eina_Bool processed : 1; +}; + +static Eina_Rbtree_Direction +_filter_mapping_cmp_cb(const Eina_Rbtree *left, const Eina_Rbtree *right, void *data EINA_UNUSED) +{ + const Efl_Filter_Model_Mapping *l, *r; + + l = (const Efl_Filter_Model_Mapping *) left; + r = (const Efl_Filter_Model_Mapping *) right; + + if (l->mapped < r->mapped) + return EINA_RBTREE_LEFT; + return EINA_RBTREE_RIGHT; +} + +static int +_filter_mapping_looking_cb(const Eina_Rbtree *node, const void *key, + int length EINA_UNUSED, void *data EINA_UNUSED) +{ + const Efl_Filter_Model_Mapping *n = (const Efl_Filter_Model_Mapping *) node; + const uint64_t *k = key; + + return n->mapped - *k; +} + +static void +_efl_filter_model_filter_set(Eo *obj EINA_UNUSED, Efl_Filter_Model_Data *pd, + void *filter_data, EflFilterModel filter, Eina_Free_Cb filter_free_cb) +{ + if (pd->filter.cb) + pd->filter.free_cb(pd->filter.data); + pd->filter.data = filter_data; + pd->filter.cb = filter; + pd->filter.free_cb = filter_free_cb; +} + +static void +_rbtree_free_cb(Eina_Rbtree *node, void *data EINA_UNUSED) +{ + Efl_Filter_Model_Mapping *m = (Efl_Filter_Model_Mapping*) node; + + EINA_REFCOUNT_UNREF(m) + free(m); +} + +typedef struct _Efl_Filter_Request Efl_Filter_Request; +struct _Efl_Filter_Request +{ + Efl_Filter_Model_Data *pd; + Efl_Model *parent; + Efl_Model *child; + uint64_t index; +}; + +static Efl_Filter_Model * +_efl_filter_lookup(const Efl_Class *klass, + Efl_Model *parent, Efl_Model *view, + Efl_Filter_Model_Mapping *mapping) +{ + Efl_Filter_Model *child; + Efl_Filter_Model_Data *cpd; + + child = _efl_composite_lookup(klass, parent, view, mapping->mapped); + if (!child) return NULL; + + cpd = efl_data_scope_get(child, EFL_FILTER_MODEL_CLASS); + cpd->processed = EINA_TRUE; + cpd->self = mapping; + EINA_REFCOUNT_REF(mapping); + + return child; +} + +static Eina_Value +_efl_filter_model_filter(Eo *o EINA_UNUSED, void *data, const Eina_Value v) +{ + Efl_Filter_Model_Mapping *mapping; + Efl_Filter_Model *child; + Efl_Model_Children_Event cevt = { 0 }; + Efl_Filter_Request *r = data; + Eina_Value ret = v; + Eina_Bool result = EINA_FALSE; + + if (!eina_value_bool_get(, )) goto end; + if (!result) goto end; + + mapping = calloc(1, sizeof (Efl_Filter_Model_Mapping)); + if (!mapping) + { +ret = eina_value_bool_init(EINA_FALSE); +goto end; + } + EINA_REFCOUNT_INIT(mapping); + + mapping->original = r->index; + mapping->mapped = r->pd->filter.count++; + + r->pd->mapping = eina_rbtree_inline_insert(r->pd->mapping, EINA_RBTREE_GET(mapping), + _filter_mapping_cmp_cb, NULL); + + child = _efl_filter_lookup(efl_class_get(r->parent), r->parent, r->child,
[EGIT] [core/efl] master 02/03: ecore: add a test for the new Efl.FilterModel.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=c1204d88f60a1809565f2983f8fd58bb573bf07e commit c1204d88f60a1809565f2983f8fd58bb573bf07e Author: Cedric BAIL Date: Thu Apr 18 10:53:07 2019 -0700 ecore: add a test for the new Efl.FilterModel. Reviewed-by: SangHyeon Jade Lee Differential Revision: https://phab.enlightenment.org/D8798 --- src/tests/efl/efl_test_composite_model.c | 273 ++- 1 file changed, 271 insertions(+), 2 deletions(-) diff --git a/src/tests/efl/efl_test_composite_model.c b/src/tests/efl/efl_test_composite_model.c index cfe56c135f..48511a9054 100644 --- a/src/tests/efl/efl_test_composite_model.c +++ b/src/tests/efl/efl_test_composite_model.c @@ -59,6 +59,10 @@ _children_slice_get_then(void *data EINA_UNUSED, fail_if(v_int != base_ints[i]); fail_if(v_true != EINA_TRUE); fail_if(v_false != EINA_FALSE); + +eina_value_free(p_int); +eina_value_free(p_true); +eina_value_free(p_false); } ecore_main_loop_quit(); @@ -96,6 +100,10 @@ _selection_children_slice_get_then(void *data EINA_UNUSED, fail_if(v_bool != base_selections[i]); fail_if(v_int != base_ints[i]); ck_assert_int_eq(i, index); + +eina_value_free(p_bool); +eina_value_free(p_int); +eina_value_free(p_index); } ecore_main_loop_quit(); @@ -107,7 +115,7 @@ EFL_START_TEST(efl_test_boolean_model) { Efl_Generic_Model *base_model, *child; int i; - Eina_Value v; + Eina_Value v = { 0 }; Efl_Boolean_Model *model; Eina_Future *future; @@ -150,7 +158,7 @@ EFL_START_TEST(efl_test_select_model) { Efl_Generic_Model *base_model, *child; int i; - Eina_Value v; + Eina_Value v = { 0 }; Efl_Select_Model *model; Eina_Future *future; @@ -181,9 +189,270 @@ EFL_START_TEST(efl_test_select_model) } EFL_END_TEST +typedef struct _Efl_Filter_Model_Wait Efl_Filter_Model_Wait; +struct _Efl_Filter_Model_Wait +{ + Efl_Model *child; + Efl_Model *parent; + Eina_Promise *p; +}; + +static void _wait_for_it(void *data, const Efl_Event *event); + +static void +_wait_cleanup(Efl_Filter_Model_Wait *mw) +{ + efl_event_callback_del(mw->child, EFL_MODEL_EVENT_PROPERTIES_CHANGED, _wait_for_it, mw); + efl_unref(mw->child); + efl_unref(mw->parent); + free(mw); +} + +static void +_wait_for_it(void *data, const Efl_Event *event) +{ + Efl_Model_Property_Event *ev = event->info; + Efl_Filter_Model_Wait *mw = data; + const char *property; + unsigned int i; + Eina_Array_Iterator it; + + EINA_ARRAY_ITER_NEXT(ev->changed_properties, i, property, it) + { +if (!strcmp(property, "ready")) + { + Eina_Value *value = efl_model_property_get(event->object, "ready"); + Eina_Bool r; + Eina_Error err = 0; + + if (eina_value_type_get(value) == EINA_VALUE_TYPE_BOOL && + eina_value_bool_get(value, ) && + r) + { + eina_value_free(value); + eina_promise_resolve(mw->p, eina_value_bool_init(EINA_TRUE)); + _wait_cleanup(mw); + return ; + } + if (eina_value_type_get(value) == EINA_VALUE_TYPE_ERROR && + eina_value_error_get(value, ) && + err != EAGAIN) + { + eina_value_free(value); + eina_promise_reject(mw->p, err); + _wait_cleanup(mw); + return ; + } + eina_value_free(value); + break; + } + } +} + +static void +_wait_cancel(void *data, const Eina_Promise *dead_ptr EINA_UNUSED) +{ + _wait_cleanup(data); +} + +static Eina_Future * +_wait_ready_true(Efl_Model *parent, Efl_Model *child) +{ + Efl_Filter_Model_Wait *mw; + Eina_Value *value = efl_model_property_get(child, "ready"); + Eina_Bool r = EINA_FALSE; + Eina_Error err = 0; + + if (eina_value_type_get(value) == EINA_VALUE_TYPE_BOOL && + eina_value_bool_get(value, ) && + r) + { +eina_value_free(value); +return efl_loop_future_resolved(parent, eina_value_bool_init(EINA_TRUE)); + } + if (eina_value_type_get(value) == EINA_VALUE_TYPE_ERROR && + eina_value_error_get(value, ) && + err != EAGAIN) + { +eina_value_free(value); +return efl_loop_future_rejected(parent, err); + } + + eina_value_free(value); + + mw = calloc(1, sizeof (Efl_Filter_Model_Wait)); + if (!mw) return efl_loop_future_rejected(parent, ENOMEM); + + mw->p = eina_promise_new(efl_loop_future_scheduler_get(parent), _wait_cancel, mw); + mw->child = efl_ref(child); + mw->parent = efl_ref(parent); + + efl_event_cal
[EGIT] [core/efl] master 03/03: elementary: move Fileselector to rely on Efl.FilterModel for filtering instead of custom logic.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=5fa78a44d883d539364221afc966d0c0e5efe515 commit 5fa78a44d883d539364221afc966d0c0e5efe515 Author: Cedric BAIL Date: Thu Apr 25 15:51:19 2019 -0700 elementary: move Fileselector to rely on Efl.FilterModel for filtering instead of custom logic. This simply a bit the logic of things, but more refactoring would be nice for this widget. Reviewed-by: SangHyeon Jade Lee Differential Revision: https://phab.enlightenment.org/D8799 --- src/lib/elementary/elc_fileselector.c | 373 +++--- 1 file changed, 208 insertions(+), 165 deletions(-) diff --git a/src/lib/elementary/elc_fileselector.c b/src/lib/elementary/elc_fileselector.c index 9283dc3190..4ebf9cc7e8 100644 --- a/src/lib/elementary/elc_fileselector.c +++ b/src/lib/elementary/elc_fileselector.c @@ -96,8 +96,6 @@ EFL_CALLBACKS_ARRAY_DEFINE(monitoring_callbacks, { EFL_MODEL_EVENT_CHILD_ADDED, _resource_created }, { EFL_MODEL_EVENT_CHILD_REMOVED, _resource_deleted }); -static void _properties_changed(void *data, const Efl_Event *ev); - static void _focus_chain_update(Eo *obj, Elm_Fileselector_Data *pd) { @@ -194,16 +192,121 @@ _elm_fileselector_replace_model(Elm_Fileselector *fs, Elm_Fileselector_Data *sd, } } +static const char * +_io_path_get(Efl_Model *model) +{ + if (!model) return NULL; + if (efl_isa(model, EFL_IO_MODEL_CLASS)) return efl_io_model_path_get(model); + return _io_path_get(efl_ui_view_model_get(model)); +} + +static Eina_Bool +_check_again(Eina_Value *fetch) +{ + Eina_Error err = 0; + char *str; + + if (eina_value_type_get(fetch) != EINA_VALUE_TYPE_ERROR) + return EINA_FALSE; + + eina_value_error_get(fetch, ); + if (err == EAGAIN) return EINA_TRUE; + + str = eina_value_to_string(fetch); + ERR("Unexpected error: '%s'.", str); + free(str); + + return EINA_TRUE; +} + +static Eina_Bool +_fetch_string_value(Efl_Model *child, const char *name, char **str) +{ + Eina_Value *fetch; + Eina_Bool r = EINA_FALSE; + + *str = NULL; + + fetch = efl_model_property_get(child, name); + if (_check_again(fetch)) goto on_error; + + *str = eina_value_to_string(fetch); + r = EINA_TRUE; + + on_error: + eina_value_free(fetch); + return r; +} + +static Eina_Bool +_fetch_bool_value(Efl_Model *child, const char *name, Eina_Bool *b) +{ + Eina_Value *fetch; + Eina_Bool r = EINA_FALSE; + + fetch = efl_model_property_get(child, name); + if (_check_again(fetch)) goto on_error; + if (!eina_value_bool_get(fetch, b)) goto on_error; + + r = EINA_TRUE; + + on_error: + eina_value_free(fetch); + return r; +} + +static Eina_Bool +_fetch_double_value(Efl_Model *child, const char *name, double *d) +{ + Eina_Value convert = EINA_VALUE_EMPTY; + Eina_Value *fetch; + Eina_Bool r = EINA_FALSE; + + fetch = efl_model_property_get(child, name); + if (_check_again(fetch)) goto on_error; + if (!eina_value_setup(, EINA_VALUE_TYPE_DOUBLE)) + goto on_error; + if (!eina_value_convert(fetch, )) + goto on_error; + if (!eina_value_double_get(, d)) goto on_error; + + r = EINA_TRUE; + + on_error: + eina_value_flush(); + eina_value_free(fetch); + return r; +} + +static Eina_Bool +_fetch_int64_value(Efl_Model *child, const char *name, int64_t *i) +{ + Eina_Value convert = EINA_VALUE_EMPTY; + Eina_Value *fetch; + Eina_Bool r = EINA_FALSE; + + fetch = efl_model_property_get(child, name); + if (_check_again(fetch)) goto on_error; + if (!eina_value_setup(, EINA_VALUE_TYPE_INT64)) + goto on_error; + if (!eina_value_convert(fetch, )) + goto on_error; + if (!eina_value_int64_get(, i)) goto on_error; + + r = EINA_TRUE; + + on_error: + eina_value_free(fetch); + return r; +} + /* final routine on deletion */ static void _elm_fileselector_smart_del_do(Elm_Fileselector *fs, Elm_Fileselector_Data *sd) { Eo *child; EINA_LIST_FREE(sd->children, child) - { -efl_event_callback_del(child, EFL_MODEL_EVENT_PROPERTIES_CHANGED, _properties_changed, sd); -efl_unref(child); - } + efl_unref(child); _elm_fileselector_replace_model(fs, sd, NULL, NULL); efl_replace(>prev_model, NULL); ecore_idler_del(sd->path_entry_idler); @@ -536,6 +639,77 @@ _filter_child(Elm_Fileselector_Data* sd, return EINA_FALSE; } +static Eina_Value +_filter_do(Eo *child, void *data, const Eina_Value v EINA_UNUSED) +{ + Elm_Fileselector_Data* sd = data; + // FIXME: This could be only needed with ELM_FILESELECTOR_MIME_FILTER + char *mime_type = NULL; + char *filename = NULL; + char *path = NULL; + int64_t size = 0; + double mtime = 0; + Eina_Bool dir = EINA_FALSE; + Eina_Bool r = EINA_FALSE; + + if (!_fetch_string_value(child, "path", ) || + !_fetch_string_value(child, "filename", ) || +
[EGIT] [core/efl] master 01/01: ecore: make sure that ecore stay initialized during the full test.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=524139a16ffe9d278e1d4b5cea2d61ed7a70955d commit 524139a16ffe9d278e1d4b5cea2d61ed7a70955d Author: Cedric BAIL Date: Thu Mar 28 17:09:14 2019 -0700 ecore: make sure that ecore stay initialized during the full test. efl_app_test_promise.c is slightly special and corrective action have to be taken to make sure that ecore_init return the right value when the no fork mode of libcheck is used. Reviewed-by: Mike Blumenkrantz Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8566 --- src/tests/ecore/efl_app_test_promise.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tests/ecore/efl_app_test_promise.c b/src/tests/ecore/efl_app_test_promise.c index 91d3f802d7..1a9019368d 100644 --- a/src/tests/ecore/efl_app_test_promise.c +++ b/src/tests/ecore/efl_app_test_promise.c @@ -1407,6 +1407,7 @@ EFL_START_TEST(efl_test_future_then) Eina_Value *ret = NULL; Eina_Error err = 0; + ecore_init(); efl_event_callback_add(efl_main_loop_get(), EFL_LOOP_EVENT_ARGUMENTS, efl_main_test, NULL); ecore_init_ex(1, argv); ret = efl_loop_begin(efl_main_loop_get()); @@ -1415,6 +1416,7 @@ EFL_START_TEST(efl_test_future_then) ck_assert_ptr_eq(eina_value_type_get(ret), EINA_VALUE_TYPE_ERROR); eina_value_get(ret, ); ck_assert_int_eq(err, EAGAIN); + ecore_shutdown(); } EFL_END_TEST --
[EGIT] [core/efl] master 03/04: ecore: property handle allocation error in Efl.CompositeModel.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=7b7ad5380a2900bfabb03f2ac86c96caa66ededf commit 7b7ad5380a2900bfabb03f2ac86c96caa66ededf Author: Cedric BAIL Date: Thu Apr 25 15:44:17 2019 -0700 ecore: property handle allocation error in Efl.CompositeModel. Reviewed-by: SangHyeon Jade Lee Differential Revision: https://phab.enlightenment.org/D8795 --- src/lib/ecore/efl_composite_model.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/ecore/efl_composite_model.c b/src/lib/ecore/efl_composite_model.c index 4a7e11413e..913d2041af 100644 --- a/src/lib/ecore/efl_composite_model.c +++ b/src/lib/ecore/efl_composite_model.c @@ -163,7 +163,6 @@ _efl_composite_model_child_added(void *data, const Efl_Event *event) if (ev->child) cev.child = _efl_composite_lookup(efl_class_get(pd->self), pd->self, ev->child, ev->index); - efl_event_callback_call(pd->self, EFL_MODEL_EVENT_CHILD_ADDED, ); efl_unref(cev.child); @@ -302,6 +301,8 @@ _efl_composite_model_then(Eo *o EINA_UNUSED, void *data, const Eina_Value v) // Fetch an existing composite model for this model or create a new one if none exist composite = _efl_composite_lookup(req->self, req->parent, target, req->start + i); +if (!composite) continue; + eina_value_array_append(, composite); // Dropping this scope reference efl_unref(composite); --
[EGIT] [core/efl] master 01/04: eio: correctly set reference count of cached child object.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=c559bdf8094e268879c60824a07ad8eab8cba1b3 commit c559bdf8094e268879c60824a07ad8eab8cba1b3 Author: Cedric BAIL Date: Thu Apr 25 15:38:20 2019 -0700 eio: correctly set reference count of cached child object. Reviewed-by: SangHyeon Jade Lee Differential Revision: https://phab.enlightenment.org/D8793 --- src/lib/eio/efl_io_model.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/eio/efl_io_model.c b/src/lib/eio/efl_io_model.c index f5d46649d0..87d219cfb0 100644 --- a/src/lib/eio/efl_io_model.c +++ b/src/lib/eio/efl_io_model.c @@ -948,6 +948,8 @@ _efl_io_model_efl_model_children_slice_get(Eo *obj, Efl_Io_Model_Data *pd, // NOTE: We are assuming here that the parent model will outlive all its children child_data->filter.cb = pd->filter.cb, child_data->filter.data = pd->filter.data); +else + efl_ref(info->object); eina_value_array_append(, info->object); efl_wref_add(info->object, >object); --
[EGIT] [core/efl] master 02/04: eina: always initialize all the field of Eina_Value used by Eina_Promise.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=eb1d47349bbefa9d224e4bea62e9cd0c3fb37fda commit eb1d47349bbefa9d224e4bea62e9cd0c3fb37fda Author: Cedric BAIL Date: Thu Apr 25 15:40:31 2019 -0700 eina: always initialize all the field of Eina_Value used by Eina_Promise. Reviewed-by: Xavi Artigas Differential Revision: https://phab.enlightenment.org/D8794 --- src/lib/eina/eina_promise.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/eina/eina_promise.c b/src/lib/eina/eina_promise.c index a5f5c40b5a..f32d835fe4 100644 --- a/src/lib/eina/eina_promise.c +++ b/src/lib/eina/eina_promise.c @@ -1343,7 +1343,7 @@ eina_promise_all_array(Eina_Future *array[]) for (i = 0; i < ctx->base.futures_len; i++) { -Eina_Value v; +Eina_Value v = { 0 }; //Stub values... r = eina_value_setup(, EINA_VALUE_TYPE_INT); --
[EGIT] [core/efl] master 04/04: ecore: refactor Efl.CompositeModel to provide child allocation to other internal Model.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=dac867bb24dfe9c839cf734f2dc359f1a997d4a5 commit dac867bb24dfe9c839cf734f2dc359f1a997d4a5 Author: Cedric BAIL Date: Thu Apr 25 15:46:59 2019 -0700 ecore: refactor Efl.CompositeModel to provide child allocation to other internal Model. Reviewed-by: SangHyeon Jade Lee Differential Revision: https://phab.enlightenment.org/D8796 --- src/lib/ecore/efl_composite_model.c | 14 -- src/lib/ecore/efl_composite_model_private.h | 15 +++ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/lib/ecore/efl_composite_model.c b/src/lib/ecore/efl_composite_model.c index 913d2041af..630d08edf7 100644 --- a/src/lib/ecore/efl_composite_model.c +++ b/src/lib/ecore/efl_composite_model.c @@ -45,20 +45,6 @@ _children_indexed_key(const Efl_Composite_Model_Data *node, return node->index - *key; } -static Efl_Model * -_efl_composite_lookup(const Efl_Class *self, Eo *parent, Efl_Model *view, unsigned int index) -{ - EFL_COMPOSITE_LOOKUP_RETURN(remember, parent, view, "_efl.composite_model"); - - remember = efl_add_ref(self, parent, - efl_ui_view_model_set(efl_added, view), - efl_composite_model_index_set(efl_added, index), - efl_loop_model_volatile_make(efl_added)); - if (!remember) return NULL; - - EFL_COMPOSITE_REMEMBER_RETURN(remember, view); -} - static void _efl_composite_model_efl_object_invalidate(Eo *obj, Efl_Composite_Model_Data *pd) { diff --git a/src/lib/ecore/efl_composite_model_private.h b/src/lib/ecore/efl_composite_model_private.h index f4872416d3..67862f968c 100644 --- a/src/lib/ecore/efl_composite_model_private.h +++ b/src/lib/ecore/efl_composite_model_private.h @@ -56,4 +56,19 @@ _efl_composite_model_properties_mix(Eina_Iterator *super, Eina_Iterator *dyn, Ei efl_key_wref_set(View, buf, Remember); \ return Remember; + +static inline Efl_Model * +_efl_composite_lookup(const Efl_Class *self, Eo *parent, Efl_Model *view, unsigned int index) +{ + EFL_COMPOSITE_LOOKUP_RETURN(remember, parent, view, "_efl.composite_model"); + + remember = efl_add_ref(self, parent, + efl_ui_view_model_set(efl_added, view), + efl_composite_model_index_set(efl_added, index), + efl_loop_model_volatile_make(efl_added)); + if (!remember) return NULL; + + EFL_COMPOSITE_REMEMBER_RETURN(remember, view); +} + #endif --
[EGIT] [core/efl] efl-1.22 69/84: ecore: protect efl_model_properties_get from accesing NULL pointer when Model parent is not a Efl.BooleanModel.
zmike pushed a commit to branch efl-1.22. http://git.enlightenment.org/core/efl.git/commit/?id=b85c0873446d9845dd4cd36ff036ca3b960f1e70 commit b85c0873446d9845dd4cd36ff036ca3b960f1e70 Author: Cedric BAIL Date: Thu Apr 18 09:42:37 2019 -0700 ecore: protect efl_model_properties_get from accesing NULL pointer when Model parent is not a Efl.BooleanModel. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8659 --- src/lib/ecore/efl_boolean_model.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/ecore/efl_boolean_model.c b/src/lib/ecore/efl_boolean_model.c index da9d3bdf96..d43382d91f 100644 --- a/src/lib/ecore/efl_boolean_model.c +++ b/src/lib/ecore/efl_boolean_model.c @@ -32,9 +32,13 @@ static Eina_Iterator * _efl_boolean_model_efl_model_properties_get(const Eo *obj, Efl_Boolean_Model_Data *pd) { + Eina_Iterator *properties = NULL; + + if (pd->parent) + properties = eina_hash_iterator_key_new(pd->parent->values); EFL_COMPOSITE_MODEL_PROPERTIES_SUPER(props, obj, EFL_BOOLEAN_MODEL_CLASS, - eina_hash_iterator_key_new(pd->parent->values)); +properties); return props; } --
[EGIT] [core/efl] efl-1.22 41/84: ecore: rely on event instead of creating one Eo object per future that need resolving.
zmike pushed a commit to branch efl-1.22. http://git.enlightenment.org/core/efl.git/commit/?id=b5d565bed635268227adc27697ccc2557d90bfff commit b5d565bed635268227adc27697ccc2557d90bfff Author: Cedric BAIL Date: Thu Mar 28 17:18:08 2019 -0700 ecore: rely on event instead of creating one Eo object per future that need resolving. This was a terrible oversight, but the point of having a small native type for future was for making them efficient. Still we were using one Eo object for dispatching per future to dispatch new value. I could have gathered all the dispatch with just one object, but at the end we do have one object that notify us of the loop iteration... the loop object! And we have event on that object that we can rely to trigger the dispatching of future without requiring any additional object. So let's do that instead. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8567 --- src/lib/ecore/ecore_events.c | 105 ++ src/lib/ecore/ecore_private.h | 2 + 2 files changed, 48 insertions(+), 59 deletions(-) diff --git a/src/lib/ecore/ecore_events.c b/src/lib/ecore/ecore_events.c index 15667e9bd9..01a4c3d019 100644 --- a/src/lib/ecore/ecore_events.c +++ b/src/lib/ecore/ecore_events.c @@ -12,16 +12,13 @@ typedef struct _Ecore_Future_Schedule_Entry Eina_Future_Schedule_Entry base; Eina_Future_Scheduler_Cb cb; Eina_Future *future; - Eo *event; Eina_Value value; } Ecore_Future_Schedule_Entry; // // XXX: still using legacy ecore events -//static Ecore_Event_Handler *future_handler = NULL; static Eina_Boolshutting_down = EINA_FALSE; static Eina_Mempool*mp_future_schedule_entry = NULL; -//static int ECORE_EV_FUTURE_ID = -1; // // @@ -129,52 +126,47 @@ ecore_event_current_event_get(void) return ecore_event_message_handler_current_event_get(_event_msg_handler); } -/* XXX: -static Eina_Bool -ecore_future_dispatched(void *data EINA_UNUSED, -int type EINA_UNUSED, -void *event) -{ - Ecore_Future_Schedule_Entry *entry = event; - EINA_SAFETY_ON_NULL_RETURN_VAL(entry, EINA_FALSE); +static void _future_dispatch_cb(void *data, const Efl_Event *ev EINA_UNUSED); +static void _event_del_cb(void *data, const Efl_Event *ev); - entry->event = NULL; - entry->cb(entry->future, entry->value); - return EINA_FALSE; -} +EFL_CALLBACKS_ARRAY_DEFINE(ecore_future_callbacks, + { EFL_LOOP_EVENT_IDLE_ENTER, _future_dispatch_cb }, + { EFL_LOOP_EVENT_IDLE, _future_dispatch_cb }, + { EFL_EVENT_DEL, _event_del_cb }); static void -ecore_future_free(void *user_data, - void *func_data EINA_UNUSED) +_future_dispatch_cb(void *data, const Efl_Event *ev EINA_UNUSED) { - Ecore_Future_Schedule_Entry *entry = user_data; - if (entry->event) + Efl_Loop_Future_Scheduler *loopsched = data; + Eina_List *entries = loopsched->future_entries; + Ecore_Future_Schedule_Entry *entry; + + loopsched->future_entries = NULL; + efl_event_callback_array_del((Eo *) loopsched->loop, ecore_future_callbacks(), loopsched); + + EINA_LIST_FREE(entries, entry) { -eina_future_cancel(entry->future); -eina_value_flush(>value); +entry->cb(entry->future, entry->value); +eina_mempool_free(mp_future_schedule_entry, entry); } - eina_mempool_free(mp_future_schedule_entry, entry); } -*/ static void -_future_dispatch_cb(void *data, const Efl_Event *ev EINA_UNUSED) +_event_del_cb(void *data, const Efl_Event *ev EINA_UNUSED) { - Ecore_Future_Schedule_Entry *entry = data; - entry->event = NULL; - entry->cb(entry->future, entry->value); -} + Efl_Loop_Future_Scheduler *loopsched = data; + Eina_List *entries = loopsched->future_entries; + Ecore_Future_Schedule_Entry *entry; -static void -_event_del_cb(void *data, const Efl_Event *ev) -{ - Ecore_Future_Schedule_Entry *entry = data; - if ((ev->object == (Eo *) entry->event) && entry->future) + loopsched->future_entries = NULL; + efl_event_callback_array_del((Eo *) loopsched->loop, ecore_future_callbacks(), loopsched); + + EINA_LIST_FREE(entries, entry) { eina_future_cancel(entry->future); eina_value_flush(>value); +eina_mempool_free(mp_future_schedule_entry, entry); } - eina_mempool_free(mp_future_schedule_entry, entry); } static Eina_Future_Schedule_Entry * @@ -192,40 +184,35 @@ ecore_future_schedule(Eina_Future_Scheduler *sched, entry->cb = cb; entry->future = future; entry->value = value; - entry->event = efl_loop_message_future_handler_message_type_add - (loopsched->loop_data->future_me
[EGIT] [core/efl] efl-1.22 19/84: elementary: fix elm_fileselector_entry model_get to be properly build with a parent and synchronously.
zmike pushed a commit to branch efl-1.22. http://git.enlightenment.org/core/efl.git/commit/?id=171aeb16a55a2e359d9ed468a590df5cab184ba5 commit 171aeb16a55a2e359d9ed468a590df5cab184ba5 Author: Cedric BAIL Date: Tue Apr 2 10:04:32 2019 -0700 elementary: fix elm_fileselector_entry model_get to be properly build with a parent and synchronously. This fix the following warning: ERR<12924>:eo ../src/lib/eo/eo.c:880 _efl_add_internal_start() Creation of 'Efl.Io.Model' object at line 443 in '../src/lib/elementary/elc_fileselector_entry.c' is done without parent. This should use efl_add_ref. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8536 --- src/lib/elementary/elc_fileselector_entry.c | 17 ++--- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/lib/elementary/elc_fileselector_entry.c b/src/lib/elementary/elc_fileselector_entry.c index eee488267b..21c8f1f6aa 100644 --- a/src/lib/elementary/elc_fileselector_entry.c +++ b/src/lib/elementary/elc_fileselector_entry.c @@ -430,10 +430,10 @@ _elm_fileselector_entry_path_get_internal(const Evas_Object *obj) } EOLIAN static Efl_Model * -_elm_fileselector_entry_efl_ui_view_model_get(const Eo *obj EINA_UNUSED, Elm_Fileselector_Entry_Data *sd) +_elm_fileselector_entry_efl_ui_view_model_get(const Eo *obj, Elm_Fileselector_Entry_Data *sd) { Efl_Model *bmodel, *ret; - Eina_Value path; + bmodel = efl_ui_view_model_get(sd->button); if (!bmodel) { @@ -441,13 +441,16 @@ _elm_fileselector_entry_efl_ui_view_model_get(const Eo *obj EINA_UNUSED, Elm_Fil return NULL; } - ret = efl_add(efl_class_get(bmodel), NULL); free(sd->path); sd->path = elm_entry_markup_to_utf8(elm_object_text_get(sd->entry)); - eina_value_setup(, EINA_VALUE_TYPE_STRING); - eina_value_set(, sd->path); - efl_model_property_set(ret, "path", ); - eina_value_flush(); + + if (!strcmp(sd->path, efl_io_model_path_get(bmodel))) + return bmodel; + + ret = efl_add_ref(efl_class_get(bmodel), (Eo*) obj, + efl_io_model_path_set(efl_added, sd->path), + efl_loop_model_volatile_make(efl_added)); + eina_freeq_ptr_add(postponed_fq, ret, EINA_FREE_CB(efl_unref), sizeof (void*)); return ret; } --
[EGIT] [core/efl] efl-1.22 11/84: elementary: ensure that the parent model is still alive when resolving future for fileselector.
zmike pushed a commit to branch efl-1.22. http://git.enlightenment.org/core/efl.git/commit/?id=c858940928a03a4a8cc3b705113e0fd8ef8b8e80 commit c858940928a03a4a8cc3b705113e0fd8ef8b8e80 Author: Cedric BAIL Date: Thu Mar 28 12:42:45 2019 -0700 elementary: ensure that the parent model is still alive when resolving future for fileselector. This future where relying on the parent model being alive to work (efl_parent_get). For that reason we should have been using efl_future_then with the parent Model as a measure to make sure this is always the case. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8500 --- src/lib/elementary/elc_fileselector.c | 38 ++- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/src/lib/elementary/elc_fileselector.c b/src/lib/elementary/elc_fileselector.c index 6f52cf6e87..59ce7b1321 100644 --- a/src/lib/elementary/elc_fileselector.c +++ b/src/lib/elementary/elc_fileselector.c @@ -936,15 +936,12 @@ _properties_changed(void *data, const Efl_Event *ev) } static Eina_Value -_process_children_cb(void *data, const Eina_Value v, const Eina_Future *dead_future EINA_UNUSED) +_process_children_cb(Eo *model EINA_UNUSED, void *data, const Eina_Value v) { Listing_Request *lreq = data; Efl_Model *child = NULL; unsigned int i, len; - if (eina_value_type_get() == EINA_VALUE_TYPE_ERROR) - goto end; - if (!lreq->valid) goto end; EINA_VALUE_ARRAY_FOREACH(, len, i, child) @@ -960,6 +957,16 @@ _process_children_cb(void *data, const Eina_Value v, const Eina_Future *dead_fut return v; } +static Eina_Value +_process_children_error(Eo *model EINA_UNUSED, void *data, Eina_Error error) +{ + Listing_Request *lreq = data; + + _process_last(lreq); + + return eina_value_error_init(error); +} + static void _populate(Evas_Object *obj, Efl_Model *model, @@ -1030,8 +1037,11 @@ _populate(Evas_Object *obj, if (efl_model_children_count_get(model)) { future = efl_model_children_slice_get(model, 0, efl_model_children_count_get(model)); -future = eina_future_then(future, _process_children_cb, lreq, NULL); -efl_future_then(obj, future); +future = efl_future_then(obj, future); +efl_future_then(model, future, +.success = _process_children_cb, +.error = _process_children_error, +.data = lreq); } else { @@ -1562,21 +1572,19 @@ _files_grid_add(Evas_Object *obj) } static Eina_Value -_resource_created_then(void *data, const Eina_Value v, const Eina_Future *dead_future EINA_UNUSED) +_resource_created_then(Eo *model EINA_UNUSED, void *data, const Eina_Value v) { Evas_Object *fs = data; Efl_Model *child = NULL; unsigned int len, i; - if (eina_value_type_get() == EINA_VALUE_TYPE_ERROR) - goto end; - ELM_FILESELECTOR_DATA_GET(fs, sd); EINA_VALUE_ARRAY_FOREACH(, len, i, child) - _process_model(sd, child); + { +_process_model(sd, child); + } - end: return v; } @@ -1593,8 +1601,10 @@ _resource_created(void *data, const Efl_Event *event) return; f = efl_model_children_slice_get(sd->model, evt->index, 1); - f = eina_future_then(f, _resource_created_then, fs, NULL); - efl_future_then(fs, f); + f = efl_future_then(fs, f); + f = efl_future_then(sd->model, f, + .success = _resource_created_then, + .data = fs); } static void --
[EGIT] [core/efl] efl-1.22 67/84: eina: allow copy of EINA_VALUE_EMPTY type.
zmike pushed a commit to branch efl-1.22. http://git.enlightenment.org/core/efl.git/commit/?id=06c03e9b98c99ae6104a71bbee03127eeb9060b2 commit 06c03e9b98c99ae6104a71bbee03127eeb9060b2 Author: Cedric BAIL Date: Thu Apr 18 09:28:31 2019 -0700 eina: allow copy of EINA_VALUE_EMPTY type. This is usefule to allow timeout future to be propagated through eina_future_all or eina_future_race for example. Reviewed-by: Xavi Artigas Differential Revision: https://phab.enlightenment.org/D8655 --- src/lib/eina/eina_value.c | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/lib/eina/eina_value.c b/src/lib/eina/eina_value.c index dbf6f48d9c..c75a5f1235 100644 --- a/src/lib/eina/eina_value.c +++ b/src/lib/eina/eina_value.c @@ -58,6 +58,7 @@ static Eina_Hash *_eina_value_inner_mps = NULL; static Eina_Lock _eina_value_inner_mps_lock; static char *_eina_value_mp_choice = NULL; static int _eina_value_log_dom = -1; +static const Eina_Value _eina_value_empty = EINA_VALUE_EMPTY; #ifdef ERR #undef ERR @@ -3954,6 +3955,7 @@ _eina_value_type_value_vset(const Eina_Value_Type *type EINA_UNUSED, void *mem, { Eina_Value *dst = mem; Eina_Value src = va_arg(args, Eina_Value); + return eina_value_copy(, dst); } @@ -3962,6 +3964,7 @@ _eina_value_type_value_pset(const Eina_Value_Type *type EINA_UNUSED, void *mem, { Eina_Value *dst = mem; const Eina_Value *src = ptr; + return eina_value_copy(src, dst); } @@ -5591,9 +5594,7 @@ eina_value_new(const Eina_Value_Type *type) if (!value) return NULL; if (!type) { -const Eina_Value empty = EINA_VALUE_EMPTY; - -memcpy(value, , sizeof (empty)); +memcpy(value, &_eina_value_empty, sizeof (_eina_value_empty)); return value; } if (!eina_value_setup(value, type)) @@ -5622,6 +5623,13 @@ eina_value_copy(const Eina_Value *value, Eina_Value *copy) Eina_Bool ret; EINA_SAFETY_ON_NULL_RETURN_VAL(value, EINA_FALSE); + + if (!memcmp(value, &_eina_value_empty, sizeof (Eina_Value))) + { +memcpy(copy, &_eina_value_empty, sizeof (Eina_Value)); +return EINA_TRUE; + } + EINA_SAFETY_ON_FALSE_RETURN_VAL(eina_value_type_check(value->type), EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(copy, EINA_FALSE); --
[EGIT] [core/efl] efl-1.22 70/84: eio: do not fail when the future has been cancelled properly.
zmike pushed a commit to branch efl-1.22. http://git.enlightenment.org/core/efl.git/commit/?id=c4bd6721958f025d0389b2c8f717199388672be0 commit c4bd6721958f025d0389b2c8f717199388672be0 Author: Cedric BAIL Date: Tue Apr 23 09:56:09 2019 -0700 eio: do not fail when the future has been cancelled properly. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8691 --- src/tests/eio/efl_io_model_test_monitor_add.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tests/eio/efl_io_model_test_monitor_add.c b/src/tests/eio/efl_io_model_test_monitor_add.c index 041a44a5a9..f7a15cfa1a 100644 --- a/src/tests/eio/efl_io_model_test_monitor_add.c +++ b/src/tests/eio/efl_io_model_test_monitor_add.c @@ -58,7 +58,8 @@ _children_got(Eo *o, void *data EINA_UNUSED, const Eina_Value v) static Eina_Value _children_failed(Eo *o EINA_UNUSED, void *data EINA_UNUSED, const Eina_Error err) { - ck_abort_msg( "Failed to get the child with '%s'.\n", eina_error_msg_get(err)); + if (err != ECANCELED) + ck_abort_msg( "Failed to get the child with '%s'.\n", eina_error_msg_get(err)); return eina_value_error_init(err); } --
[EGIT] [core/efl] efl-1.22 20/84: elementary: fix another instances of no parent for Efl.Io.Model.
zmike pushed a commit to branch efl-1.22. http://git.enlightenment.org/core/efl.git/commit/?id=d9d69e3ef8a9e2537bdf1644c6d0e54cf62e74a3 commit d9d69e3ef8a9e2537bdf1644c6d0e54cf62e74a3 Author: Cedric BAIL Date: Tue Apr 2 11:42:48 2019 -0700 elementary: fix another instances of no parent for Efl.Io.Model. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8539 --- src/lib/elementary/elc_fileselector_entry.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/lib/elementary/elc_fileselector_entry.c b/src/lib/elementary/elc_fileselector_entry.c index 21c8f1f6aa..7274b1dd85 100644 --- a/src/lib/elementary/elc_fileselector_entry.c +++ b/src/lib/elementary/elc_fileselector_entry.c @@ -94,7 +94,6 @@ _ACTIVATED_fwd(void *data, const Efl_Event *event) { const char *file; Efl_Model *bmodel, *model; - Eina_Value path; ELM_FILESELECTOR_ENTRY_DATA_GET(data, sd); @@ -103,12 +102,9 @@ _ACTIVATED_fwd(void *data, const Efl_Event *event) bmodel = efl_ui_view_model_get(sd->button); if (bmodel) { - model = efl_add(efl_class_get(bmodel), NULL); - eina_value_setup(, EINA_VALUE_TYPE_STRING); - eina_value_set(, file); - efl_model_property_set(model, "path", ); - eina_value_flush(); - efl_ui_view_model_set(sd->button, model); +model = efl_add(efl_class_get(bmodel), sd->button, +efl_io_model_path_set(efl_added, file)); +efl_ui_view_model_set(sd->button, model); } efl_event_callback_legacy_call --
[EGIT] [core/efl] efl-1.22 17/84: elementary: enforce Efl.IoModel as a base type for fileselector.
zmike pushed a commit to branch efl-1.22. http://git.enlightenment.org/core/efl.git/commit/?id=f836dd0c2253945673b5a23ab054b52cb404cac6 commit f836dd0c2253945673b5a23ab054b52cb404cac6 Author: Cedric BAIL Date: Thu Apr 18 16:17:05 2019 -0700 elementary: enforce Efl.IoModel as a base type for fileselector. On the long run, we might just want to have an Efl.Model dedicated to be used by fileselector and inherit Efl.IoModel from it. At the moment, we don't, but I think it is still best to rely on this assumption to make the fileselector code simpler. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8654 --- src/lib/elementary/elc_fileselector.c| 2 ++ src/lib/elementary/elc_fileselector_button.c | 3 +++ src/lib/elementary/elc_fileselector_entry.c | 2 ++ 3 files changed, 7 insertions(+) diff --git a/src/lib/elementary/elc_fileselector.c b/src/lib/elementary/elc_fileselector.c index 59ce7b1321..9283dc3190 100644 --- a/src/lib/elementary/elc_fileselector.c +++ b/src/lib/elementary/elc_fileselector.c @@ -2115,6 +2115,8 @@ _elm_fileselector_path_set_internal(Evas_Object *obj, const char *_path) EOLIAN static void _elm_fileselector_efl_ui_view_model_set(Eo *obj, Elm_Fileselector_Data *sd EINA_UNUSED, Efl_Model *model) { + if (!efl_isa(model, EFL_IO_MODEL_CLASS)) + return ; _populate(obj, model, NULL, NULL); } diff --git a/src/lib/elementary/elc_fileselector_button.c b/src/lib/elementary/elc_fileselector_button.c index 1a644534f1..30aa8b225f 100644 --- a/src/lib/elementary/elc_fileselector_button.c +++ b/src/lib/elementary/elc_fileselector_button.c @@ -351,6 +351,9 @@ _elm_fileselector_button_efl_ui_view_model_set(Eo *obj EINA_UNUSED, Elm_Filesele { char *file = NULL; + if (!efl_isa(model, EFL_IO_MODEL_CLASS)) + return ; + efl_replace(>fsd.model, model); if (model) diff --git a/src/lib/elementary/elc_fileselector_entry.c b/src/lib/elementary/elc_fileselector_entry.c index df9ac79d2c..eee488267b 100644 --- a/src/lib/elementary/elc_fileselector_entry.c +++ b/src/lib/elementary/elc_fileselector_entry.c @@ -406,6 +406,8 @@ _elm_fileselector_entry_path_set_internal(Evas_Object *obj, const char *path) EOLIAN static void _elm_fileselector_entry_efl_ui_view_model_set(Eo *obj EINA_UNUSED, Elm_Fileselector_Entry_Data *sd, Efl_Model *model) { + if (!efl_isa(model, EFL_IO_MODEL_CLASS)) + return ; efl_ui_view_model_set(sd->button, model); efl_ui_view_model_set(sd->entry, model); efl_ui_property_bind(sd->entry, "default", "path"); --
[EGIT] [core/efl] efl-1.22 68/84: ecore: fix efl_model_property_ready_get to actually return the right future when the data is not ready.
zmike pushed a commit to branch efl-1.22. http://git.enlightenment.org/core/efl.git/commit/?id=50f939820250d23dd1cb596d9c75ac6a8f2f6e92 commit 50f939820250d23dd1cb596d9c75ac6a8f2f6e92 Author: Cedric BAIL Date: Thu Apr 18 09:35:48 2019 -0700 ecore: fix efl_model_property_ready_get to actually return the right future when the data is not ready. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8658 --- src/lib/ecore/efl_loop_model.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/ecore/efl_loop_model.c b/src/lib/ecore/efl_loop_model.c index 0f212f1283..5d1b2ba0ed 100644 --- a/src/lib/ecore/efl_loop_model.c +++ b/src/lib/ecore/efl_loop_model.c @@ -97,6 +97,7 @@ _efl_loop_model_efl_model_property_ready_get(Eo *obj, void *pd EINA_UNUSED, cons efl_event_callback_add(obj, EFL_MODEL_EVENT_PROPERTIES_CHANGED, _propagate_future, wd); + return efl_future_then(obj, eina_future_new(wd->p)); } return eina_future_rejected(efl_loop_future_scheduler_get(obj), err); --
[EGIT] [core/efl] efl-1.22 18/84: elementary: add a queue to postpone object destruction when necessary.
zmike pushed a commit to branch efl-1.22. http://git.enlightenment.org/core/efl.git/commit/?id=568e1db5504743735dd5117f591603eb80ead5ca commit 568e1db5504743735dd5117f591603eb80ead5ca Author: Cedric BAIL Date: Tue Apr 2 12:30:45 2019 -0700 elementary: add a queue to postpone object destruction when necessary. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8540 --- src/lib/elementary/elm_main.c | 17 + src/lib/elementary/elm_priv.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/src/lib/elementary/elm_main.c b/src/lib/elementary/elm_main.c index 676f1a9e8a..f3438364e3 100644 --- a/src/lib/elementary/elm_main.c +++ b/src/lib/elementary/elm_main.c @@ -43,6 +43,8 @@ Eina_Bool _use_build_config; static Elm_Version _version = { VMAJ, VMIN, VMIC, VREV }; EAPI Elm_Version *elm_version = &_version; +Eina_FreeQ *postponed_fq = NULL; + static void _focus_ev_redirect_cb(void *data, const Efl_Event *ev EINA_UNUSED) { @@ -755,6 +757,12 @@ elm_quicklaunch_mode_get(void) return quicklaunch_on; } +static void +_postpone_cb(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) +{ + eina_freeq_clear(postponed_fq); +} + EAPI int elm_quicklaunch_init(intargc EINA_UNUSED, char **argv) @@ -766,6 +774,8 @@ elm_quicklaunch_init(intargc EINA_UNUSED, _elm_log_dom = eina_log_domain_register("elementary", EINA_COLOR_LIGHTBLUE); EINA_SAFETY_ON_TRUE_GOTO(_elm_log_dom < 0, fail_eina_log); + postponed_fq = eina_freeq_new(EINA_FREEQ_POSTPONED); + EINA_SAFETY_ON_FALSE_GOTO(eet_init(), fail_eet); EINA_SAFETY_ON_FALSE_GOTO(ecore_init(), fail_ecore); EINA_SAFETY_ON_FALSE_GOTO(ecore_event_init(), fail_ecore_event); @@ -812,6 +822,8 @@ elm_quicklaunch_init(intargc EINA_UNUSED, if (!_elm_lib_dir) _elm_lib_dir = eina_stringshare_add("/"); if (!_property_style_ss) _property_style_ss = eina_stringshare_add("style"); + efl_event_callback_add(efl_main_loop_get(), EFL_LOOP_EVENT_IDLE_EXIT, _postpone_cb, NULL); + eina_log_timing(_elm_log_dom, EINA_LOG_STATE_STOP, EINA_LOG_STATE_INIT); if (quicklaunch_on) @@ -946,6 +958,11 @@ elm_quicklaunch_shutdown(void) emap_shutdown(); #endif + efl_event_callback_del(efl_main_loop_get(), EFL_LOOP_EVENT_IDLE_EXIT, _postpone_cb, NULL); + + eina_freeq_free(postponed_fq); + postponed_fq = NULL; + ecore_file_shutdown(); eio_shutdown(); ecore_event_shutdown(); diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h index fa262e2646..b91effed8d 100644 --- a/src/lib/elementary/elm_priv.h +++ b/src/lib/elementary/elm_priv.h @@ -905,6 +905,8 @@ extern Eina_Stringshare *_property_style_ss; extern Eina_Bool _config_profile_lock; +extern Eina_FreeQ *postponed_fq; + # ifdef HAVE_ELEMENTARY_WL2 extern Ecore_Wl2_Display *_elm_wl_display; # endif --
[EGIT] [core/efl] master 01/01: eio: do not fail when the future has been cancelled properly.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=5d512229cbbfb16b753e2b4c09eed5868f9d3994 commit 5d512229cbbfb16b753e2b4c09eed5868f9d3994 Author: Cedric BAIL Date: Tue Apr 23 09:56:09 2019 -0700 eio: do not fail when the future has been cancelled properly. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8691 --- src/tests/eio/efl_io_model_test_monitor_add.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tests/eio/efl_io_model_test_monitor_add.c b/src/tests/eio/efl_io_model_test_monitor_add.c index 041a44a5a9..f7a15cfa1a 100644 --- a/src/tests/eio/efl_io_model_test_monitor_add.c +++ b/src/tests/eio/efl_io_model_test_monitor_add.c @@ -58,7 +58,8 @@ _children_got(Eo *o, void *data EINA_UNUSED, const Eina_Value v) static Eina_Value _children_failed(Eo *o EINA_UNUSED, void *data EINA_UNUSED, const Eina_Error err) { - ck_abort_msg( "Failed to get the child with '%s'.\n", eina_error_msg_get(err)); + if (err != ECANCELED) + ck_abort_msg( "Failed to get the child with '%s'.\n", eina_error_msg_get(err)); return eina_value_error_init(err); } --
[EGIT] [core/efl] master 05/07: ecore: protect efl_model_properties_get from accesing NULL pointer when Model parent is not a Efl.BooleanModel.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=eb8511ce7bc68615fcc837031e66336cbc18dcdd commit eb8511ce7bc68615fcc837031e66336cbc18dcdd Author: Cedric BAIL Date: Thu Apr 18 09:42:37 2019 -0700 ecore: protect efl_model_properties_get from accesing NULL pointer when Model parent is not a Efl.BooleanModel. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8659 --- src/lib/ecore/efl_boolean_model.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/ecore/efl_boolean_model.c b/src/lib/ecore/efl_boolean_model.c index 20aed0fe50..03e0cee346 100644 --- a/src/lib/ecore/efl_boolean_model.c +++ b/src/lib/ecore/efl_boolean_model.c @@ -32,9 +32,13 @@ static Eina_Iterator * _efl_boolean_model_efl_model_properties_get(const Eo *obj, Efl_Boolean_Model_Data *pd) { + Eina_Iterator *properties = NULL; + + if (pd->parent) + properties = eina_hash_iterator_key_new(pd->parent->values); EFL_COMPOSITE_MODEL_PROPERTIES_SUPER(props, obj, EFL_BOOLEAN_MODEL_CLASS, - eina_hash_iterator_key_new(pd->parent->values)); +properties); return props; } --
[EGIT] [core/efl] master 06/07: ecore: use new infrastructure for Efl.CompositeModel to only have one Model object represent its data at any point in time.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=13b230029df72120191bbd837b065e2610a3c3ed commit 13b230029df72120191bbd837b065e2610a3c3ed Author: Cedric BAIL Date: Thu Apr 18 09:57:53 2019 -0700 ecore: use new infrastructure for Efl.CompositeModel to only have one Model object represent its data at any point in time. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8660 --- src/lib/ecore/efl_composite_model.c | 23 --- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/lib/ecore/efl_composite_model.c b/src/lib/ecore/efl_composite_model.c index a0457729ac..7ef607edd2 100644 --- a/src/lib/ecore/efl_composite_model.c +++ b/src/lib/ecore/efl_composite_model.c @@ -252,6 +252,20 @@ struct _Efl_Composite_Model_Slice_Request unsigned int dummy_need; }; +static Efl_Model * +_efl_composite_lookup(const Efl_Class *self, Eo *parent, Efl_Model *view, unsigned int index) +{ + EFL_COMPOSITE_LOOKUP_RETURN(remember, parent, view, "_efl.composite_model"); + + remember = efl_add_ref(self, parent, + efl_ui_view_model_set(efl_added, view), + efl_composite_model_index_set(efl_added, index), + efl_loop_model_volatile_make(efl_added)); + if (!remember) return NULL; + + EFL_COMPOSITE_REMEMBER_RETURN(remember, view); +} + static Eina_Value _efl_composite_model_then(Eo *o EINA_UNUSED, void *data, const Eina_Value v) { @@ -266,13 +280,8 @@ _efl_composite_model_then(Eo *o EINA_UNUSED, void *data, const Eina_Value v) { Eo *composite; -// First set the Model to be used as a source so that we the newly object -// can know if it needs to retain the information regarding its index. -composite = efl_add_ref(req->self, req->parent, -efl_ui_view_model_set(efl_added, target), -efl_composite_model_index_set(efl_added, req->start + i), -efl_loop_model_volatile_make(efl_added)); - +// Fetch an existing composite model for this model or create a new one if none exist +composite = _efl_composite_lookup(req->self, req->parent, target, req->start + i); eina_value_array_append(, composite); // Dropping this scope reference efl_unref(composite); --
[EGIT] [core/efl] master 04/07: ecore: fix efl_model_property_ready_get to actually return the right future when the data is not ready.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=8872e4845802633a39faaeed3d9af7d94b8cb96e commit 8872e4845802633a39faaeed3d9af7d94b8cb96e Author: Cedric BAIL Date: Thu Apr 18 09:35:48 2019 -0700 ecore: fix efl_model_property_ready_get to actually return the right future when the data is not ready. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8658 --- src/lib/ecore/efl_loop_model.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/ecore/efl_loop_model.c b/src/lib/ecore/efl_loop_model.c index 48309a5102..11f64a7352 100644 --- a/src/lib/ecore/efl_loop_model.c +++ b/src/lib/ecore/efl_loop_model.c @@ -97,6 +97,7 @@ _efl_loop_model_efl_model_property_ready_get(Eo *obj, void *pd EINA_UNUSED, cons efl_event_callback_add(obj, EFL_MODEL_EVENT_PROPERTIES_CHANGED, _propagate_future, wd); + return efl_future_then(obj, eina_future_new(wd->p)); } return eina_future_rejected(efl_loop_future_scheduler_get(obj), err); --
[EGIT] [core/efl] master 02/07: ecore: add infrastructure to create children Model once and avoid duplicated view of the same data.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=d9d5846db68f19c17af444e3485f5f0d4f3cd35f commit d9d5846db68f19c17af444e3485f5f0d4f3cd35f Author: Cedric BAIL Date: Thu Apr 18 09:31:14 2019 -0700 ecore: add infrastructure to create children Model once and avoid duplicated view of the same data. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8656 --- src/lib/ecore/efl_composite_model_private.h | 16 1 file changed, 16 insertions(+) diff --git a/src/lib/ecore/efl_composite_model_private.h b/src/lib/ecore/efl_composite_model_private.h index b780326c8b..f4872416d3 100644 --- a/src/lib/ecore/efl_composite_model_private.h +++ b/src/lib/ecore/efl_composite_model_private.h @@ -40,4 +40,20 @@ _efl_composite_model_properties_mix(Eina_Iterator *super, Eina_Iterator *dyn, Ei }; } +#define EFL_COMPOSITE_LOOKUP_RETURN(Remember, Parent, View, Base) \ + Efl_Model *Remember; \ + char buf[1024]; \ +\ + snprintf(buf, sizeof (buf), Base"-%p", Parent); \ + Remember = efl_key_wref_get(View, buf); \ + if (Remember) \ +{ \ + efl_ref(Remember); \ + return Remember; \ +} + +#define EFL_COMPOSITE_REMEMBER_RETURN(Remember, View) \ + efl_key_wref_set(View, buf, Remember); \ + return Remember; + #endif --
[EGIT] [core/efl] master 07/07: ecore: properly handle CHILD_ADDED and CHILD_REMOVED from source for Efl.CompositeModel
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=78563a395e1d9140eb6a67e7e7f9aff34af10e4b commit 78563a395e1d9140eb6a67e7e7f9aff34af10e4b Author: Cedric BAIL Date: Thu Apr 18 13:37:28 2019 -0700 ecore: properly handle CHILD_ADDED and CHILD_REMOVED from source for Efl.CompositeModel Before this patch we were directly sending this event on the Efl.CompositeModel, but they actually might contain an Efl.Model in the event child field. That Efl.Model wouldn't have been converted before to an Efl.CompositeModel exposing incoherence from the user of the object point of view. This patch fix that behavior. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8661 --- src/lib/ecore/efl_composite_model.c | 92 ++--- 1 file changed, 64 insertions(+), 28 deletions(-) diff --git a/src/lib/ecore/efl_composite_model.c b/src/lib/ecore/efl_composite_model.c index 7ef607edd2..4a7e11413e 100644 --- a/src/lib/ecore/efl_composite_model.c +++ b/src/lib/ecore/efl_composite_model.c @@ -45,21 +45,18 @@ _children_indexed_key(const Efl_Composite_Model_Data *node, return node->index - *key; } -static void -_efl_composite_model_efl_object_destructor(Eo *obj, Efl_Composite_Model_Data *pd) +static Efl_Model * +_efl_composite_lookup(const Efl_Class *self, Eo *parent, Efl_Model *view, unsigned int index) { - if (pd->source) - { -efl_event_callback_forwarder_del(pd->source, EFL_MODEL_EVENT_CHILD_ADDED, obj); -efl_event_callback_forwarder_del(pd->source, EFL_MODEL_EVENT_CHILD_REMOVED, obj); -efl_event_callback_forwarder_del(pd->source, EFL_MODEL_EVENT_CHILDREN_COUNT_CHANGED, obj); -efl_event_callback_forwarder_del(pd->source, EFL_MODEL_EVENT_PROPERTIES_CHANGED, obj); + EFL_COMPOSITE_LOOKUP_RETURN(remember, parent, view, "_efl.composite_model"); -efl_unref(pd->source); -pd->source = NULL; - } + remember = efl_add_ref(self, parent, + efl_ui_view_model_set(efl_added, view), + efl_composite_model_index_set(efl_added, index), + efl_loop_model_volatile_make(efl_added)); + if (!remember) return NULL; - efl_destructor(efl_super(obj, EFL_COMPOSITE_MODEL_CLASS)); + EFL_COMPOSITE_REMEMBER_RETURN(remember, view); } static void @@ -155,6 +152,44 @@ _efl_composite_model_index_get(const Eo *obj, Efl_Composite_Model_Data *pd) return r; } +static void +_efl_composite_model_child_added(void *data, const Efl_Event *event) +{ + Efl_Composite_Model_Data *pd = data; + Efl_Model_Children_Event *ev = event->info; + Efl_Model_Children_Event cev = { 0 }; + + cev.index = ev->index; + if (ev->child) + cev.child = _efl_composite_lookup(efl_class_get(pd->self), + pd->self, ev->child, ev->index); + + efl_event_callback_call(pd->self, EFL_MODEL_EVENT_CHILD_ADDED, ); + + efl_unref(cev.child); +} + +static void +_efl_composite_model_child_removed(void *data, const Efl_Event *event) +{ + Efl_Composite_Model_Data *pd = data; + Efl_Model_Children_Event *ev = event->info; + Efl_Model_Children_Event cev = { 0 }; + + cev.index = ev->index; + if (ev->child) + cev.child = _efl_composite_lookup(efl_class_get(pd->self), + pd->self, ev->child, ev->index); + + efl_event_callback_call(pd->self, EFL_MODEL_EVENT_CHILD_REMOVED, ); + + efl_unref(cev.child); +} + +EFL_CALLBACKS_ARRAY_DEFINE(composite_callbacks, + { EFL_MODEL_EVENT_CHILD_ADDED, _efl_composite_model_child_added }, + { EFL_MODEL_EVENT_CHILD_REMOVED, _efl_composite_model_child_removed }); + static void _efl_composite_model_efl_ui_view_model_set(Eo *obj EINA_UNUSED, Efl_Composite_Model_Data *pd, Efl_Model *model) { @@ -168,8 +203,7 @@ _efl_composite_model_efl_ui_view_model_set(Eo *obj EINA_UNUSED, Efl_Composite_Mo } pd->source = efl_ref(model); - efl_event_callback_forwarder_priority_add(model, EFL_MODEL_EVENT_CHILD_ADDED, EFL_CALLBACK_PRIORITY_BEFORE, obj); - efl_event_callback_forwarder_priority_add(model, EFL_MODEL_EVENT_CHILD_REMOVED, EFL_CALLBACK_PRIORITY_BEFORE, obj); + efl_event_callback_array_add(model, composite_callbacks(), pd); efl_event_callback_forwarder_priority_add(model, EFL_MODEL_EVENT_CHILDREN_COUNT_CHANGED, EFL_CALLBACK_PRIORITY_BEFORE, obj); efl_event_callback_forwarder_priority_add(model, EFL_MODEL_EVENT_PROPERTIES_CHANGED, EFL_CALLBACK_PRIORITY_BEFORE, obj); @@ -252,20 +286,6 @@ struct _Efl_Composite_Model_Slice_Request unsigned int dummy_need; }; -static Efl_Model * -_efl_composite_lookup(const Efl_Class *self, Eo *parent, Efl_Model *view, unsigned int index) -{ - EFL_COMPOSITE_LOOKUP
[EGIT] [core/efl] master 03/07: ecore: allow multiple Efl.ViewModel of the same source thanks to new infrastructure.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=fcd5eb755b7c97ae157ab860f284a9716d549555 commit fcd5eb755b7c97ae157ab860f284a9716d549555 Author: Cedric BAIL Date: Thu Apr 18 09:34:46 2019 -0700 ecore: allow multiple Efl.ViewModel of the same source thanks to new infrastructure. Reviewed-by: SangHyeon Jade Lee Differential Revision: https://phab.enlightenment.org/D8657 --- src/lib/ecore/efl_view_model.c | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/lib/ecore/efl_view_model.c b/src/lib/ecore/efl_view_model.c index 7bb9a34673..dd3fefaba1 100644 --- a/src/lib/ecore/efl_view_model.c +++ b/src/lib/ecore/efl_view_model.c @@ -350,19 +350,14 @@ _efl_view_model_parent_data(Efl_View_Model *child, Efl_View_Model_Data *ppd) static Efl_View_Model * _efl_view_model_child_lookup(Efl_View_Model_Data *pd, Efl_Object *parent, Efl_Model *view) { - Efl_View_Model *co; - - co = efl_key_wref_get(view, "_efl.view_model"); - if (co) return co; + EFL_COMPOSITE_LOOKUP_RETURN(co, parent, view, "_efl.view_model"); co = efl_add(EFL_VIEW_MODEL_CLASS, parent, efl_ui_view_model_set(efl_added, view), _efl_view_model_parent_data(efl_added, pd)); if (!co) return NULL; - efl_key_wref_set(view, "_efl.view_model", co); - - return co; + EFL_COMPOSITE_REMEMBER_RETURN(co, view); } static void --
[EGIT] [core/efl] master 01/07: eina: allow copy of EINA_VALUE_EMPTY type.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=805128dbf38483ae6bd9ef531b4e002d564ca391 commit 805128dbf38483ae6bd9ef531b4e002d564ca391 Author: Cedric BAIL Date: Thu Apr 18 09:28:31 2019 -0700 eina: allow copy of EINA_VALUE_EMPTY type. This is usefule to allow timeout future to be propagated through eina_future_all or eina_future_race for example. Reviewed-by: Xavi Artigas Differential Revision: https://phab.enlightenment.org/D8655 --- src/lib/eina/eina_value.c | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/lib/eina/eina_value.c b/src/lib/eina/eina_value.c index dbf6f48d9c..c75a5f1235 100644 --- a/src/lib/eina/eina_value.c +++ b/src/lib/eina/eina_value.c @@ -58,6 +58,7 @@ static Eina_Hash *_eina_value_inner_mps = NULL; static Eina_Lock _eina_value_inner_mps_lock; static char *_eina_value_mp_choice = NULL; static int _eina_value_log_dom = -1; +static const Eina_Value _eina_value_empty = EINA_VALUE_EMPTY; #ifdef ERR #undef ERR @@ -3954,6 +3955,7 @@ _eina_value_type_value_vset(const Eina_Value_Type *type EINA_UNUSED, void *mem, { Eina_Value *dst = mem; Eina_Value src = va_arg(args, Eina_Value); + return eina_value_copy(, dst); } @@ -3962,6 +3964,7 @@ _eina_value_type_value_pset(const Eina_Value_Type *type EINA_UNUSED, void *mem, { Eina_Value *dst = mem; const Eina_Value *src = ptr; + return eina_value_copy(src, dst); } @@ -5591,9 +5594,7 @@ eina_value_new(const Eina_Value_Type *type) if (!value) return NULL; if (!type) { -const Eina_Value empty = EINA_VALUE_EMPTY; - -memcpy(value, , sizeof (empty)); +memcpy(value, &_eina_value_empty, sizeof (_eina_value_empty)); return value; } if (!eina_value_setup(value, type)) @@ -5622,6 +5623,13 @@ eina_value_copy(const Eina_Value *value, Eina_Value *copy) Eina_Bool ret; EINA_SAFETY_ON_NULL_RETURN_VAL(value, EINA_FALSE); + + if (!memcmp(value, &_eina_value_empty, sizeof (Eina_Value))) + { +memcpy(copy, &_eina_value_empty, sizeof (Eina_Value)); +return EINA_TRUE; + } + EINA_SAFETY_ON_FALSE_RETURN_VAL(eina_value_type_check(value->type), EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(copy, EINA_FALSE); --
[EGIT] [tools/expedite] master 01/02: enable git phab to work with expedite repo.
cedric pushed a commit to branch master. http://git.enlightenment.org/tools/expedite.git/commit/?id=b624cde117968a8f62f62d17ce3502d1d678b13e commit b624cde117968a8f62f62d17ce3502d1d678b13e Author: Cedric BAIL Date: Wed Apr 24 09:53:11 2019 -0700 enable git phab to work with expedite repo. --- .arcconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.arcconfig b/.arcconfig index 0bddbcc..de9c98f 100644 --- a/.arcconfig +++ b/.arcconfig @@ -1,4 +1,6 @@ { "project_id" : "expedite", - "conduit_uri" : "https://phab.enlightenment.org/; + "projects" : "expedite", + "conduit_uri" : "https://phab.enlightenment.org/;, + "phabricator.uri" : "https://phab.enlightenment.org/; } --
[EGIT] [core/efl] master 04/05: ecore: rely on event instead of creating one Eo object per future that need resolving.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=1ec4ad155688df9b1cec8e608481d64e776feae8 commit 1ec4ad155688df9b1cec8e608481d64e776feae8 Author: Cedric BAIL Date: Thu Mar 28 17:18:08 2019 -0700 ecore: rely on event instead of creating one Eo object per future that need resolving. This was a terrible oversight, but the point of having a small native type for future was for making them efficient. Still we were using one Eo object for dispatching per future to dispatch new value. I could have gathered all the dispatch with just one object, but at the end we do have one object that notify us of the loop iteration... the loop object! And we have event on that object that we can rely to trigger the dispatching of future without requiring any additional object. So let's do that instead. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8567 --- src/lib/ecore/ecore_events.c | 105 ++ src/lib/ecore/ecore_private.h | 2 + 2 files changed, 48 insertions(+), 59 deletions(-) diff --git a/src/lib/ecore/ecore_events.c b/src/lib/ecore/ecore_events.c index 15667e9bd9..01a4c3d019 100644 --- a/src/lib/ecore/ecore_events.c +++ b/src/lib/ecore/ecore_events.c @@ -12,16 +12,13 @@ typedef struct _Ecore_Future_Schedule_Entry Eina_Future_Schedule_Entry base; Eina_Future_Scheduler_Cb cb; Eina_Future *future; - Eo *event; Eina_Value value; } Ecore_Future_Schedule_Entry; // // XXX: still using legacy ecore events -//static Ecore_Event_Handler *future_handler = NULL; static Eina_Boolshutting_down = EINA_FALSE; static Eina_Mempool*mp_future_schedule_entry = NULL; -//static int ECORE_EV_FUTURE_ID = -1; // // @@ -129,52 +126,47 @@ ecore_event_current_event_get(void) return ecore_event_message_handler_current_event_get(_event_msg_handler); } -/* XXX: -static Eina_Bool -ecore_future_dispatched(void *data EINA_UNUSED, -int type EINA_UNUSED, -void *event) -{ - Ecore_Future_Schedule_Entry *entry = event; - EINA_SAFETY_ON_NULL_RETURN_VAL(entry, EINA_FALSE); +static void _future_dispatch_cb(void *data, const Efl_Event *ev EINA_UNUSED); +static void _event_del_cb(void *data, const Efl_Event *ev); - entry->event = NULL; - entry->cb(entry->future, entry->value); - return EINA_FALSE; -} +EFL_CALLBACKS_ARRAY_DEFINE(ecore_future_callbacks, + { EFL_LOOP_EVENT_IDLE_ENTER, _future_dispatch_cb }, + { EFL_LOOP_EVENT_IDLE, _future_dispatch_cb }, + { EFL_EVENT_DEL, _event_del_cb }); static void -ecore_future_free(void *user_data, - void *func_data EINA_UNUSED) +_future_dispatch_cb(void *data, const Efl_Event *ev EINA_UNUSED) { - Ecore_Future_Schedule_Entry *entry = user_data; - if (entry->event) + Efl_Loop_Future_Scheduler *loopsched = data; + Eina_List *entries = loopsched->future_entries; + Ecore_Future_Schedule_Entry *entry; + + loopsched->future_entries = NULL; + efl_event_callback_array_del((Eo *) loopsched->loop, ecore_future_callbacks(), loopsched); + + EINA_LIST_FREE(entries, entry) { -eina_future_cancel(entry->future); -eina_value_flush(>value); +entry->cb(entry->future, entry->value); +eina_mempool_free(mp_future_schedule_entry, entry); } - eina_mempool_free(mp_future_schedule_entry, entry); } -*/ static void -_future_dispatch_cb(void *data, const Efl_Event *ev EINA_UNUSED) +_event_del_cb(void *data, const Efl_Event *ev EINA_UNUSED) { - Ecore_Future_Schedule_Entry *entry = data; - entry->event = NULL; - entry->cb(entry->future, entry->value); -} + Efl_Loop_Future_Scheduler *loopsched = data; + Eina_List *entries = loopsched->future_entries; + Ecore_Future_Schedule_Entry *entry; -static void -_event_del_cb(void *data, const Efl_Event *ev) -{ - Ecore_Future_Schedule_Entry *entry = data; - if ((ev->object == (Eo *) entry->event) && entry->future) + loopsched->future_entries = NULL; + efl_event_callback_array_del((Eo *) loopsched->loop, ecore_future_callbacks(), loopsched); + + EINA_LIST_FREE(entries, entry) { eina_future_cancel(entry->future); eina_value_flush(>value); +eina_mempool_free(mp_future_schedule_entry, entry); } - eina_mempool_free(mp_future_schedule_entry, entry); } static Eina_Future_Schedule_Entry * @@ -192,40 +184,35 @@ ecore_future_schedule(Eina_Future_Scheduler *sched, entry->cb = cb; entry->future = future; entry->value = value; - entry->event = efl_loop_message_future_handler_message_type_add - (loopsched->loop_data->future_me
[EGIT] [core/efl] master 01/01: ecore: add an helper for Efl.Boolean_Model to get all the index with a requested value.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=75f43ca971bb476f4c3639a198b764e6520fc859 commit 75f43ca971bb476f4c3639a198b764e6520fc859 Author: Cedric BAIL Date: Wed Apr 3 14:23:01 2019 -0700 ecore: add an helper for Efl.Boolean_Model to get all the index with a requested value. Differential Revision: https://phab.enlightenment.org/D8569 --- src/lib/ecore/efl_boolean_model.c | 117 + src/lib/ecore/efl_boolean_model.eo | 8 +++ 2 files changed, 125 insertions(+) diff --git a/src/lib/ecore/efl_boolean_model.c b/src/lib/ecore/efl_boolean_model.c index da9d3bdf96..20aed0fe50 100644 --- a/src/lib/ecore/efl_boolean_model.c +++ b/src/lib/ecore/efl_boolean_model.c @@ -207,4 +207,121 @@ _efl_boolean_model_boolean_del(Eo *obj EINA_UNUSED, eina_stringshare_del(s); } +typedef struct _Eina_Iterator_Boolean Eina_Iterator_Boolean; + +struct _Eina_Iterator_Boolean +{ + Eina_Iterator iterator; + + Eo *obj; + Efl_Boolean_Model_Data *pd; + Efl_Boolean_Model_Value *v; + + uint64_t index; + uint64_t total; + + Eina_Bool request; +}; + +static inline Eina_Bool +_lookup_next_chunk(uint64_t *index, uint64_t total, + Efl_Boolean_Model_Value *v, unsigned char pattern) +{ + uint64_t upidx = *index >> 3; + + while (upidx < v->buffer_count && + v->buffer[upidx] == pattern) + upidx++; + + *index = upidx << 3; + if (upidx == v->buffer_count && + *index >= total) return EINA_FALSE; + return EINA_TRUE; +} + +static Eina_Bool +efl_boolean_model_iterator_next(Eina_Iterator_Boolean *it, void **data) +{ + uint64_t upidx; + + *data = >index; + it->index++; + + retry: + if (it->index >= it->total) return EINA_FALSE; + if ((it->index >> 3) >= it->v->buffer_count) + { +if (it->v->default_value != it->request) + return EINA_FALSE; +return EINA_TRUE; + } + + upidx = it->index >> 3; + while ((it->index >> 3) == upidx) + { +Eina_Bool flag = it->v->buffer[it->index >> 3] & + (((unsigned char)1) << (it->index & 0x7)); + +if (it->request == !!flag) + break; + +it->index++; + } + + if ((it->index >> 3) != upidx) + { +if (!_lookup_next_chunk(>index, it->total, it->v, it->request ? 0x00 : 0xFF)) + return EINA_FALSE; +goto retry; + } + + return EINA_TRUE; +} + +static Eo * +efl_boolean_model_iterator_get_container(Eina_Iterator_Boolean *it) +{ + return it->obj; +} + +static void +efl_boolean_model_iterator_free(Eina_Iterator_Boolean *it) +{ + efl_unref(it->obj); + EINA_MAGIC_SET(>iterator, EINA_MAGIC_NONE); + free(it); +} + +static Eina_Iterator * +_efl_boolean_model_boolean_iterator_get(Eo *obj, Efl_Boolean_Model_Data *pd, const char *name, Eina_Bool request) +{ + Eina_Iterator_Boolean *itb; + Efl_Boolean_Model_Value *v; + Eina_Stringshare *s; + + s = eina_stringshare_add(name); + v = eina_hash_find(pd->values, s); + eina_stringshare_del(s); + if (!v) return NULL; + + itb = calloc(1, sizeof (Eina_Iterator_Boolean)); + if (!itb) return NULL; + + itb->obj = efl_ref(obj); + itb->pd = pd; + itb->v = v; + itb->index = 0; + itb->total = efl_model_children_count_get(obj); + itb->request = !!request; + + itb->iterator.version = EINA_ITERATOR_VERSION; + itb->iterator.next = FUNC_ITERATOR_NEXT(efl_boolean_model_iterator_next); + itb->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(efl_boolean_model_iterator_get_container); + itb->iterator.free = FUNC_ITERATOR_FREE(efl_boolean_model_iterator_free); + + EINA_MAGIC_SET(>iterator, EINA_MAGIC_ITERATOR); + return >iterator; +} + + #include "efl_boolean_model.eo.c" diff --git a/src/lib/ecore/efl_boolean_model.eo b/src/lib/ecore/efl_boolean_model.eo index 19f8f02935..049344d2bb 100644 --- a/src/lib/ecore/efl_boolean_model.eo +++ b/src/lib/ecore/efl_boolean_model.eo @@ -15,6 +15,14 @@ class @beta Efl.Boolean_Model extends Efl.Composite_Model @in name: string; } } + boolean_iterator_get { + [[Get an iterator that will quickly find all the index with the requested value for a specific boolean.]] + params { +@in name: string; +@in request: bool; + } + return: iterator; [[The iterator that is valid until any change is made on the model.]] + } } implements { Efl.Model.properties { get; } --
[EGIT] [core/efl] master 01/06: ecore: implement reflection for Efl.LoopModel properties.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=ef4dde48a035006b9d4dcd083eca836402bc5735 commit ef4dde48a035006b9d4dcd083eca836402bc5735 Author: Cedric BAIL Date: Thu Apr 18 16:15:16 2019 -0700 ecore: implement reflection for Efl.LoopModel properties. This enable relying on Eo reflection capabilities to expose Efl.Model properties. Should make API nicer to maintain. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8652 --- src/lib/ecore/efl_loop_model.c | 27 +++ src/lib/ecore/efl_loop_model.eo | 1 + 2 files changed, 28 insertions(+) diff --git a/src/lib/ecore/efl_loop_model.c b/src/lib/ecore/efl_loop_model.c index 0f212f1283..48309a5102 100644 --- a/src/lib/ecore/efl_loop_model.c +++ b/src/lib/ecore/efl_loop_model.c @@ -125,6 +125,33 @@ _efl_loop_model_volatile_make(Eo *obj, void *pd EINA_UNUSED) efl_event_callback_add(obj, EFL_EVENT_NOREF, _noref_death, NULL); } +static Eina_Future * +_efl_loop_model_efl_model_property_set(Eo *obj, void *pd EINA_UNUSED, + const char *property, Eina_Value *value) +{ + Eina_Error err; + + if (!value) return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_INCORRECT_VALUE); + err = efl_property_reflection_set(obj, property, *value); + if (err) return efl_loop_future_rejected(obj, err); + + return efl_loop_future_resolved(obj, efl_property_reflection_get(obj, property)); +} + +static Eina_Value * +_efl_loop_model_efl_model_property_get(const Eo *obj, void *pd EINA_UNUSED, + const char *property) +{ + Eina_Value *r; + Eina_Value direct; + + direct = efl_property_reflection_get(obj, property); + r = eina_value_dup(); + eina_value_flush(); + + return r; +} + static void _efl_loop_model_efl_object_invalidate(Eo *obj, void *pd EINA_UNUSED) { diff --git a/src/lib/ecore/efl_loop_model.eo b/src/lib/ecore/efl_loop_model.eo index 362b8bff09..7d727efbc3 100644 --- a/src/lib/ecore/efl_loop_model.eo +++ b/src/lib/ecore/efl_loop_model.eo @@ -14,5 +14,6 @@ abstract @beta Efl.Loop_Model extends Efl.Loop_Consumer implements Efl.Model implements { Efl.Object.invalidate; Efl.Model.property_ready_get; + Efl.Model.property { get; set; } } } --
[EGIT] [core/efl] master 02/06: eio: rely on inheritance and reflection for Efl.IoModel path property.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=3b0261d5524ab8edb870a6c48549a4afd38757d4 commit 3b0261d5524ab8edb870a6c48549a4afd38757d4 Author: Cedric BAIL Date: Thu Apr 18 16:16:26 2019 -0700 eio: rely on inheritance and reflection for Efl.IoModel path property. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8653 --- src/lib/eio/efl_io_model.c | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/lib/eio/efl_io_model.c b/src/lib/eio/efl_io_model.c index 300dac0e21..f5d46649d0 100644 --- a/src/lib/eio/efl_io_model.c +++ b/src/lib/eio/efl_io_model.c @@ -495,12 +495,6 @@ _property_filename_cb(const Eo *obj, Efl_Io_Model_Data *pd) return eina_value_error_new(EAGAIN); } -static Eina_Value * -_property_path_cb(const Eo *obj EINA_UNUSED, Efl_Io_Model_Data *pd) -{ - return eina_value_stringshare_new(pd->path); -} - static Eina_Value * _property_direct_info_cb(const Eo *obj, Efl_Io_Model_Data *pd) { @@ -620,7 +614,7 @@ static struct { const char *name; Eina_Value *(*cb)(const Eo *obj, Efl_Io_Model_Data *pd); } properties[] = { - PP(filename), PP(path), + PP(filename), PP(direct_info), PP(mtime), PP(atime), PP(ctime), PP(is_dir), PP(is_lnk), PP(size), PP(stat), @@ -649,9 +643,7 @@ _efl_io_model_efl_model_property_get(const Eo *obj, Efl_Io_Model_Data *pd, const !strcmp(property, properties[i].name)) return properties[i].cb(obj, pd); - ERR("Could not find property '%s'.", property); - // Unknow value request - return eina_value_error_new(EFL_MODEL_ERROR_NOT_SUPPORTED); + return efl_model_property_get(efl_super(obj, EFL_IO_MODEL_CLASS), property); } static Eina_Future * --
[EGIT] [core/efl] master 05/06: elementary: fix elm_fileselector_entry model_get to be properly build with a parent and synchronously.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=b2db95947a67bfa28a7d94d729be61d88e004372 commit b2db95947a67bfa28a7d94d729be61d88e004372 Author: Cedric BAIL Date: Tue Apr 2 10:04:32 2019 -0700 elementary: fix elm_fileselector_entry model_get to be properly build with a parent and synchronously. This fix the following warning: ERR<12924>:eo ../src/lib/eo/eo.c:880 _efl_add_internal_start() Creation of 'Efl.Io.Model' object at line 443 in '../src/lib/elementary/elc_fileselector_entry.c' is done without parent. This should use efl_add_ref. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8536 --- src/lib/elementary/elc_fileselector_entry.c | 17 ++--- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/lib/elementary/elc_fileselector_entry.c b/src/lib/elementary/elc_fileselector_entry.c index eee488267b..21c8f1f6aa 100644 --- a/src/lib/elementary/elc_fileselector_entry.c +++ b/src/lib/elementary/elc_fileselector_entry.c @@ -430,10 +430,10 @@ _elm_fileselector_entry_path_get_internal(const Evas_Object *obj) } EOLIAN static Efl_Model * -_elm_fileselector_entry_efl_ui_view_model_get(const Eo *obj EINA_UNUSED, Elm_Fileselector_Entry_Data *sd) +_elm_fileselector_entry_efl_ui_view_model_get(const Eo *obj, Elm_Fileselector_Entry_Data *sd) { Efl_Model *bmodel, *ret; - Eina_Value path; + bmodel = efl_ui_view_model_get(sd->button); if (!bmodel) { @@ -441,13 +441,16 @@ _elm_fileselector_entry_efl_ui_view_model_get(const Eo *obj EINA_UNUSED, Elm_Fil return NULL; } - ret = efl_add(efl_class_get(bmodel), NULL); free(sd->path); sd->path = elm_entry_markup_to_utf8(elm_object_text_get(sd->entry)); - eina_value_setup(, EINA_VALUE_TYPE_STRING); - eina_value_set(, sd->path); - efl_model_property_set(ret, "path", ); - eina_value_flush(); + + if (!strcmp(sd->path, efl_io_model_path_get(bmodel))) + return bmodel; + + ret = efl_add_ref(efl_class_get(bmodel), (Eo*) obj, + efl_io_model_path_set(efl_added, sd->path), + efl_loop_model_volatile_make(efl_added)); + eina_freeq_ptr_add(postponed_fq, ret, EINA_FREE_CB(efl_unref), sizeof (void*)); return ret; } --
[EGIT] [core/efl] master 03/06: elementary: enforce Efl.IoModel as a base type for fileselector.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=44fb906c4ffcc5aa6a198d54ab2f9e05133d2a32 commit 44fb906c4ffcc5aa6a198d54ab2f9e05133d2a32 Author: Cedric BAIL Date: Thu Apr 18 16:17:05 2019 -0700 elementary: enforce Efl.IoModel as a base type for fileselector. On the long run, we might just want to have an Efl.Model dedicated to be used by fileselector and inherit Efl.IoModel from it. At the moment, we don't, but I think it is still best to rely on this assumption to make the fileselector code simpler. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8654 --- src/lib/elementary/elc_fileselector.c| 2 ++ src/lib/elementary/elc_fileselector_button.c | 3 +++ src/lib/elementary/elc_fileselector_entry.c | 2 ++ 3 files changed, 7 insertions(+) diff --git a/src/lib/elementary/elc_fileselector.c b/src/lib/elementary/elc_fileselector.c index 59ce7b1321..9283dc3190 100644 --- a/src/lib/elementary/elc_fileselector.c +++ b/src/lib/elementary/elc_fileselector.c @@ -2115,6 +2115,8 @@ _elm_fileselector_path_set_internal(Evas_Object *obj, const char *_path) EOLIAN static void _elm_fileselector_efl_ui_view_model_set(Eo *obj, Elm_Fileselector_Data *sd EINA_UNUSED, Efl_Model *model) { + if (!efl_isa(model, EFL_IO_MODEL_CLASS)) + return ; _populate(obj, model, NULL, NULL); } diff --git a/src/lib/elementary/elc_fileselector_button.c b/src/lib/elementary/elc_fileselector_button.c index 1a644534f1..30aa8b225f 100644 --- a/src/lib/elementary/elc_fileselector_button.c +++ b/src/lib/elementary/elc_fileselector_button.c @@ -351,6 +351,9 @@ _elm_fileselector_button_efl_ui_view_model_set(Eo *obj EINA_UNUSED, Elm_Filesele { char *file = NULL; + if (!efl_isa(model, EFL_IO_MODEL_CLASS)) + return ; + efl_replace(>fsd.model, model); if (model) diff --git a/src/lib/elementary/elc_fileselector_entry.c b/src/lib/elementary/elc_fileselector_entry.c index df9ac79d2c..eee488267b 100644 --- a/src/lib/elementary/elc_fileselector_entry.c +++ b/src/lib/elementary/elc_fileselector_entry.c @@ -406,6 +406,8 @@ _elm_fileselector_entry_path_set_internal(Evas_Object *obj, const char *path) EOLIAN static void _elm_fileselector_entry_efl_ui_view_model_set(Eo *obj EINA_UNUSED, Elm_Fileselector_Entry_Data *sd, Efl_Model *model) { + if (!efl_isa(model, EFL_IO_MODEL_CLASS)) + return ; efl_ui_view_model_set(sd->button, model); efl_ui_view_model_set(sd->entry, model); efl_ui_property_bind(sd->entry, "default", "path"); --
[EGIT] [core/efl] master 06/06: elementary: fix another instances of no parent for Efl.Io.Model.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=c9e62e957b271baf8267830aaa9972e9818bdd34 commit c9e62e957b271baf8267830aaa9972e9818bdd34 Author: Cedric BAIL Date: Tue Apr 2 11:42:48 2019 -0700 elementary: fix another instances of no parent for Efl.Io.Model. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8539 --- src/lib/elementary/elc_fileselector_entry.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/lib/elementary/elc_fileselector_entry.c b/src/lib/elementary/elc_fileselector_entry.c index 21c8f1f6aa..7274b1dd85 100644 --- a/src/lib/elementary/elc_fileselector_entry.c +++ b/src/lib/elementary/elc_fileselector_entry.c @@ -94,7 +94,6 @@ _ACTIVATED_fwd(void *data, const Efl_Event *event) { const char *file; Efl_Model *bmodel, *model; - Eina_Value path; ELM_FILESELECTOR_ENTRY_DATA_GET(data, sd); @@ -103,12 +102,9 @@ _ACTIVATED_fwd(void *data, const Efl_Event *event) bmodel = efl_ui_view_model_get(sd->button); if (bmodel) { - model = efl_add(efl_class_get(bmodel), NULL); - eina_value_setup(, EINA_VALUE_TYPE_STRING); - eina_value_set(, file); - efl_model_property_set(model, "path", ); - eina_value_flush(); - efl_ui_view_model_set(sd->button, model); +model = efl_add(efl_class_get(bmodel), sd->button, +efl_io_model_path_set(efl_added, file)); +efl_ui_view_model_set(sd->button, model); } efl_event_callback_legacy_call --
[EGIT] [core/efl] master 04/06: elementary: add a queue to postpone object destruction when necessary.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=856a453dd8a7979d58e306fbbd3a407e7267ede6 commit 856a453dd8a7979d58e306fbbd3a407e7267ede6 Author: Cedric BAIL Date: Tue Apr 2 12:30:45 2019 -0700 elementary: add a queue to postpone object destruction when necessary. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8540 --- src/lib/elementary/elm_main.c | 17 + src/lib/elementary/elm_priv.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/src/lib/elementary/elm_main.c b/src/lib/elementary/elm_main.c index 676f1a9e8a..f3438364e3 100644 --- a/src/lib/elementary/elm_main.c +++ b/src/lib/elementary/elm_main.c @@ -43,6 +43,8 @@ Eina_Bool _use_build_config; static Elm_Version _version = { VMAJ, VMIN, VMIC, VREV }; EAPI Elm_Version *elm_version = &_version; +Eina_FreeQ *postponed_fq = NULL; + static void _focus_ev_redirect_cb(void *data, const Efl_Event *ev EINA_UNUSED) { @@ -755,6 +757,12 @@ elm_quicklaunch_mode_get(void) return quicklaunch_on; } +static void +_postpone_cb(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) +{ + eina_freeq_clear(postponed_fq); +} + EAPI int elm_quicklaunch_init(intargc EINA_UNUSED, char **argv) @@ -766,6 +774,8 @@ elm_quicklaunch_init(intargc EINA_UNUSED, _elm_log_dom = eina_log_domain_register("elementary", EINA_COLOR_LIGHTBLUE); EINA_SAFETY_ON_TRUE_GOTO(_elm_log_dom < 0, fail_eina_log); + postponed_fq = eina_freeq_new(EINA_FREEQ_POSTPONED); + EINA_SAFETY_ON_FALSE_GOTO(eet_init(), fail_eet); EINA_SAFETY_ON_FALSE_GOTO(ecore_init(), fail_ecore); EINA_SAFETY_ON_FALSE_GOTO(ecore_event_init(), fail_ecore_event); @@ -812,6 +822,8 @@ elm_quicklaunch_init(intargc EINA_UNUSED, if (!_elm_lib_dir) _elm_lib_dir = eina_stringshare_add("/"); if (!_property_style_ss) _property_style_ss = eina_stringshare_add("style"); + efl_event_callback_add(efl_main_loop_get(), EFL_LOOP_EVENT_IDLE_EXIT, _postpone_cb, NULL); + eina_log_timing(_elm_log_dom, EINA_LOG_STATE_STOP, EINA_LOG_STATE_INIT); if (quicklaunch_on) @@ -946,6 +958,11 @@ elm_quicklaunch_shutdown(void) emap_shutdown(); #endif + efl_event_callback_del(efl_main_loop_get(), EFL_LOOP_EVENT_IDLE_EXIT, _postpone_cb, NULL); + + eina_freeq_free(postponed_fq); + postponed_fq = NULL; + ecore_file_shutdown(); eio_shutdown(); ecore_event_shutdown(); diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h index 478497468d..94316191a5 100644 --- a/src/lib/elementary/elm_priv.h +++ b/src/lib/elementary/elm_priv.h @@ -907,6 +907,8 @@ extern Eina_Stringshare *_property_style_ss; extern Eina_Bool _config_profile_lock; +extern Eina_FreeQ *postponed_fq; + # ifdef HAVE_ELEMENTARY_WL2 extern Ecore_Wl2_Display *_elm_wl_display; # endif --
[EGIT] [core/efl] master 01/01: elementary: ensure that the parent model is still alive when resolving future for fileselector.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=3715faf96566c73f1c985ce4872845963032ee9f commit 3715faf96566c73f1c985ce4872845963032ee9f Author: Cedric BAIL Date: Thu Mar 28 12:42:45 2019 -0700 elementary: ensure that the parent model is still alive when resolving future for fileselector. This future where relying on the parent model being alive to work (efl_parent_get). For that reason we should have been using efl_future_then with the parent Model as a measure to make sure this is always the case. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8500 --- src/lib/elementary/elc_fileselector.c | 38 ++- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/src/lib/elementary/elc_fileselector.c b/src/lib/elementary/elc_fileselector.c index 6f52cf6e87..59ce7b1321 100644 --- a/src/lib/elementary/elc_fileselector.c +++ b/src/lib/elementary/elc_fileselector.c @@ -936,15 +936,12 @@ _properties_changed(void *data, const Efl_Event *ev) } static Eina_Value -_process_children_cb(void *data, const Eina_Value v, const Eina_Future *dead_future EINA_UNUSED) +_process_children_cb(Eo *model EINA_UNUSED, void *data, const Eina_Value v) { Listing_Request *lreq = data; Efl_Model *child = NULL; unsigned int i, len; - if (eina_value_type_get() == EINA_VALUE_TYPE_ERROR) - goto end; - if (!lreq->valid) goto end; EINA_VALUE_ARRAY_FOREACH(, len, i, child) @@ -960,6 +957,16 @@ _process_children_cb(void *data, const Eina_Value v, const Eina_Future *dead_fut return v; } +static Eina_Value +_process_children_error(Eo *model EINA_UNUSED, void *data, Eina_Error error) +{ + Listing_Request *lreq = data; + + _process_last(lreq); + + return eina_value_error_init(error); +} + static void _populate(Evas_Object *obj, Efl_Model *model, @@ -1030,8 +1037,11 @@ _populate(Evas_Object *obj, if (efl_model_children_count_get(model)) { future = efl_model_children_slice_get(model, 0, efl_model_children_count_get(model)); -future = eina_future_then(future, _process_children_cb, lreq, NULL); -efl_future_then(obj, future); +future = efl_future_then(obj, future); +efl_future_then(model, future, +.success = _process_children_cb, +.error = _process_children_error, +.data = lreq); } else { @@ -1562,21 +1572,19 @@ _files_grid_add(Evas_Object *obj) } static Eina_Value -_resource_created_then(void *data, const Eina_Value v, const Eina_Future *dead_future EINA_UNUSED) +_resource_created_then(Eo *model EINA_UNUSED, void *data, const Eina_Value v) { Evas_Object *fs = data; Efl_Model *child = NULL; unsigned int len, i; - if (eina_value_type_get() == EINA_VALUE_TYPE_ERROR) - goto end; - ELM_FILESELECTOR_DATA_GET(fs, sd); EINA_VALUE_ARRAY_FOREACH(, len, i, child) - _process_model(sd, child); + { +_process_model(sd, child); + } - end: return v; } @@ -1593,8 +1601,10 @@ _resource_created(void *data, const Efl_Event *event) return; f = efl_model_children_slice_get(sd->model, evt->index, 1); - f = eina_future_then(f, _resource_created_then, fs, NULL); - efl_future_then(fs, f); + f = efl_future_then(fs, f); + f = efl_future_then(sd->model, f, + .success = _resource_created_then, + .data = fs); } static void --
[EGIT] [core/efl] master 01/01: ecore: move property string definition to shared headers for Efl.Composite_Model.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=3730447f0c60f89b81e05f00dafe7aa5f55a370f commit 3730447f0c60f89b81e05f00dafe7aa5f55a370f Author: Cedric BAIL Date: Wed Apr 3 17:24:22 2019 -0700 ecore: move property string definition to shared headers for Efl.Composite_Model. Reviewed-by: SangHyeon Jade Lee Reviewed-by: Xavi Artigas Differential Revision: https://phab.enlightenment.org/D8568 --- src/lib/ecore/efl_composite_model.c | 13 ++--- src/lib/ecore/efl_composite_model_private.h | 5 + 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/lib/ecore/efl_composite_model.c b/src/lib/ecore/efl_composite_model.c index 668b382dfb..a0457729ac 100644 --- a/src/lib/ecore/efl_composite_model.c +++ b/src/lib/ecore/efl_composite_model.c @@ -8,10 +8,9 @@ #include "ecore_private.h" +#include "efl_composite_model_private.h" #include "efl_composite_model.eo.h" -#define _CHILD_INDEX "child.index" - typedef struct _Efl_Composite_Model_Data Efl_Composite_Model_Data; struct _Efl_Composite_Model_Data @@ -148,7 +147,7 @@ _efl_composite_model_index_get(const Eo *obj, Efl_Composite_Model_Data *pd) if (pd->need_index) return 0x; - fetch = efl_model_property_get(obj, _CHILD_INDEX); + fetch = efl_model_property_get(obj, EFL_COMPOSITE_MODEL_CHILD_INDEX); if (!eina_value_uint_convert(fetch, )) return 0x; eina_value_free(fetch); @@ -179,7 +178,7 @@ _efl_composite_model_efl_ui_view_model_set(Eo *obj EINA_UNUSED, Efl_Composite_Mo properties = efl_model_properties_get(pd->source); EINA_ITERATOR_FOREACH(properties, property) { -if (!strcmp(property, _CHILD_INDEX)) +if (!strcmp(property, EFL_COMPOSITE_MODEL_CHILD_INDEX)) { pd->need_index = EINA_FALSE; break; @@ -198,7 +197,7 @@ static Eina_Future * _efl_composite_model_efl_model_property_set(Eo *obj, Efl_Composite_Model_Data *pd, const char *property, Eina_Value *value) { - if (pd->need_index && !strcmp(property, _CHILD_INDEX)) + if (pd->need_index && !strcmp(property, EFL_COMPOSITE_MODEL_CHILD_INDEX)) { if (pd->set_index || !pd->source) return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_READ_ONLY); @@ -214,7 +213,7 @@ static Eina_Value * _efl_composite_model_efl_model_property_get(const Eo *obj EINA_UNUSED, Efl_Composite_Model_Data *pd, const char *property) { - if (pd->need_index && !strcmp(property, _CHILD_INDEX)) + if (pd->need_index && !strcmp(property, EFL_COMPOSITE_MODEL_CHILD_INDEX)) { if (pd->set_index) return eina_value_uint_new(pd->index); @@ -229,7 +228,7 @@ _efl_composite_model_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Com if (pd->need_index) { static const char *composite_properties[] = { - _CHILD_INDEX + EFL_COMPOSITE_MODEL_CHILD_INDEX }; return eina_multi_iterator_new(efl_model_properties_get(pd->source), diff --git a/src/lib/ecore/efl_composite_model_private.h b/src/lib/ecore/efl_composite_model_private.h index c9e3783b9d..b780326c8b 100644 --- a/src/lib/ecore/efl_composite_model_private.h +++ b/src/lib/ecore/efl_composite_model_private.h @@ -1,3 +1,7 @@ +#ifndef EFL_COMPOSITE_MODEL_PRIVATE_H_ +# define EFL_COMPOSITE_MODEL_PRIVATE_H_ + +#define EFL_COMPOSITE_MODEL_CHILD_INDEX "child.index" #define EFL_COMPOSITE_MODEL_PROPERTIES(name, dyn, sta, ...) \ EFL_COMPOSITE_MODEL_PROPERTIES_SUPER(name, NULL, NULL, (dyn), sta, ##__VA_ARGS__) @@ -36,3 +40,4 @@ _efl_composite_model_properties_mix(Eina_Iterator *super, Eina_Iterator *dyn, Ei }; } +#endif --
[EGIT] [core/efl] efl-1.22 04/57: eio: do not fail in case of early ECANCEL.
zmike pushed a commit to branch efl-1.22. http://git.enlightenment.org/core/efl.git/commit/?id=7ad33fa6121d6a47a3a988bb7b0e62a8a04e8fe1 commit 7ad33fa6121d6a47a3a988bb7b0e62a8a04e8fe1 Author: Cedric BAIL Date: Tue Apr 2 15:24:03 2019 -0700 eio: do not fail in case of early ECANCEL. Actually with directory that contain a lot of file and the right order for them, you would end up getting what you are looking for before you have triggered all the future callback. In that case, all the future callback are cancelled and we will get that notification. The test is not failing in this case as we already got what we wanted. Reviewed-by: Mike Blumenkrantz Differential Revision: https://phab.enlightenment.org/D8541 --- src/tests/eio/efl_io_model_test_monitor_add.c | 9 + 1 file changed, 9 insertions(+) diff --git a/src/tests/eio/efl_io_model_test_monitor_add.c b/src/tests/eio/efl_io_model_test_monitor_add.c index 35e217aa63..041a44a5a9 100644 --- a/src/tests/eio/efl_io_model_test_monitor_add.c +++ b/src/tests/eio/efl_io_model_test_monitor_add.c @@ -109,6 +109,15 @@ _children_get(void *data, Eo *child = NULL; unsigned int i, len; + if (eina_value_type_get() == EINA_VALUE_TYPE_ERROR) + { +Eina_Error err = 0; + +fail_if(!eina_value_error_get(, )); +fail_if(err != ECANCELED); +return v; + } + fail_if(eina_value_type_get() != EINA_VALUE_TYPE_ARRAY); EINA_VALUE_ARRAY_FOREACH(, len, i, child) --
[EGIT] [core/efl] efl-1.22 03/57: elementary: fix error path during shutdown of fileselector.
zmike pushed a commit to branch efl-1.22. http://git.enlightenment.org/core/efl.git/commit/?id=e739f551feab3afba732254677d671e1169b5088 commit e739f551feab3afba732254677d671e1169b5088 Author: Cedric BAIL Date: Thu Mar 28 14:09:54 2019 -0700 elementary: fix error path during shutdown of fileselector. During shutdown, sometimes, we can have an error generated on the object while it is invalidating, but before it is invalidated. This lead to properties on the object to change to an error state and trigger the properties changed logic. At this point, the parent has already been destroyed and we don't really have anything more to do. So let's not do anything. Reviewed-by: Mike Blumenkrantz Differential Revision: https://phab.enlightenment.org/D8502 --- src/lib/elementary/elc_fileselector.c | 4 1 file changed, 4 insertions(+) diff --git a/src/lib/elementary/elc_fileselector.c b/src/lib/elementary/elc_fileselector.c index 5121e6d112..b718924429 100644 --- a/src/lib/elementary/elc_fileselector.c +++ b/src/lib/elementary/elc_fileselector.c @@ -823,6 +823,10 @@ _process_model(Elm_Fileselector_Data *sd, Efl_Model *child) double mtime = 0; Eina_Bool dir = EINA_FALSE; + // In case we are shutting down, there might be an error being gnerated + if (!parent) return ; + + // We should be good now if (!_fetch_string_value(parent, "path", _path) || !_fetch_string_value(child, "path", ) || !_fetch_string_value(child, "filename", ) || --
[EGIT] [core/efl] efl-1.22 02/57: elementary: it seems I forgot to initialize some meaningful boolean.
zmike pushed a commit to branch efl-1.22. http://git.enlightenment.org/core/efl.git/commit/?id=6383fc8d27cbea7c323623bf8e3b413e1c5dd337 commit 6383fc8d27cbea7c323623bf8e3b413e1c5dd337 Author: Cedric BAIL Date: Thu Mar 28 12:44:31 2019 -0700 elementary: it seems I forgot to initialize some meaningful boolean. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8501 --- src/tests/elementary/elm_test_fileselector.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tests/elementary/elm_test_fileselector.c b/src/tests/elementary/elm_test_fileselector.c index 23cea7c133..b26e12fc51 100644 --- a/src/tests/elementary/elm_test_fileselector.c +++ b/src/tests/elementary/elm_test_fileselector.c @@ -133,6 +133,7 @@ EFL_START_TEST(elm_fileselector_selected) evas_object_smart_callback_del(fileselector, "directory,open", _ready_cb); evas_object_smart_callback_add(fileselector, "selected", _ready_cb, ); + selected = EINA_FALSE; ck_assert(elm_fileselector_selected_set(fileselector, exist)); ck_assert(fileselector_test_helper_wait_flag(10, )); ck_assert(selected == EINA_TRUE); --
[EGIT] [core/efl] efl-1.22 56/57: eio: remove unecessary printf from tests.
zmike pushed a commit to branch efl-1.22. http://git.enlightenment.org/core/efl.git/commit/?id=0e4aaead3988cdb72ba346936848c34f3af20820 commit 0e4aaead3988cdb72ba346936848c34f3af20820 Author: Cedric BAIL Date: Wed Apr 17 12:35:06 2019 -0400 eio: remove unecessary printf from tests. Summary: Depends on D8539 Reviewers: zmike, bu5hm4n Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8542 --- src/tests/eio/eio_test_file.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/tests/eio/eio_test_file.c b/src/tests/eio/eio_test_file.c index 5028215306..d7b84eaefb 100644 --- a/src/tests/eio/eio_test_file.c +++ b/src/tests/eio/eio_test_file.c @@ -41,11 +41,10 @@ _delete_filter_cb(void *data EINA_UNUSED, Eio_File *handler EINA_UNUSED, } static void -_main_cb(void *data, Eio_File *handler EINA_UNUSED, const char *file) +_main_cb(void *data, Eio_File *handler EINA_UNUSED, const char *file EINA_UNUSED) { int *number_of_listed_files = (int *)data; - fprintf(stderr, "Processing file:%s\n", file); (*number_of_listed_files)++; } @@ -63,11 +62,10 @@ _direct_filter_cb(void *data EINA_UNUSED, Eio_File *handler EINA_UNUSED, } static void -_direct_main_cb(void *data, Eio_File *handler EINA_UNUSED, const Eina_File_Direct_Info *info) +_direct_main_cb(void *data, Eio_File *handler EINA_UNUSED, const Eina_File_Direct_Info *info EINA_UNUSED) { int *number_of_listed_files = (int *)data; - fprintf(stderr, "Processing file:%s\n", info->path); (*number_of_listed_files)++; } --
[EGIT] [core/efl] master 01/01: eio: remove unecessary printf from tests.
zmike pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=f75675cb62589274211485c8e525eb0f548b8f7e commit f75675cb62589274211485c8e525eb0f548b8f7e Author: Cedric BAIL Date: Wed Apr 17 12:35:06 2019 -0400 eio: remove unecessary printf from tests. Summary: Depends on D8539 Reviewers: zmike, bu5hm4n Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8542 --- src/tests/eio/eio_test_file.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/tests/eio/eio_test_file.c b/src/tests/eio/eio_test_file.c index 5028215306..d7b84eaefb 100644 --- a/src/tests/eio/eio_test_file.c +++ b/src/tests/eio/eio_test_file.c @@ -41,11 +41,10 @@ _delete_filter_cb(void *data EINA_UNUSED, Eio_File *handler EINA_UNUSED, } static void -_main_cb(void *data, Eio_File *handler EINA_UNUSED, const char *file) +_main_cb(void *data, Eio_File *handler EINA_UNUSED, const char *file EINA_UNUSED) { int *number_of_listed_files = (int *)data; - fprintf(stderr, "Processing file:%s\n", file); (*number_of_listed_files)++; } @@ -63,11 +62,10 @@ _direct_filter_cb(void *data EINA_UNUSED, Eio_File *handler EINA_UNUSED, } static void -_direct_main_cb(void *data, Eio_File *handler EINA_UNUSED, const Eina_File_Direct_Info *info) +_direct_main_cb(void *data, Eio_File *handler EINA_UNUSED, const Eina_File_Direct_Info *info EINA_UNUSED) { int *number_of_listed_files = (int *)data; - fprintf(stderr, "Processing file:%s\n", info->path); (*number_of_listed_files)++; } --
[EGIT] [core/efl] master 01/03: elementary: it seems I forgot to initialize some meaningful boolean.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=589fca7540714330a3b653d1ff157a8579b00ead commit 589fca7540714330a3b653d1ff157a8579b00ead Author: Cedric BAIL Date: Thu Mar 28 12:44:31 2019 -0700 elementary: it seems I forgot to initialize some meaningful boolean. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8501 --- src/tests/elementary/elm_test_fileselector.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tests/elementary/elm_test_fileselector.c b/src/tests/elementary/elm_test_fileselector.c index 23cea7c133..b26e12fc51 100644 --- a/src/tests/elementary/elm_test_fileselector.c +++ b/src/tests/elementary/elm_test_fileselector.c @@ -133,6 +133,7 @@ EFL_START_TEST(elm_fileselector_selected) evas_object_smart_callback_del(fileselector, "directory,open", _ready_cb); evas_object_smart_callback_add(fileselector, "selected", _ready_cb, ); + selected = EINA_FALSE; ck_assert(elm_fileselector_selected_set(fileselector, exist)); ck_assert(fileselector_test_helper_wait_flag(10, )); ck_assert(selected == EINA_TRUE); --
[EGIT] [core/efl] master 02/03: elementary: fix error path during shutdown of fileselector.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=9afd12324b4e31c9a034912438985ab20fb2e31c commit 9afd12324b4e31c9a034912438985ab20fb2e31c Author: Cedric BAIL Date: Thu Mar 28 14:09:54 2019 -0700 elementary: fix error path during shutdown of fileselector. During shutdown, sometimes, we can have an error generated on the object while it is invalidating, but before it is invalidated. This lead to properties on the object to change to an error state and trigger the properties changed logic. At this point, the parent has already been destroyed and we don't really have anything more to do. So let's not do anything. Reviewed-by: Mike Blumenkrantz Differential Revision: https://phab.enlightenment.org/D8502 --- src/lib/elementary/elc_fileselector.c | 4 1 file changed, 4 insertions(+) diff --git a/src/lib/elementary/elc_fileselector.c b/src/lib/elementary/elc_fileselector.c index 5121e6d112..b718924429 100644 --- a/src/lib/elementary/elc_fileselector.c +++ b/src/lib/elementary/elc_fileselector.c @@ -823,6 +823,10 @@ _process_model(Elm_Fileselector_Data *sd, Efl_Model *child) double mtime = 0; Eina_Bool dir = EINA_FALSE; + // In case we are shutting down, there might be an error being gnerated + if (!parent) return ; + + // We should be good now if (!_fetch_string_value(parent, "path", _path) || !_fetch_string_value(child, "path", ) || !_fetch_string_value(child, "filename", ) || --
[EGIT] [core/efl] master 03/03: eio: do not fail in case of early ECANCEL.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=40867cd0b866af0ec33536bce54aa9d248cdcf1c commit 40867cd0b866af0ec33536bce54aa9d248cdcf1c Author: Cedric BAIL Date: Tue Apr 2 15:24:03 2019 -0700 eio: do not fail in case of early ECANCEL. Actually with directory that contain a lot of file and the right order for them, you would end up getting what you are looking for before you have triggered all the future callback. In that case, all the future callback are cancelled and we will get that notification. The test is not failing in this case as we already got what we wanted. Reviewed-by: Mike Blumenkrantz Differential Revision: https://phab.enlightenment.org/D8541 --- src/tests/eio/efl_io_model_test_monitor_add.c | 9 + 1 file changed, 9 insertions(+) diff --git a/src/tests/eio/efl_io_model_test_monitor_add.c b/src/tests/eio/efl_io_model_test_monitor_add.c index 35e217aa63..041a44a5a9 100644 --- a/src/tests/eio/efl_io_model_test_monitor_add.c +++ b/src/tests/eio/efl_io_model_test_monitor_add.c @@ -109,6 +109,15 @@ _children_get(void *data, Eo *child = NULL; unsigned int i, len; + if (eina_value_type_get() == EINA_VALUE_TYPE_ERROR) + { +Eina_Error err = 0; + +fail_if(!eina_value_error_get(, )); +fail_if(err != ECANCELED); +return v; + } + fail_if(eina_value_type_get() != EINA_VALUE_TYPE_ARRAY); EINA_VALUE_ARRAY_FOREACH(, len, i, child) --
[EGIT] [core/efl] master 02/02: elementary: remove some asynchronous behavior from the fileselector.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=37663b27df81f7251c242f4f359e97e8f04bc115 commit 37663b27df81f7251c242f4f359e97e8f04bc115 Author: Cedric BAIL Date: Wed Mar 27 15:19:32 2019 -0700 elementary: remove some asynchronous behavior from the fileselector. Marcel notted that when using the LIST view of the fileselector on a big directory, we end up having to wait for the entire genlist to be populated to be able to switch to another directory. This is actually a side effect of the populate code being triggered through an idler. This idler was useful when the list was populated directly, but now that we rely on Efl.Io.Model, we should be asynchronous enough that it shouldn't be a problem to actually not be asynchronous here. By removing the reliance on the idler, we are not queued after all the idler and can properly short circuit all of that. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8491 --- src/lib/elementary/elc_fileselector.c| 77 ++-- src/lib/elementary/elm_widget_fileselector.h | 1 - 2 files changed, 17 insertions(+), 61 deletions(-) diff --git a/src/lib/elementary/elc_fileselector.c b/src/lib/elementary/elc_fileselector.c index 5dc85aaa42..5121e6d112 100644 --- a/src/lib/elementary/elc_fileselector.c +++ b/src/lib/elementary/elc_fileselector.c @@ -206,7 +206,6 @@ _elm_fileselector_smart_del_do(Elm_Fileselector *fs, Elm_Fileselector_Data *sd) } _elm_fileselector_replace_model(fs, sd, NULL, NULL); efl_replace(>prev_model, NULL); - free(ecore_idler_del(sd->populate_idler)); ecore_idler_del(sd->path_entry_idler); efl_canvas_group_del(efl_super(sd->obj, MY_CLASS)); @@ -1069,48 +1068,6 @@ _on_list_contract_req(void *data EINA_UNUSED, const Efl_Event *event) elm_genlist_item_expanded_set(it, EINA_FALSE); } -static Eina_Bool -_populate_do(void *data) -{ - struct sel_data *sdata = data; - ELM_FILESELECTOR_DATA_GET(sdata->fs, sd); - - _populate(sdata->fs, sdata->model, NULL, sdata->selected); - efl_replace(>model, NULL); - efl_replace(>selected, NULL); - - sd->populate_idler = NULL; - - free(sdata); - return ECORE_CALLBACK_CANCEL; -} - -static void -_schedule_populate(Evas_Object *fs, - Elm_Fileselector_Data *sd, - Efl_Model *model, - Efl_Model *selected) -{ - struct sel_data *sdata; - - sdata = calloc(1, sizeof(*sdata)); - if (!sdata) return; - - sdata->fs = fs; - efl_replace(>model, model); - efl_replace(>selected, selected); - - if (sd->populate_idler) - { -struct sel_data *old_sdata; -old_sdata = ecore_idler_del(sd->populate_idler); -efl_replace(_sdata->model, NULL); -efl_replace(_sdata->selected, NULL); -free(old_sdata); - } - sd->populate_idler = ecore_idler_add(_populate_do, sdata); -} - static void _on_item_activated(void *data, const Efl_Event *event) { @@ -1132,7 +1089,7 @@ _on_item_activated(void *data, const Efl_Event *event) if (!sd->double_tap_navigation) return; efl_parent_set(it_data->model, data); - _schedule_populate(data, sd, it_data->model, NULL); + _populate(data, it_data->model, NULL, NULL); } static void @@ -1250,7 +1207,7 @@ _on_item_selected(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) if (sd->double_tap_navigation) return; - _schedule_populate(data, sd, it_data->model, NULL); + _populate(data, it_data->model, NULL, NULL); } static void @@ -2017,7 +1974,7 @@ _elm_fileselector_elm_interface_fileselector_folder_only_set(Eo *obj, Elm_Filese sd->only_folder = !!only; if (sd->model) { -_schedule_populate(obj, sd, sd->model, NULL); +_populate(obj, sd->model, NULL, NULL); } } @@ -2095,7 +2052,7 @@ _elm_fileselector_elm_interface_fileselector_expandable_set(Eo *obj, Elm_Filesel if (sd->model) { -_schedule_populate(obj, sd, sd->model, NULL); +_populate(obj, sd->model, NULL, NULL); } } @@ -2143,9 +2100,9 @@ _elm_fileselector_path_set_internal(Evas_Object *obj, const char *_path) } EOLIAN static void -_elm_fileselector_efl_ui_view_model_set(Eo *obj, Elm_Fileselector_Data *sd, Efl_Model *model) +_elm_fileselector_efl_ui_view_model_set(Eo *obj, Elm_Fileselector_Data *sd EINA_UNUSED, Efl_Model *model) { - _schedule_populate(obj, sd, model, NULL); + _populate(obj, model, NULL, NULL); } EAPI const char * @@ -2218,7 +2175,7 @@ _elm_fileselector_elm_interface_fileselector_mode_set(Eo *obj, Elm_Fileselector_ efl_ui_widget_theme_apply(obj); if (sd->model) { -_schedule_populate(obj, sd, sd->model, NULL); +_populate(obj, sd-&g
[EGIT] [core/efl] master 01/02: elementary: restore quick exit from wait loop in fileselector test.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=07e017c510fe796a9f73756dda54bfffd78174f2 commit 07e017c510fe796a9f73756dda54bfffd78174f2 Author: Cedric BAIL Date: Wed Mar 27 14:24:57 2019 -0700 elementary: restore quick exit from wait loop in fileselector test. The test was not expecting both callback to be set when the wait loop was started. By moving them around, it fixes the test case to only have one relevant callback set at a time. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8490 --- src/tests/elementary/elm_test_fileselector.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/tests/elementary/elm_test_fileselector.c b/src/tests/elementary/elm_test_fileselector.c index be8b53d672..a2df980a30 100644 --- a/src/tests/elementary/elm_test_fileselector.c +++ b/src/tests/elementary/elm_test_fileselector.c @@ -86,6 +86,8 @@ _ready_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED { Eina_Bool *ret = data; *ret = EINA_TRUE; + +ecore_main_loop_quit(); } EFL_START_TEST(elm_fileselector_selected) @@ -116,7 +118,6 @@ EFL_START_TEST(elm_fileselector_selected) fileselector = elm_fileselector_add(win); evas_object_smart_callback_add(fileselector, "directory,open", _ready_cb, ); - evas_object_smart_callback_add(fileselector, "selected", _ready_cb, ); ck_assert(!elm_fileselector_selected_set(fileselector, no_exist)); @@ -126,10 +127,13 @@ EFL_START_TEST(elm_fileselector_selected) ck_assert_str_eq(elm_fileselector_selected_get(fileselector), path); - selected = EINA_FALSE; + evas_object_smart_callback_del(fileselector, "directory,open", _ready_cb); + evas_object_smart_callback_add(fileselector, "selected", _ready_cb, ); + ck_assert(elm_fileselector_selected_set(fileselector, exist)); ck_assert(fileselector_test_helper_wait_flag(10, )); ck_assert(selected == EINA_TRUE); + ck_assert_str_eq(elm_fileselector_selected_get(fileselector), exist); eina_stringshare_del(exist); --
[EGIT] [core/efl] master 08/19: eo: refactor auto_unref logic used by efl_part.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=adf4512a3520e942899ddd8c49bafcb39cb2a9b3 commit adf4512a3520e942899ddd8c49bafcb39cb2a9b3 Author: Cedric BAIL Date: Thu Mar 14 14:14:53 2019 -0700 eo: refactor auto_unref logic used by efl_part. This bring no functional change to Eo and efl_part. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8357 --- src/lib/eo/eo.c | 28 +--- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c index f1fbd37fcf..c16c021ef2 100644 --- a/src/lib/eo/eo.c +++ b/src/lib/eo/eo.c @@ -384,6 +384,16 @@ _eo_kls_itr_next(const _Efl_Class *orig_kls, const _Efl_Class *cur_klass, return NULL; } +static inline void +_apply_auto_unref(_Eo_Object *obj, const Eo *eo_obj) +{ + if (EINA_UNLIKELY(obj && obj->auto_unref)) + { +if (obj->finalized && !(--obj->auto_unref)) + efl_unref(eo_obj); + } +} + / EO / static EFL_FUNC_TLS _Efl_Class *_super_klass = NULL; @@ -576,11 +586,7 @@ err_func_src: err: if (is_obj) { -if (EINA_UNLIKELY(obj->auto_unref != 0)) - { - if (obj->finalized && !(--obj->auto_unref)) - efl_unref(eo_id); - } +_apply_auto_unref(obj, eo_id); _efl_unref(obj); _eo_obj_pointer_done((Eo_Id)eo_id); } @@ -644,11 +650,7 @@ _efl_object_call_end(Efl_Object_Op_Call_Data *call) { if (EINA_LIKELY(!!call->obj)) { -if (EINA_UNLIKELY(call->obj->auto_unref != 0)) - { - if (call->obj->finalized && !(--call->obj->auto_unref)) - efl_unref(call->eo_id); - } +_apply_auto_unref(call->obj, call->eo_id); _efl_unref(call->obj); _eo_obj_pointer_done((Eo_Id)call->eo_id); } @@ -715,11 +717,7 @@ _efl_object_op_api_id_get(const void *api_func, const Eo *eo_obj, const char *ap file, api_func_name, line, "Unable to resolve op for api func %p for obj=%p (%s)", api_func, eo_obj, efl_class_name_get(eo_obj)); -if (EINA_UNLIKELY(obj && obj->auto_unref)) - { - if (obj->finalized && !(--obj->auto_unref)) - efl_unref(eo_obj); - } +_apply_auto_unref(obj, eo_obj); return EFL_NOOP; } --
[EGIT] [core/efl] master 13/19: eio: Efl.Io.Model should not make request when the object is invalidating itself.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=ed3165f928f6b618ca567688e7d9fa8a0828bdf7 commit ed3165f928f6b618ca567688e7d9fa8a0828bdf7 Author: Cedric BAIL Date: Fri Mar 15 15:54:26 2019 -0700 eio: Efl.Io.Model should not make request when the object is invalidating itself. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8373 --- src/lib/eio/efl_io_model.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/eio/efl_io_model.c b/src/lib/eio/efl_io_model.c index 44c215e260..f023ea7597 100644 --- a/src/lib/eio/efl_io_model.c +++ b/src/lib/eio/efl_io_model.c @@ -761,7 +761,8 @@ static unsigned int _efl_io_model_efl_model_children_count_get(const Eo *obj, Efl_Io_Model_Data *pd) { // If we have no information on the object, let's build it. - if (efl_invalidated_get(obj)) + if (efl_invalidated_get(obj) || + efl_invalidating_get(obj)) { return 0; } @@ -1006,7 +1007,6 @@ _efl_io_model_efl_object_destructor(Eo *obj , Efl_Io_Model_Data *priv) { Efl_Io_Model_Info *info; - free(priv->st); priv->st = NULL; --
[EGIT] [core/efl] master 15/19: eio: work around the lack of integration between Ecore_Thread and Eina_Future.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=150bc0fa14d7df39254173980de5c86085b1ceff commit 150bc0fa14d7df39254173980de5c86085b1ceff Author: Cedric BAIL Date: Fri Mar 15 14:38:24 2019 -0700 eio: work around the lack of integration between Ecore_Thread and Eina_Future. Ecore_Thread excpect resolution of the error and done case to be instantaneous, while Eina_Future default scheduler linked with Ecore main loop is build around asynchronous answer. This create a lot of potential. A better patch would be to provide an Ecore_Thread helper that does the integration properly. Sadly we are in release now, so this is basically what an helper would do, but contained inside Efl_Io_Manager. This also solve the same problem as D7970 and D8053, but it should avoid its side effect. Reviewed-by: YeongJong Lee Differential Revision: https://phab.enlightenment.org/D8371 --- src/lib/eio/efl_io_manager.c | 120 +++ 1 file changed, 111 insertions(+), 9 deletions(-) diff --git a/src/lib/eio/efl_io_manager.c b/src/lib/eio/efl_io_manager.c index 3509bc6a63..3bb05634be 100644 --- a/src/lib/eio/efl_io_manager.c +++ b/src/lib/eio/efl_io_manager.c @@ -49,6 +49,102 @@ struct _Job_Closure Efl_Io_Manager_Direct_Ls_Func direct_func; // Used when dispatching direct ls funcs. }; +/* Future have to be resolved right away in the thread context */ +typedef struct _Eio_Future_Entry Eio_Future_Entry; +struct _Eio_Future_Entry +{ + Eina_Future_Schedule_Entry base; + Eina_Future_Scheduler_Cb cb; + Eina_Future *future; + Eina_Value value; +}; + +static Eina_Trash *eio_entry_trash = NULL; +static unsigned int eio_entry_trash_count = 0; +static Eina_List *entries = NULL; + +static Eina_Future_Schedule_Entry * +eio_future_schedule(Eina_Future_Scheduler *sched, +Eina_Future_Scheduler_Cb cb, +Eina_Future *future, +Eina_Value value) +{ + Eio_Future_Entry *ef = NULL; + + if (!eio_entry_trash) + { +ef = calloc(1, sizeof (Eio_Future_Entry)); +if (!ef) return NULL; + } + else + { +ef = eina_trash_pop(_entry_trash); +eio_entry_trash_count--; + } + ef->base.scheduler = sched; + ef->cb = cb; + ef->future = future; + ef->value = value; + + entries = eina_list_append(entries, ef); + + return >base; +} + +static void +eio_future_free(Eio_Future_Entry *ef) +{ + entries = eina_list_remove(entries, ef); + + if (eio_entry_trash_count > 8) + { +free(ef); +return ; + } + eina_trash_push(_entry_trash, ef); + eio_entry_trash_count++; +} + +static void +eio_future_recall(Eina_Future_Schedule_Entry *se) +{ + Eio_Future_Entry *ef = (Eio_Future_Entry *) se; + + eina_value_flush(>value); + eio_future_free(ef); +} + +static Eina_Future_Scheduler eio_future_scheduler = { + .schedule = eio_future_schedule, + .recall = eio_future_recall, +}; + +static void +eio_dummy_cancel(void *data EINA_UNUSED, const Eina_Promise *p EINA_UNUSED) +{ +} + +static void +eio_process_entry(void) +{ + Eio_Future_Entry *ef; + + while (entries) + { +ef = eina_list_data_get(entries); +ef->cb(ef->future, ef->value); +eio_future_free(ef); + } +} + +static Eina_Promise * +eio_promise_new(const Eo *obj) +{ + if (!efl_alive_get(obj)) return NULL; + + return eina_promise_new(_future_scheduler, eio_dummy_cancel, NULL); +} + /* Helper functions */ static void _future_file_done_cb(void *data, Eio_File *handler) @@ -56,6 +152,7 @@ _future_file_done_cb(void *data, Eio_File *handler) Eina_Promise *p = data; eina_promise_resolve(p, eina_value_uint64_init(handler->length)); + eio_process_entry(); } static void @@ -67,6 +164,7 @@ _future_file_error_cb(void *data, // error == 0 -> promise was cancelled, no need to reject it anymore if (error != 0) eina_promise_reject(p, error); + eio_process_entry(); } /* Basic listing callbacks */ @@ -119,7 +217,7 @@ _efl_io_manager_direct_ls(const Eo *obj, Eina_Future *future; Eio_File *h; - p = efl_loop_promise_new(obj); + p = eio_promise_new(obj); if (!p) return NULL; future = eina_future_new(p); @@ -161,7 +259,7 @@ _efl_io_manager_stat_ls(const Eo *obj, Eina_Future *future; Eio_File *h; - p = efl_loop_promise_new(obj); + p = eio_promise_new(obj); if (!p) return NULL; future = eina_future_new(p); @@ -202,7 +300,7 @@ _efl_io_manager_ls(const Eo *obj, Eina_Future *future; Eio_File *h; - p = efl_loop_promise_new(obj); + p = eio_promise_new(obj); if (!p) return NULL; future = eina_future_new(p); @@ -236,12 +334,14 @@ _file_stat_done_cb(void *data, Eio_File *handle EINA_UNUSED, const Eina_Stat *st goto on_error; eina_promise_resolve(p, r); +
[EGIT] [core/efl] master 04/19: elementary: split the smart callback event name from the Eo name when needed.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=791ca77a68debe5ec80f3155d5641b9cf2523002 commit 791ca77a68debe5ec80f3155d5641b9cf2523002 Author: Cedric BAIL Date: Wed Mar 13 10:39:49 2019 -0700 elementary: split the smart callback event name from the Eo name when needed. This fix the borkage of the "selected" smart event not being triggered. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8332 --- src/lib/elementary/elc_fileselector.c | 38 +++-- src/lib/elementary/elc_fileselector_button.c| 6 ++-- src/lib/elementary/elc_fileselector_entry.c | 2 +- src/lib/elementary/elm_interface_fileselector.h | 4 +-- 4 files changed, 23 insertions(+), 27 deletions(-) diff --git a/src/lib/elementary/elc_fileselector.c b/src/lib/elementary/elc_fileselector.c index 413719a12b..d0247e3d66 100644 --- a/src/lib/elementary/elc_fileselector.c +++ b/src/lib/elementary/elc_fileselector.c @@ -124,16 +124,16 @@ _focus_chain_update(Eo *obj, Elm_Fileselector_Data *pd) } void -_event_to_legacy_call(Eo *obj, const Efl_Event_Description *evt_desc, void *event_info) +_event_to_legacy_call(Eo *obj, const char *legacy_evt, void *event_info) { - const Efl_Event_Description *legacy_desc = efl_object_legacy_only_event_description_get(evt_desc->name); + const Efl_Event_Description *legacy_desc = efl_object_legacy_only_event_description_get(legacy_evt); efl_event_callback_call(obj, legacy_desc, event_info); } void -_model_event_call(Eo *obj, const Efl_Event_Description *evt_desc, Efl_Model *model, const char *path) +_model_event_call(Eo *obj, const Efl_Event_Description *evt_desc, const char *legacy_evt, Efl_Model *model, const char *path) { - _event_to_legacy_call(obj, evt_desc, (void *)path); + _event_to_legacy_call(obj, legacy_evt, (void *)path); efl_event_callback_call(obj, evt_desc, model); } @@ -665,8 +665,7 @@ _signal_first(Listing_Request *lreq) sd->multi_selection = eina_list_free(sd->multi_selection); } - _model_event_call - (lreq->obj, ELM_FILESELECTOR_EVENT_DIRECTORY_OPEN, lreq->model, lreq->path); + _model_event_call(lreq->obj, ELM_FILESELECTOR_EVENT_DIRECTORY_OPEN, ELM_FILESELECTOR_EVENT_DIRECTORY_OPEN->name, lreq->model, lreq->path); if (!lreq->parent_it) { @@ -1129,8 +1128,7 @@ _on_item_activated(void *data, const Efl_Event *event) if (!it_data->is_dir) { -_model_event_call - (data, ELM_FILESELECTOR_EVENT_ACTIVATED, it_data->model, it_data->path); +_model_event_call(data, ELM_FILESELECTOR_EVENT_ACTIVATED, ELM_FILESELECTOR_EVENT_ACTIVATED->name, it_data->model, it_data->path); return; } @@ -1214,8 +1212,7 @@ _on_item_selected(void *data, const Efl_Event *event) else elm_object_text_set(sd->name_entry, it_data->filename); -_model_event_call - (data, EFL_UI_EVENT_ITEM_SELECTED, it_data->model, it_data->path); +_model_event_call(data, EFL_UI_EVENT_ITEM_SELECTED, "selected", it_data->model, it_data->path); } else if (sd->multi && it_data->is_dir && sd->double_tap_navigation) { @@ -1368,7 +1365,7 @@ _ok(void *data, const Efl_Event *event) if (!sd->model || !sd->path) { -_model_event_call(fs, ELM_FILESELECTOR_EVENT_DONE, NULL, NULL); +_model_event_call(fs, ELM_FILESELECTOR_EVENT_DONE, ELM_FILESELECTOR_EVENT_DONE->name, NULL, NULL); return; } @@ -1386,8 +1383,7 @@ _ok(void *data, const Efl_Event *event) efl_event_callback_array_add(efl_added, noref_death(), NULL)); _model_str_property_set(selected_model, "path", selection); -_model_event_call - (fs, ELM_FILESELECTOR_EVENT_DONE, selected_model, selection); +_model_event_call(fs, ELM_FILESELECTOR_EVENT_DONE, ELM_FILESELECTOR_EVENT_DONE->name, selected_model, selection); efl_unref(selected_model); eina_stringshare_del(selection); @@ -1397,13 +1393,11 @@ _ok(void *data, const Efl_Event *event) Elm_Fileselector_Item_Data *it_data = _selected_item_data_get(sd); if (it_data) { - _model_event_call - (fs, ELM_FILESELECTOR_EVENT_DONE, it_data->model, it_data->path); + _model_event_call(fs, ELM_FILESELECTOR_EVENT_DONE, ELM_FILESELECTOR_EVENT_DONE->name, it_data->model, it_data->path); } else { - _model_event_call - (fs, ELM_FILESELECTOR_EVENT_DONE, sd->model, sd->path); + _model_event_call(fs, ELM_FILESELECTOR_EVENT_DONE, ELM_FILESELECTOR_EVENT_DONE->name, sd->model, sd->path); } } } @@
[EGIT] [core/efl] master 09/19: elementary: improve lifecycle of model object in the fileselector widget.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=9cadba3387a48d727c4d6dc4d59097b33cfd3a82 commit 9cadba3387a48d727c4d6dc4d59097b33cfd3a82 Author: Cedric BAIL Date: Wed Mar 13 14:54:39 2019 -0700 elementary: improve lifecycle of model object in the fileselector widget. This is a minimal change and it would be best to refactor the code completely using all the infrastructure we have now instead of the organically grown code, but I am afraid of doing such a big change at this point of our release cycle. Part of the improvement are use of efl_replace to make sure Eo object reference are set to NULL once reference are dropped. Handling the case when a processed child is actually pointing to an error. Also it is not supported by model to get their parent stolen, so this has been fixed too. Finally setting the path asynchronously was creating more trouble than needed, when it could be done in a synchronous way. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8336 --- src/lib/elementary/elc_fileselector.c | 43 +++ 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/src/lib/elementary/elc_fileselector.c b/src/lib/elementary/elc_fileselector.c index d0247e3d66..7be8f0dc09 100644 --- a/src/lib/elementary/elc_fileselector.c +++ b/src/lib/elementary/elc_fileselector.c @@ -201,8 +201,7 @@ static void _elm_fileselector_smart_del_do(Elm_Fileselector *fs, Elm_Fileselector_Data *sd) { _elm_fileselector_replace_model(fs, sd, NULL, NULL); - if (sd->prev_model) - efl_unref(sd->prev_model); + efl_replace(>prev_model, NULL); free(ecore_idler_del(sd->populate_idler)); ecore_idler_del(sd->path_entry_idler); @@ -842,8 +841,19 @@ _process_model(Elm_Fileselector_Data *sd, Efl_Model *child) !_fetch_int64_value(child, "size", ) || !_fetch_bool_value(child, "is_dir", )) { +Eina_Value *check_error = efl_model_property_get(child, "mtime"); +Eina_Error err = EAGAIN; + +if (eina_value_type_get(check_error) == EINA_VALUE_TYPE_ERROR) + { + // If the error is different from EAGAIN, we should definitively drop this one. + eina_value_error_get(check_error, ); + } // SETUP listener to retry fetching all data when ready -efl_event_callback_array_add(efl_ref(child), child_model_callbacks(), sd); +if (err == EAGAIN) + { + efl_event_callback_array_add(efl_ref(child), child_model_callbacks(), sd); + } goto cleanup; } @@ -1134,7 +1144,6 @@ _on_item_activated(void *data, const Efl_Event *event) if (!sd->double_tap_navigation) return; - efl_parent_set(it_data->model, data); _schedule_populate(data, sd, it_data->model, NULL); } @@ -1253,8 +1262,6 @@ _on_item_selected(void *data, const Efl_Event *event) if (sd->double_tap_navigation) return; - // Take ownership of the model, to keep it alive - efl_parent_set(it_data->model, data); _schedule_populate(data, sd, it_data->model, NULL); } @@ -1380,8 +1387,8 @@ _ok(void *data, const Efl_Event *event) selection = eina_stringshare_printf("%s/%s", sd->path, name); selected_model = efl_add_ref(efl_class_get(sd->model), event->object, - efl_event_callback_array_add(efl_added, noref_death(), NULL)); -_model_str_property_set(selected_model, "path", selection); + efl_event_callback_array_add(efl_added, noref_death(), NULL), + efl_io_model_path_set(efl_added, selection)); _model_event_call(fs, ELM_FILESELECTOR_EVENT_DONE, ELM_FILESELECTOR_EVENT_DONE->name, selected_model, selection); @@ -1535,14 +1542,12 @@ _anchor_clicked(void *data, const Efl_Event *event) ELM_FILESELECTOR_DATA_GET(fs, sd); - if (!sd->model) - return; + if (!sd->model) return; model = efl_add_ref(efl_class_get(sd->model), event->object, - efl_event_callback_array_add(efl_added, noref_death(), NULL)); - if (!model) - return; - _model_str_property_set(model, "path", info->name); + efl_event_callback_array_add(efl_added, noref_death(), NULL), + efl_io_model_path_set(efl_added, info->name)); + if (!model) return; _populate(fs, model, NULL, NULL); efl_unref(model); @@ -1971,8 +1976,8 @@ _from_legacy_event_call(Elm_Fileselector *fs, Elm_Fileselector_Data *sd, const E model_cls = efl_class_get(sd->model); Efl_Model *model = efl_add_ref(model_cls, fs, - efl_event_callback_array_add(efl_added, noref_deat
[EGIT] [core/efl] master 07/19: eo: enforce auto_unref logic at the end of efl_unref execution.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=f11dfc0bc8b454f86edef29256bb3f3e4c322b2b commit f11dfc0bc8b454f86edef29256bb3f3e4c322b2b Author: Cedric BAIL Date: Thu Mar 14 14:15:28 2019 -0700 eo: enforce auto_unref logic at the end of efl_unref execution. This allow for the safe use of efl_ref/efl_unref around an efl_part without calling any function on that part. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8358 --- src/lib/eo/eo.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c index a95c27a42d..f1fbd37fcf 100644 --- a/src/lib/eo/eo.c +++ b/src/lib/eo/eo.c @@ -1993,6 +1993,9 @@ efl_unref(const Eo *obj_id) } _efl_unref(obj); } + + _apply_auto_unref(obj, obj_id); + _efl_unref(obj); EO_OBJ_DONE(obj_id); } --
[EGIT] [core/efl] master 11/19: elementary: destroy fileselector children when they are not itemized yet.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=3bbaf71b68060078bc229c9c2949202e849e986e commit 3bbaf71b68060078bc229c9c2949202e849e986e Author: Cedric BAIL Date: Fri Mar 15 16:56:33 2019 -0700 elementary: destroy fileselector children when they are not itemized yet. As we now do everything asynchronously, we do have model representing child of the main model that don't provide enough information to be displayed yet. This are not tracked by a genlist item, nor are they a child of the fileselector. To properly handle their lifecycle, it is necessary to unref them manually explicitely. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8375 --- src/lib/elementary/elc_fileselector.c| 26 +++--- src/lib/elementary/elm_widget_fileselector.h | 1 + 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/lib/elementary/elc_fileselector.c b/src/lib/elementary/elc_fileselector.c index 7be8f0dc09..f1fb69620d 100644 --- a/src/lib/elementary/elc_fileselector.c +++ b/src/lib/elementary/elc_fileselector.c @@ -99,6 +99,7 @@ EFL_CALLBACKS_ARRAY_DEFINE(monitoring_callbacks, { EFL_MODEL_EVENT_CHILD_ADDED, _resource_created }, { EFL_MODEL_EVENT_CHILD_REMOVED, _resource_deleted }); +static void _properties_changed(void *data, const Efl_Event *ev); static void _focus_chain_update(Eo *obj, Elm_Fileselector_Data *pd) @@ -200,6 +201,12 @@ _elm_fileselector_replace_model(Elm_Fileselector *fs, Elm_Fileselector_Data *sd, static void _elm_fileselector_smart_del_do(Elm_Fileselector *fs, Elm_Fileselector_Data *sd) { + Eo *child; + EINA_LIST_FREE(sd->children, child) + { +efl_event_callback_del(child, EFL_MODEL_EVENT_PROPERTIES_CHANGED, _properties_changed, sd); +efl_unref(child); + } _elm_fileselector_replace_model(fs, sd, NULL, NULL); efl_replace(>prev_model, NULL); free(ecore_idler_del(sd->populate_idler)); @@ -809,13 +816,6 @@ _fetch_int64_value(Efl_Model *child, const char *name, int64_t *i) return r; } -static void _invalidate(void *data, const Efl_Event *ev); -static void _properties_changed(void *data, const Efl_Event *ev); - -EFL_CALLBACKS_ARRAY_DEFINE(child_model_callbacks, - { EFL_MODEL_EVENT_PROPERTIES_CHANGED, _properties_changed }, - { EFL_EVENT_INVALIDATE, _invalidate }); - static void _process_model(Elm_Fileselector_Data *sd, Efl_Model *child) { @@ -852,7 +852,8 @@ _process_model(Elm_Fileselector_Data *sd, Efl_Model *child) // SETUP listener to retry fetching all data when ready if (err == EAGAIN) { - efl_event_callback_array_add(efl_ref(child), child_model_callbacks(), sd); + efl_event_callback_add(efl_ref(child), EFL_MODEL_EVENT_PROPERTIES_CHANGED, _properties_changed, sd); + sd->children = eina_list_append(sd->children, child); } goto cleanup; } @@ -928,19 +929,14 @@ _process_model(Elm_Fileselector_Data *sd, Efl_Model *child) free(parent_path); } -static void -_invalidate(void *data EINA_UNUSED, const Efl_Event *ev) -{ - efl_unref(ev->object); -} - static void _properties_changed(void *data, const Efl_Event *ev) { Elm_Fileselector_Data *sd = data; Efl_Model *child = ev->object; - efl_event_callback_array_del(child, child_model_callbacks(), sd); + sd->children = eina_list_remove(sd->children, child); + efl_event_callback_del(child, EFL_MODEL_EVENT_PROPERTIES_CHANGED, _properties_changed, sd); _process_model(sd, child); efl_unref(child); } diff --git a/src/lib/elementary/elm_widget_fileselector.h b/src/lib/elementary/elm_widget_fileselector.h index 1ebf33c0ca..d8c37f3dd8 100644 --- a/src/lib/elementary/elm_widget_fileselector.h +++ b/src/lib/elementary/elm_widget_fileselector.h @@ -54,6 +54,7 @@ struct _Elm_Fileselector_Data const char *path; Efl_Model *model; Efl_Model *prev_model; + Eina_List *children; Ecore_Idler *populate_idler; Ecore_Idler *path_entry_idler; --
[EGIT] [core/efl] master 01/19: eio: path and filename property should always remind accessible even in case of error.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=a947d8e5b1801fe5831a20c159ee3140d0ba9f25 commit a947d8e5b1801fe5831a20c159ee3140d0ba9f25 Author: Cedric BAIL Date: Wed Mar 13 14:51:20 2019 -0700 eio: path and filename property should always remind accessible even in case of error. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8335 --- src/lib/eio/efl_io_model.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/eio/efl_io_model.c b/src/lib/eio/efl_io_model.c index 1e80b98c0d..44bd69d8e4 100644 --- a/src/lib/eio/efl_io_model.c +++ b/src/lib/eio/efl_io_model.c @@ -605,6 +605,7 @@ _property_mime_type_cb(const Eo *obj, Efl_Io_Model_Data *pd) { if (pd->mime_type) return eina_value_string_new(pd->mime_type); + if (pd->error) return eina_value_error_new(pd->error); _eio_build_mime(obj, pd); return eina_value_error_new(EAGAIN); @@ -640,7 +641,6 @@ _efl_io_model_efl_model_property_get(const Eo *obj, Efl_Io_Model_Data *pd, const unsigned int i; if (!property) return NULL; - if (pd->error) return eina_value_error_new(pd->error); for (i = 0; i < EINA_C_ARRAY_LENGTH(properties); ++i) if (property == properties[i].name || --
[EGIT] [core/efl] master 12/19: eio: remove unecessary use of weak reference.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=4d1620f3f0ac8590f4e3c297e0e31b98313eb8ec commit 4d1620f3f0ac8590f4e3c297e0e31b98313eb8ec Author: Cedric BAIL Date: Fri Mar 15 16:55:07 2019 -0700 eio: remove unecessary use of weak reference. There is no point in keeping a pointer to the main loop now that we are using efl_future_then. This resolve potential bug with leftover dangling weak reference as efl_future_then do require a free case otherwise. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8374 --- src/lib/eio/efl_io_model.c | 22 +- src/lib/eio/efl_io_model_private.h | 1 - 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/src/lib/eio/efl_io_model.c b/src/lib/eio/efl_io_model.c index e2b3697e08..44c215e260 100644 --- a/src/lib/eio/efl_io_model.c +++ b/src/lib/eio/efl_io_model.c @@ -434,22 +434,11 @@ _build_delay(Efl_Io_Model *model) .data = eina_list_last(delayed_queue)); } -static void -_eio_build_mime_clean(Efl_Io_Model_Data *pd) -{ - efl_wref_del(pd->loop, >loop); - pd->loop = NULL; - pd->request.mime = NULL; -} - static Eina_Value _eio_build_mime_now(Eo *model, void *data, const Eina_Value v) { Efl_Io_Model_Data *pd = data; - if (v.type == EINA_VALUE_TYPE_ERROR) goto on_error; - if (!pd->loop) goto on_error; - // Make sure that we are not over consuming time in the main loop if (!delayed_one && (delayed_queue || ecore_time_get() - ecore_loop_time_get() > 0.004)) @@ -462,16 +451,9 @@ _eio_build_mime_now(Eo *model, void *data, const Eina_Value v) pd->mime_type = efreet_mime_type_get(pd->path); - _eio_build_mime_clean(pd); - efl_model_properties_changed(model, "mime_type"); delayed_one = EINA_TRUE; - return v; - - on_error: - _eio_build_mime_clean(pd); - return v; } @@ -481,9 +463,7 @@ _eio_build_mime(const Efl_Object *model, Efl_Io_Model_Data *pd) if (pd->mime_type) return ; if (pd->request.mime) return ; - efl_wref_add(efl_loop_get(model), >loop); - - pd->request.mime = efl_future_then(model, efl_loop_job(pd->loop), + pd->request.mime = efl_future_then(model, efl_loop_job(efl_loop_get(model)), .success = _eio_build_mime_now, .data = pd); } diff --git a/src/lib/eio/efl_io_model_private.h b/src/lib/eio/efl_io_model_private.h index 8102406653..2574ade284 100644 --- a/src/lib/eio/efl_io_model_private.h +++ b/src/lib/eio/efl_io_model_private.h @@ -35,7 +35,6 @@ struct _Efl_Io_Model_Info struct _Efl_Io_Model_Data { - Efl_Loop *loop; Efl_Io_Model *self; Eina_Stringshare *path; --
[EGIT] [core/efl] master 10/19: eio: guarantee that we will at least process one request per loop iteration for very slow system.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=f4426d29604a3bf43cbb241001d6f30204effe3a commit f4426d29604a3bf43cbb241001d6f30204effe3a Author: Cedric BAIL Date: Thu Mar 21 13:33:30 2019 -0700 eio: guarantee that we will at least process one request per loop iteration for very slow system. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8447 --- src/lib/eio/efl_io_model.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/lib/eio/efl_io_model.c b/src/lib/eio/efl_io_model.c index e43c9c0e34..e2b3697e08 100644 --- a/src/lib/eio/efl_io_model.c +++ b/src/lib/eio/efl_io_model.c @@ -388,16 +388,20 @@ _eio_build_st_then_clobber(const Efl_Io_Model *model, Efl_Io_Model_Data *pd) } static Eina_List *delayed_queue = NULL; +static Eina_Bool delayed_one = EINA_FALSE; static void _delayed_flush(void *data EINA_UNUSED, const Efl_Event *ev) { Eina_Promise *p; - - EINA_LIST_FREE(delayed_queue, p) - eina_promise_resolve(p, EINA_VALUE_EMPTY); + Eina_List *tmp = delayed_queue; efl_event_callback_del(ev->object, EFL_LOOP_EVENT_IDLE, _delayed_flush, NULL); + + delayed_one = EINA_FALSE; + delayed_queue = NULL; + EINA_LIST_FREE(tmp, p) + eina_promise_resolve(p, EINA_VALUE_EMPTY); } static Eina_Value @@ -447,7 +451,8 @@ _eio_build_mime_now(Eo *model, void *data, const Eina_Value v) if (!pd->loop) goto on_error; // Make sure that we are not over consuming time in the main loop - if (delayed_queue || ecore_time_get() - ecore_loop_time_get() > 0.004) + if (!delayed_one && + (delayed_queue || ecore_time_get() - ecore_loop_time_get() > 0.004)) { Eina_Future *f = efl_future_then(model, _build_delay(model), .success = _eio_build_mime_now, @@ -460,6 +465,7 @@ _eio_build_mime_now(Eo *model, void *data, const Eina_Value v) _eio_build_mime_clean(pd); efl_model_properties_changed(model, "mime_type"); + delayed_one = EINA_TRUE; return v; --
[EGIT] [core/efl] master 02/19: eio: rely on efl_future_then to properly protect Eo object during the lifecycle of the future callback.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=6b6faef3a359f453b04a3783b7e3633f3db314c6 commit 6b6faef3a359f453b04a3783b7e3633f3db314c6 Author: Cedric BAIL Date: Wed Mar 13 14:50:48 2019 -0700 eio: rely on efl_future_then to properly protect Eo object during the lifecycle of the future callback. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8334 --- src/lib/eio/efl_io_model.c | 18 -- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/lib/eio/efl_io_model.c b/src/lib/eio/efl_io_model.c index 44bd69d8e4..e43c9c0e34 100644 --- a/src/lib/eio/efl_io_model.c +++ b/src/lib/eio/efl_io_model.c @@ -439,10 +439,9 @@ _eio_build_mime_clean(Efl_Io_Model_Data *pd) } static Eina_Value -_eio_build_mime_now(void *data, const Eina_Value v, const Eina_Future *dead_future EINA_UNUSED) +_eio_build_mime_now(Eo *model, void *data, const Eina_Value v) { - Efl_Io_Model *model = data; - Efl_Io_Model_Data *pd = efl_data_scope_get(model, EFL_IO_MODEL_CLASS); + Efl_Io_Model_Data *pd = data; if (v.type == EINA_VALUE_TYPE_ERROR) goto on_error; if (!pd->loop) goto on_error; @@ -450,8 +449,9 @@ _eio_build_mime_now(void *data, const Eina_Value v, const Eina_Future *dead_futu // Make sure that we are not over consuming time in the main loop if (delayed_queue || ecore_time_get() - ecore_loop_time_get() > 0.004) { -Eina_Future *f = eina_future_then(_build_delay(model), - _eio_build_mime_now, model, NULL); +Eina_Future *f = efl_future_then(model, _build_delay(model), + .success = _eio_build_mime_now, + .data = pd); return eina_future_as_value(efl_future_then(model, f)); } @@ -472,16 +472,14 @@ _eio_build_mime_now(void *data, const Eina_Value v, const Eina_Future *dead_futu static void _eio_build_mime(const Efl_Object *model, Efl_Io_Model_Data *pd) { - Eina_Future *f; - if (pd->mime_type) return ; if (pd->request.mime) return ; efl_wref_add(efl_loop_get(model), >loop); - f = efl_loop_job(pd->loop); - f = eina_future_then(f, _eio_build_mime_now, model, NULL); - pd->request.mime = efl_future_then(model, f); + pd->request.mime = efl_future_then(model, efl_loop_job(pd->loop), + .success = _eio_build_mime_now, + .data = pd); } static Eina_Value * --
[EGIT] [core/efl] master 17/19: elementary: prevent asynchronous properties change to believe target is ready when it is not in fileselector.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=1eb49b2e9bcb820dc8cf920979b414abe489b9a2 commit 1eb49b2e9bcb820dc8cf920979b414abe489b9a2 Author: Cedric BAIL Date: Fri Mar 22 10:31:52 2019 -0700 elementary: prevent asynchronous properties change to believe target is ready when it is not in fileselector. In some case, the properties changed event would be triggered first on the object model instead of the target model. This now enforce that the target will be the first model to handle and react on the information. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8449 --- src/lib/elementary/elc_fileselector.c| 5 +++-- src/lib/elementary/elm_widget_fileselector.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/elementary/elc_fileselector.c b/src/lib/elementary/elc_fileselector.c index 9509789988..970bf9cc13 100644 --- a/src/lib/elementary/elc_fileselector.c +++ b/src/lib/elementary/elc_fileselector.c @@ -900,7 +900,7 @@ _process_model(Elm_Fileselector_Data *sd, Efl_Model *child) efl_key_data_set(child, ".item.data", item); // Is this item selected - if (sd->target) + if (sd->target && sd->target_ready) { const char *target_path = efl_io_model_path_get(sd->target); @@ -2409,7 +2409,7 @@ _properties_ready(void *data, const Efl_Event *ev) efl_event_callback_del(ev->object, EFL_MODEL_EVENT_PROPERTIES_CHANGED, _properties_ready, obj); eina_value_bool_get(value, _dir); - + pd->target_ready = EINA_TRUE; if (!is_dir) { Efl_Model *parent; @@ -2453,6 +2453,7 @@ _elm_fileselector_selected_set_internal(Evas_Object *obj, const char *path) if (stat(path, )) return EINA_FALSE; + pd->target_ready = EINA_FALSE; pd->target = efl_add_ref(EFL_IO_MODEL_CLASS, obj, efl_io_model_path_set(efl_added, path), efl_event_callback_array_add(efl_added, noref_death(), NULL)); if (!pd->target) diff --git a/src/lib/elementary/elm_widget_fileselector.h b/src/lib/elementary/elm_widget_fileselector.h index d8c37f3dd8..eb669821b4 100644 --- a/src/lib/elementary/elm_widget_fileselector.h +++ b/src/lib/elementary/elm_widget_fileselector.h @@ -86,6 +86,7 @@ struct _Elm_Fileselector_Data Eina_Booldir_selected : 1; Eina_Boolhidden_visible : 1; + Eina_Booltarget_ready : 1; }; struct sel_data --
[EGIT] [core/efl] master 05/19: elementary: only apply text when the object is not invalidated and dying.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=e05b8ae9caffb03144bb458a3c634c59c5c49e09 commit e05b8ae9caffb03144bb458a3c634c59c5c49e09 Author: Cedric BAIL Date: Thu Mar 14 14:16:50 2019 -0700 elementary: only apply text when the object is not invalidated and dying. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8359 --- src/lib/elementary/efl_ui_layout.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c index 9ba90026a9..f779bb95dc 100644 --- a/src/lib/elementary/efl_ui_layout.c +++ b/src/lib/elementary/efl_ui_layout.c @@ -2764,6 +2764,9 @@ EAPI Eina_Bool elm_layout_text_set(Eo *obj, const char *part, const char *text) { Eo *part_obj; + + if (efl_invalidating_get(obj) || efl_invalidated_get(obj)) return EINA_FALSE; + if (!part) { part = efl_ui_widget_default_text_part_get(obj); --
[EGIT] [core/efl] master 18/19: elementary: make sure that the model parent being used is always the fileselector.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=8ab3f3319eb508e812a901e4b3b73e7345e68b07 commit 8ab3f3319eb508e812a901e4b3b73e7345e68b07 Author: Cedric BAIL Date: Fri Mar 22 11:20:51 2019 -0700 elementary: make sure that the model parent being used is always the fileselector. Model provided by an item selection would have there parent being the current model of the fileselector. Once that one is replaced by the item model, it would automatically invalidate the model and break any further request. This lead to a bug where you could only get into one directory before everything else being empty. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8450 --- src/lib/elementary/elc_fileselector.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/lib/elementary/elc_fileselector.c b/src/lib/elementary/elc_fileselector.c index 970bf9cc13..9ca8b564bc 100644 --- a/src/lib/elementary/elc_fileselector.c +++ b/src/lib/elementary/elc_fileselector.c @@ -1131,6 +1131,7 @@ _on_item_activated(void *data, const Efl_Event *event) if (!sd->double_tap_navigation) return; + efl_parent_set(it_data->model, data); _schedule_populate(data, sd, it_data->model, NULL); } @@ -1350,7 +1351,7 @@ _current_filter_changed(void *data, } static void -_ok(void *data, const Efl_Event *event) +_ok(void *data, const Efl_Event *event EINA_UNUSED) { const char *name; const char *selection = NULL; @@ -1373,7 +1374,7 @@ _ok(void *data, const Efl_Event *event) else selection = eina_stringshare_printf("%s/%s", sd->path, name); -selected_model = efl_add_ref(efl_class_get(sd->model), event->object, +selected_model = efl_add_ref(efl_class_get(sd->model), fs, efl_event_callback_array_add(efl_added, noref_death(), NULL), efl_io_model_path_set(efl_added, selection)); @@ -1428,7 +1429,7 @@ _on_text_activated(void *data, const Efl_Event *event) if (!ecore_file_is_dir(path)) { -model = efl_add_ref(efl_class_get(sd->model), event->object, +model = efl_add_ref(efl_class_get(sd->model), fs, efl_io_model_path_set(efl_added, path), efl_event_callback_array_add(efl_added, noref_death(), NULL)); @@ -1439,7 +1440,7 @@ _on_text_activated(void *data, const Efl_Event *event) dir = EINA_TRUE; } - parent = efl_add_ref(efl_class_get(sd->model), event->object, + parent = efl_add_ref(efl_class_get(sd->model), fs, efl_io_model_path_set(efl_added, path), efl_event_callback_array_add(efl_added, noref_death(), NULL)); if (!parent) goto end; @@ -1493,7 +1494,7 @@ _anchor_clicked(void *data, const Efl_Event *event) if (!sd->model) return; - model = efl_add_ref(efl_class_get(sd->model), event->object, + model = efl_add_ref(efl_class_get(sd->model), fs, efl_event_callback_array_add(efl_added, noref_death(), NULL), efl_io_model_path_set(efl_added, info->name)); if (!model) return; --