[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); + eio_process_entry(); return ;
[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); } } } @@ -1413,7 +1407,7 @@ _canc(void *data, const Efl_Event *event EINA_UNUSED) { Evas_Object *fs = data; - _model_event_call(fs, ELM_FILESELECTOR_EVENT_DONE, NULL,
[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_death(), NULL)); - _model_str_property_set(model, "path", path); +
[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 19/19: elc_filselector: solve the mysterium of sometimes failing tests
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=197210cde2bc1b94490c2a37ca001701b22550d3 commit 197210cde2bc1b94490c2a37ca001701b22550d3 Author: Marcel Hollerbach Date: Wed Mar 27 21:15:53 2019 +0100 elc_filselector: solve the mysterium of sometimes failing tests so after a phone call, two days of debugging, tears, crying etc. etc. we finally came to a point of enlightenment! *Someone* (bu5hm4n) moved gengrid and genlist events from eo back to smart events, so we can work arround legacy borks and event-name collisions, at this point he did not knew that some widgets (fileselector) already relied on those *lovely* events. Hence this broke theoretically the testsuite, however, the fileselector testsuite is ultimatily buggy, and the wait function does not return false when it timeouts, (i don't know why not). So this break was never discovered. Additionally there is a second issue. it appears, that when we immidiatly quit the mainloop after we have got the selected callback, that then genlist decides to forget about the sd->selected pointer, and NULLs that one out. Which then results in the fact that elm_fileselector_selected_get ends up returning invalid paths. Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D8488 --- src/lib/elementary/elc_fileselector.c| 20 src/tests/elementary/elm_test_fileselector.c | 4 +--- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/lib/elementary/elc_fileselector.c b/src/lib/elementary/elc_fileselector.c index 9ca8b564bc..5dc85aaa42 100644 --- a/src/lib/elementary/elc_fileselector.c +++ b/src/lib/elementary/elc_fileselector.c @@ -1164,10 +1164,10 @@ _clear_selections(Elm_Fileselector_Data *sd, Elm_Object_Item *last_selected) } static void -_on_item_selected(void *data, const Efl_Event *event) +_on_item_selected(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) { //This event_info could be a list or gengrid item - Elm_Object_Item *it = event->info; + Elm_Object_Item *it = event_info; Elm_Fileselector_Item_Data *it_data = NULL; ELM_FILESELECTOR_DATA_GET(data, sd); @@ -1254,12 +1254,12 @@ _on_item_selected(void *data, const Efl_Event *event) } static void -_on_item_unselected(void *data, const Efl_Event *event) +_on_item_unselected(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) { Eina_List *li, *l; const Elm_Fileselector_Item_Data *it_data; Eina_Strbuf *buf; - Elm_Object_Item *it = event->info; + Elm_Object_Item *it = event_info; Elm_Object_Item *it2 = NULL; Eina_Bool first = EINA_TRUE; @@ -1555,10 +1555,8 @@ _files_list_add(Evas_Object *obj) evas_object_data_set(li, "parent", obj); efl_ui_mirrored_automatic_set(li, EINA_FALSE); - efl_event_callback_add - (li, EFL_UI_EVENT_ITEM_SELECTED, _on_item_selected, obj); - efl_event_callback_add - (li, EFL_UI_EVENT_ITEM_UNSELECTED, _on_item_unselected, obj); + evas_object_smart_callback_add(li, "selected", _on_item_selected, obj); + evas_object_smart_callback_add(li, "unselected", _on_item_unselected, obj); efl_event_callback_add (li, ELM_GENLIST_EVENT_ACTIVATED, _on_item_activated, obj); efl_event_callback_add @@ -1592,10 +1590,8 @@ _files_grid_add(Evas_Object *obj) elm_gengrid_align_set(grid, 0.0, 0.0); - efl_event_callback_add - (grid, EFL_UI_EVENT_ITEM_SELECTED, _on_item_selected, obj); - efl_event_callback_add - (grid, EFL_UI_EVENT_ITEM_UNSELECTED, _on_item_unselected, obj); + evas_object_smart_callback_add(grid, "selected", _on_item_selected, obj); + evas_object_smart_callback_add(grid, "unselected", _on_item_unselected, obj); efl_event_callback_add (grid, ELM_GENGRID_EVENT_ACTIVATED, _on_item_activated, obj); efl_event_callback_add diff --git a/src/tests/elementary/elm_test_fileselector.c b/src/tests/elementary/elm_test_fileselector.c index c7ffaca627..be8b53d672 100644 --- a/src/tests/elementary/elm_test_fileselector.c +++ b/src/tests/elementary/elm_test_fileselector.c @@ -86,8 +86,6 @@ _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) @@ -131,7 +129,7 @@ EFL_START_TEST(elm_fileselector_selected) selected = EINA_FALSE; 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 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 14/19: eio: add test to ensure proper lifecycle of Efl_Io object and futures.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=e162ba9696cb25ad91b44649da00dd942c2a5236 commit e162ba9696cb25ad91b44649da00dd942c2a5236 Author: Yeongjong Lee Date: Fri Mar 15 14:51:54 2019 -0700 eio: add test to ensure proper lifecycle of Efl_Io object and futures. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8372 --- src/tests/eio/efl_io_model_test_file.c | 17 + 1 file changed, 17 insertions(+) diff --git a/src/tests/eio/efl_io_model_test_file.c b/src/tests/eio/efl_io_model_test_file.c index f714761c66..e057f6bcc7 100644 --- a/src/tests/eio/efl_io_model_test_file.c +++ b/src/tests/eio/efl_io_model_test_file.c @@ -195,8 +195,25 @@ EFL_START_TEST(efl_io_model_test_test_file) } EFL_END_TEST +EFL_START_TEST(efl_io_model_test_del) +{ + Eo *model; + int i; + + DISABLE_ABORT_ON_CRITICAL_START; + for (i = 0; i < 10; i++) + { +model = efl_add(EFL_IO_MODEL_CLASS, efl_main_loop_get(), +efl_io_model_path_set(efl_added, EFL_MODEL_TEST_FILENAME_PATH)); +efl_del(model); + } + DISABLE_ABORT_ON_CRITICAL_END; +} +EFL_END_TEST + void efl_io_model_test_file(TCase *tc) { tcase_add_test(tc, efl_io_model_test_test_file); +tcase_add_test(tc, efl_io_model_test_del); } --
[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; --
[EGIT] [core/efl] master 16/19: elementary: fix fileselector entry support to define path manually.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=db618e179ab0c4bc115665078c983b786063bfcd commit db618e179ab0c4bc115665078c983b786063bfcd Author: Cedric BAIL Date: Thu Mar 21 15:04:46 2019 -0700 elementary: fix fileselector entry support to define path manually. There was no need in the first place to do all this asynchronous work here. It is more robust to do it in sync. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8448 --- src/lib/elementary/elc_fileselector.c | 97 +-- 1 file changed, 25 insertions(+), 72 deletions(-) diff --git a/src/lib/elementary/elc_fileselector.c b/src/lib/elementary/elc_fileselector.c index f1fb69620d..9509789988 100644 --- a/src/lib/elementary/elc_fileselector.c +++ b/src/lib/elementary/elc_fileselector.c @@ -47,9 +47,6 @@ typedef struct _Legacy_Event_Path_Then_Data static Elm_Genlist_Item_Class *list_itc[ELM_FILE_LAST]; static Elm_Gengrid_Item_Class *grid_itc[ELM_FILE_LAST]; -static const char _text_activated_model_key[] = "__fs_text_activated_model"; -static const char _text_activated_path_key[] = "__fs_text_activated_path"; - EAPI Eina_Error ELM_FILESELECTOR_ERROR_UNKNOWN = 0; EAPI Eina_Error ELM_FILESELECTOR_ERROR_INVALID_MODEL = 0; @@ -227,12 +224,6 @@ _mirrored_set(Evas_Object *obj, Eina_Bool rtl) efl_ui_mirrored_set(sd->home_button, rtl); } -static Eina_Future * -_model_str_property_set(Efl_Model *model, const char *property_name, const char *property_value) -{ - return efl_model_property_set(model, property_name, eina_value_string_new(property_value)); -} - EOLIAN static Eina_Error _elm_fileselector_efl_ui_widget_theme_apply(Eo *obj, Elm_Fileselector_Data *sd) { @@ -1414,89 +1405,51 @@ _canc(void *data, const Efl_Event *event EINA_UNUSED) } static void -_text_activated_free_fs_data(Elm_Fileselector *fs) -{ - Eina_Stringshare *str = efl_key_data_get(fs, _text_activated_path_key); - eina_stringshare_del(str); - efl_key_data_set(fs, _text_activated_path_key, NULL); - efl_key_ref_set(fs, _text_activated_model_key, NULL); - efl_unref(fs); -} - -static Eina_Value -_on_text_activated_set_path_then(void *data, const Eina_Value v, const Eina_Future *dead_future EINA_UNUSED) +_on_text_activated(void *data, const Efl_Event *event) { Evas_Object *fs = data; - Eina_Value *fetch = NULL; - Efl_Model *parent; - Efl_Model *model = efl_key_ref_get(fs, _text_activated_model_key); - Eina_Stringshare *str = efl_key_data_get(fs, _text_activated_path_key); + const char *path; + Efl_Model *model = NULL, *parent; Eina_Bool dir = EINA_FALSE; + ELM_FILESELECTOR_DATA_GET(fs, sd); - if (!sd->model) goto end; + if (!sd->model) return; - if (eina_value_type_get() == EINA_VALUE_TYPE_ERROR) + path = elm_widget_part_text_get(event->object, NULL); + if (!ecore_file_exists(path)) { -_model_event_call(fs, ELM_FILESELECTOR_EVENT_SELECTED_INVALID, ELM_FILESELECTOR_EVENT_SELECTED_INVALID->name, model, str); -goto selected; - } +_model_event_call(fs, ELM_FILESELECTOR_EVENT_SELECTED_INVALID, + ELM_FILESELECTOR_EVENT_SELECTED_INVALID->name, NULL, path); - fetch = efl_model_property_get(sd->model, "is_dir"); - eina_value_bool_get(fetch, ); +elm_widget_part_text_set(event->object, NULL, efl_io_model_path_get(sd->model)); +goto end; + } - if (dir) + if (!ecore_file_is_dir(path)) { -efl_replace(>prev_model, sd->model); +model = efl_add_ref(efl_class_get(sd->model), event->object, +efl_io_model_path_set(efl_added, path), +efl_event_callback_array_add(efl_added, noref_death(), NULL)); -parent = model; -model = NULL; +path = eina_slstr_steal_new(ecore_file_dir_get(path)); } else { -parent = efl_parent_get(model); - -if (!parent || efl_isa(parent, EFL_MODEL_INTERFACE)) - goto end; +dir = EINA_TRUE; } + parent = efl_add_ref(efl_class_get(sd->model), event->object, +efl_io_model_path_set(efl_added, path), +efl_event_callback_array_add(efl_added, noref_death(), NULL)); + if (!parent) goto end; + _populate(fs, parent, NULL, model); - selected: - if (sd->only_folder) - _model_event_call(fs, EFL_UI_EVENT_ITEM_SELECTED, "selected", model, str); + if (sd->only_folder && dir) + _model_event_call(fs, EFL_UI_EVENT_ITEM_SELECTED, "selected", parent, path); end: - _text_activated_free_fs_data(fs); - efl_unref(model); - - return v; -} - -static void -_on_text_activated(void *data, const Efl_Event *event) -{ - Eina_Future *future = NULL; - Evas_Object *fs = data; - const char *path; - Efl_Model *model; - - ELM_FILESELECTOR_DATA_GET(fs, sd); - - if (!sd->model)
[EGIT] [core/efl] master 06/19: Revert "efl_ui_layout: call efl_del instead of efl_unref when text part does not exist"
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=2f4b581300b7363823b50308d27245c64059 commit 2f4b581300b7363823b50308d27245c64059 Author: Cedric BAIL Date: Wed Mar 20 10:55:29 2019 -0700 Revert "efl_ui_layout: call efl_del instead of efl_unref when text part does not exist" This reverts commit cced5487c83c8f75e2ca40969f5749d5e6570228. This patch was pushed just to silence warning without fixing the problem and doing something that was incorrect (coupling an efl_del with an efl_ref). Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8429 --- src/lib/elementary/efl_ui_layout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c index f779bb95dc..4a37446e92 100644 --- a/src/lib/elementary/efl_ui_layout.c +++ b/src/lib/elementary/efl_ui_layout.c @@ -2780,7 +2780,7 @@ elm_layout_text_set(Eo *obj, const char *part, const char *text) if (!efl_isa(part_obj, EFL_TEXT_INTERFACE) || !efl_isa(part_obj, EFL_UI_LAYOUT_PART_CLASS)) { -efl_del(part_obj); +efl_unref(part_obj); return EINA_FALSE; } --
[EGIT] [core/efl] master 03/19: eina: prevent double cancel of ongoing dispatched future.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=e859130dd47ee503a8691ca15b5b4255b02a3bb7 commit e859130dd47ee503a8691ca15b5b4255b02a3bb7 Author: Cedric BAIL Date: Wed Mar 13 14:49:50 2019 -0700 eina: prevent double cancel of ongoing dispatched future. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8333 --- src/lib/eina/eina_promise.c | 13 + 1 file changed, 13 insertions(+) diff --git a/src/lib/eina/eina_promise.c b/src/lib/eina/eina_promise.c index 62a47576ce..a5f5c40b5a 100644 --- a/src/lib/eina/eina_promise.c +++ b/src/lib/eina/eina_promise.c @@ -333,6 +333,10 @@ _eina_future_cb_dispatch(Eina_Future *f, const Eina_Value value) { Eina_Future_Cb cb = f->cb; + // Cleaning up prev and past to avoid recursion + if (f->next) f->next->prev = NULL; + if (f->prev) f->prev->next = NULL; + f->cb = EINA_FUTURE_DISPATCHED; if (f->storage) *f->storage = NULL; @@ -364,6 +368,7 @@ _eina_future_dispatch_internal(Eina_Future **f, _eina_promise_value_dbg("No future to deliver value", NULL, value); return value; } + if ((*f)->cb == EINA_FUTURE_DISPATCHED) return value; next_value = _eina_future_cb_dispatch(*f, value); *f = _eina_future_free(*f); return next_value; @@ -396,6 +401,12 @@ _eina_future_dispatch(Eina_Future_Scheduler *scheduler, Eina_Future *f, Eina_Val return; } +// Break early if finding a cb that is already dispatching +if (f->cb == EINA_FUTURE_DISPATCHED) + { + eina_value_flush(_value); + return; + } if (next_value.type == _VALUE_TYPE_PROMISE) { if (EINA_UNLIKELY(eina_log_domain_level_check(_promise_log_dom, EINA_LOG_LEVEL_DBG))) @@ -463,6 +474,8 @@ _eina_future_cancel(Eina_Future *f, int err) while (f) { +// Stop on partially dispatched future +if (f->cb == EINA_FUTURE_DISPATCHED) break; if (f->cb) { Eina_Value r = _eina_future_cb_dispatch(f, value); --
[EGIT] [core/efl] master 01/02: elementary: embed standard config as fallback
zmike pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=f04cc5ceba139023c881940ac3b293c17e2bf4cc commit f04cc5ceba139023c881940ac3b293c17e2bf4cc Author: Marcel Hollerbach Date: Wed Mar 27 17:23:13 2019 -0400 elementary: embed standard config as fallback Summary: as you can see in T7620, there is quite some critics about how we are handling configs in elm. This patch enables the compile-time standard config to be used instead of some weak-wrong-usage hardcoded structure defines somewhere in elm. This means, that every update to the default theme will be also in the next build embedded, without any config files installed at all, the standard config for desktops will work, and a error will be printed, so the user does have the possibility to interact with elm as he wishes, while he sees this error. fixes T7620 Reviewers: zmike, cedric, segfaultxavi, devilhorns Reviewed By: zmike Subscribers: devilhorns, #reviewers, #committers Tags: #efl Maniphest Tasks: T7620 Differential Revision: https://phab.enlightenment.org/D8481 --- src/lib/elementary/config_embed | 4 + src/lib/elementary/elm_config.c | 159 +--- src/lib/elementary/meson.build | 10 ++- 3 files changed, 33 insertions(+), 140 deletions(-) diff --git a/src/lib/elementary/config_embed b/src/lib/elementary/config_embed new file mode 100755 index 00..2382e0e33f --- /dev/null +++ b/src/lib/elementary/config_embed @@ -0,0 +1,4 @@ +#!/bin/bash +echo "static const char *embedded_config = \"\"" > $2 +sed -e 's/"/\\"/g; s/$/\"/; s/^/\"/' $1 >> $2 +echo "\"\";" >> $2 diff --git a/src/lib/elementary/elm_config.c b/src/lib/elementary/elm_config.c index a88d62503e..13b59ed4fd 100644 --- a/src/lib/elementary/elm_config.c +++ b/src/lib/elementary/elm_config.c @@ -1659,6 +1659,8 @@ _config_user_load(void) return cfg; } +#include "elm_default_config.x" + static Elm_Config * _config_system_load(void) { @@ -1681,6 +1683,20 @@ _config_system_load(void) cfg = eet_data_read(ef, _config_edd, "config"); eet_close(ef); } + + if (!cfg) + { +Eina_Tmpstr* tmp; +ERR("System loading config failed! Check your setup! Falling back to compile time defaults"); + EINA_SAFETY_ON_FALSE_RETURN_VAL(eina_file_mkstemp("/tmp/elementary_configXX", ), NULL); +ef = eet_open(tmp, EET_FILE_MODE_WRITE); +EINA_SAFETY_ON_FALSE_RETURN_VAL(eet_data_undump(ef, "config", embedded_config, strlen(embedded_config)-1, EINA_FALSE), NULL); +eet_close(ef); +ef = eet_open(tmp, EET_FILE_MODE_READ); +cfg = eet_data_read(ef, _config_edd, "config"); +eet_close(ef); + } + return cfg; } @@ -1738,145 +1754,10 @@ _config_load(void) _env_get(); return; } - /* FIXME: config load could have failed because of a non-existent -* profile. Fallback to default before moving on */ - - // config load fail - defaults - // why are these here? well if they are, it means you can make a gui - // config recovery app i guess... - _elm_config = ELM_NEW(Elm_Config); - if (!_elm_config) return; - _elm_config->config_version = ELM_CONFIG_VERSION; - _elm_config->engine = NULL; - _elm_config->accel = NULL; - _elm_config->accel_override = 0; - _elm_config->vsync = 0; - _elm_config->thumbscroll_enable = EINA_TRUE; - _elm_config->thumbscroll_threshold = 24; - _elm_config->thumbscroll_hold_threshold = 24; - _elm_config->thumbscroll_momentum_threshold = 100.0; - _elm_config->thumbscroll_flick_distance_tolerance = 1000; - _elm_config->thumbscroll_momentum_distance_max = 1000; - _elm_config->thumbscroll_friction = 1.0; - _elm_config->thumbscroll_momentum_friction = 1.0; - _elm_config->thumbscroll_min_friction = 0.5; - _elm_config->thumbscroll_friction_standard = 1000.0; - _elm_config->thumbscroll_bounce_friction = 0.5; - _elm_config->thumbscroll_bounce_enable = EINA_TRUE; - _elm_config->thumbscroll_acceleration_threshold = 500.0; - _elm_config->thumbscroll_acceleration_time_limit = 0.7; - _elm_config->thumbscroll_acceleration_weight = 1.5; - _elm_config->thumbscroll_momentum_animation_duration_min_limit = 0.3; - _elm_config->thumbscroll_momentum_animation_duration_max_limit = 1.5; - _elm_config->page_scroll_friction = 0.5; - _elm_config->bring_in_scroll_friction = 0.5; - _elm_config->zoom_friction = 0.5; - _elm_config->thumbscroll_border_friction = 0.5; - _elm_config->thumbscroll_sensitivity_friction = 0.25; // magic number! just trial and error shows this makes it behave "nicer" and not run off at high speed all the time - _elm_config->scroll_smooth_start_enable = EINA_TRUE; - _elm_config->scroll_animation_disable = EINA_FALSE; - _elm_config->scroll_accel_factor = 7.0; -// _elm_config->scroll_smooth_time_interval =
[EGIT] [core/efl] master 02/02: build: add autotools for elm config embedding
zmike pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=8f8082bf7d476cb2d245b9ac3012c9c6754457e8 commit 8f8082bf7d476cb2d245b9ac3012c9c6754457e8 Author: Mike Blumenkrantz Date: Wed Mar 27 17:23:19 2019 -0400 build: add autotools for elm config embedding Summary: Depends on D8481 Reviewers: bu5hm4n, devilhorns Reviewed By: bu5hm4n Subscribers: cedric, #reviewers, #committers Tags: #efl_build Differential Revision: https://phab.enlightenment.org/D8489 --- src/Makefile.am| 3 ++- src/Makefile_Elementary.am | 7 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index c10a719382..9675fc193b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,6 +2,7 @@ AUTOMAKE_OPTIONS= -Wno-portability MAINTAINERCLEANFILES = Makefile.in CLEANFILES = BUILT_SOURCES = +PHONIES = EOLIAN_FLAGS = -I$(srcdir) EOLIAN_GEN_FLAGS = -S @@ -101,7 +102,7 @@ endif include Makefile_Eolian_Js.am include Makefile_Efl_Js.am -.PHONY: benchmark examples +.PHONY: benchmark examples $(PHONIES) BENCHMARK_SUBDIRS = \ benchmarks/eina \ diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am index 4b132104f0..414a1250c5 100644 --- a/src/Makefile_Elementary.am +++ b/src/Makefile_Elementary.am @@ -215,7 +215,8 @@ BUILT_SOURCES += \ $(elm_private_eolian_h) \ $(elm_legacy_eolian_c) \ $(elm_legacy_eolian_eo_h) \ - $(elm_legacy_eolian_legacy_h) + $(elm_legacy_eolian_legacy_h) \ + lib/elementary/elm_default_config.x if INSTALL_EO_FILES elementaryeolianfilesdir = $(datadir)/eolian/include/elementary-@VMAJ@ @@ -2003,3 +2004,7 @@ lib/elementary/Elementary_Options.h.in \ lib/elementary/elm_code_widget_text.c \ lib/elementary/elm_code_widget_undo.c +PHONIES += lib/elementary/elm_default_config.x + +lib/elementary/elm_default_config.x: $(abs_top_srcdir)/data/elementary/config/standard/base.src.in $(abs_top_srcdir)/src/lib/elementary/config_embed + lib/elementary/config_embed $< $@ --
[EGIT] [core/efl] master 01/02: build: fix meson pixman dependency name
zmike pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=4032d52a8793c054be82292a7be40da96a669ad1 commit 4032d52a8793c054be82292a7be40da96a669ad1 Author: Mike Blumenkrantz Date: Wed Mar 27 14:34:43 2019 -0400 build: fix meson pixman dependency name Summary: thx @vtorri for reporting Reviewers: devilhorns, vtorri Reviewed By: vtorri Subscribers: cedric, #reviewers, vtorri, #committers Tags: #efl_build Differential Revision: https://phab.enlightenment.org/D8479 --- src/lib/evas/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/evas/meson.build b/src/lib/evas/meson.build index df5f585f5e..d338d586cc 100644 --- a/src/lib/evas/meson.build +++ b/src/lib/evas/meson.build @@ -129,7 +129,7 @@ if (get_option('pixman')) foreach support : pixman_support config_h.set(support, '1') endforeach - evas_deps += dependency('pixman') + evas_deps += dependency('pixman-1') endif if (get_option('hyphen')) --
[EGIT] [core/efl] master 02/02: build: fix meson vnc-server option text
zmike pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=c8b143ddeb3b13b502fe64d4d29b7742d05c19d7 commit c8b143ddeb3b13b502fe64d4d29b7742d05c19d7 Author: Mike Blumenkrantz Date: Wed Mar 27 14:34:48 2019 -0400 build: fix meson vnc-server option text Summary: thx @vtorri for reporting Reviewers: devilhorns, vtorri Reviewed By: vtorri Subscribers: cedric, #reviewers, vtorri, #committers Tags: #efl_build Differential Revision: https://phab.enlightenment.org/D8480 --- meson_options.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson_options.txt b/meson_options.txt index 8c136fe9e1..105f4cf9cb 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -277,7 +277,7 @@ option('libmount', option('vnc-server', type : 'boolean', value : false, - description : 'use libmount support or not' + description : 'enable building a vnc-server for multiseat testing' ) option('v4l2', --
[EGIT] [core/efl] master 01/03: entry: move a point to do 'auto_save' to another place
zmike pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=8e8aa74751fa9d2ff450acd789d0fdd22ab72171 commit 8e8aa74751fa9d2ff450acd789d0fdd22ab72171 Author: Wonki Kim Date: Wed Mar 27 10:18:33 2019 -0400 entry: move a point to do 'auto_save' to another place Summary: By reworking on efl_file, logic flow for entry has been changed. and it causes autosave making a file that is passed to elm_entry_file_set empty. Test Plan: 1. call elm_entry_file_set for a file. 2. check the file is not empty after calling the function. Reviewers: zmike, bu5hm4n Reviewed By: zmike Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8362 --- src/lib/elementary/elm_entry.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lib/elementary/elm_entry.c b/src/lib/elementary/elm_entry.c index ed7035fd90..7acdf40a1c 100644 --- a/src/lib/elementary/elm_entry.c +++ b/src/lib/elementary/elm_entry.c @@ -284,7 +284,7 @@ _save_do(Evas_Object *obj) { ELM_ENTRY_DATA_GET(obj, sd); - if (!sd->file) return; + if (!efl_file_loaded_get(obj)) return; switch (sd->format) { case ELM_TEXT_FORMAT_PLAIN_UTF8: @@ -4983,6 +4983,9 @@ EAPI Eina_Bool elm_entry_file_set(Evas_Object *obj, const char *file, Elm_Text_Format format) { Eina_Bool ret; + ELM_ENTRY_DATA_GET(obj, sd); + ELM_SAFE_FREE(sd->delay_write, ecore_timer_del); + if (sd->auto_save) _save_do(obj); elm_obj_entry_file_text_format_set(obj, format); ret = efl_file_simple_load(obj, file, NULL); return ret; @@ -4996,15 +4999,13 @@ _elm_entry_efl_file_unload(Eo *obj, Elm_Entry_Data *sd EINA_UNUSED) } EOLIAN static Eina_Error -_elm_entry_efl_file_load(Eo *obj, Elm_Entry_Data *sd) +_elm_entry_efl_file_load(Eo *obj, Elm_Entry_Data *sd EINA_UNUSED) { Eina_Error err; if (efl_file_loaded_get(obj)) return 0; err = efl_file_load(efl_super(obj, MY_CLASS)); if (err) return err; - ELM_SAFE_FREE(sd->delay_write, ecore_timer_del); - if (sd->auto_save) _save_do(obj); return _load_do(obj); } --
[EGIT] [core/efl] master 02/03: test: add a test case for elm_entry
zmike pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=0f29560aa2214f1fb28a601212242c58524f85a3 commit 0f29560aa2214f1fb28a601212242c58524f85a3 Author: Wonki Kim Date: Wed Mar 27 10:18:41 2019 -0400 test: add a test case for elm_entry Summary: behaviors of elm_entry has been changed so that this patch provides usages to keep as a test case. Reviewers: zmike, Hermet, YOhoho Reviewed By: zmike Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8483 --- src/tests/elementary/elm_test_entry.c| 39 src/tests/elementary/testfile_entry.txt | 1 + src/tests/elementary/testfile_entry2.txt | 2 ++ 3 files changed, 42 insertions(+) diff --git a/src/tests/elementary/elm_test_entry.c b/src/tests/elementary/elm_test_entry.c index 5033798f7d..48e31d0b3c 100644 --- a/src/tests/elementary/elm_test_entry.c +++ b/src/tests/elementary/elm_test_entry.c @@ -491,6 +491,44 @@ EFL_START_TEST(elm_entry_text_set) } EFL_END_TEST +EFL_START_TEST(elm_entry_file_get_set) +{ + Evas_Object *win, *entry; + const char *file_path = NULL; + Elm_Text_Format format = ELM_TEXT_FORMAT_PLAIN_UTF8; + + win = win_add(NULL, "entry", ELM_WIN_BASIC); + entry = elm_entry_add(win); + + ck_assert(elm_entry_file_set(entry, TESTS_SRC_DIR"/testfile_entry.txt", ELM_TEXT_FORMAT_PLAIN_UTF8)); + elm_entry_file_get(entry, _path, ); + fprintf(stderr, "elm_entry_file_get_set1 %s, %s, %d\n", elm_object_text_get(entry), file_path, format); + + ck_assert_str_eq(elm_object_text_get(entry), "hello world"); + ck_assert_str_eq(file_path, TESTS_SRC_DIR"/testfile_entry.txt"); + ck_assert(format == ELM_TEXT_FORMAT_PLAIN_UTF8); + + ck_assert(elm_entry_file_set(entry, TESTS_SRC_DIR"/testfile_entry2.txt", ELM_TEXT_FORMAT_PLAIN_UTF8)); + elm_entry_file_get(entry, _path, ); + fprintf(stderr, "elm_entry_file_get_set2 %s, %s, %d\n", elm_object_text_get(entry), file_path, format); + + ck_assert_str_eq(elm_object_text_get(entry), "hello elementaryhello entry"); + ck_assert_str_eq(file_path, TESTS_SRC_DIR"/testfile_entry2.txt"); + ck_assert(format == ELM_TEXT_FORMAT_PLAIN_UTF8); + + ck_assert(elm_entry_file_set(entry, NULL, ELM_TEXT_FORMAT_PLAIN_UTF8)); + elm_entry_file_get(entry, _path, ); + fprintf(stderr, "elm_entry_file_get_set3 %s, %s, %d\n", elm_object_text_get(entry), file_path, format); + + ck_assert_str_eq(elm_object_text_get(entry), ""); + ck_assert(file_path == NULL); + ck_assert(format == ELM_TEXT_FORMAT_PLAIN_UTF8); + + fprintf(stderr, "elm_entry_file_get_set4\n"); + +} +EFL_END_TEST + void elm_test_entry(TCase *tc) { tcase_add_test(tc, elm_entry_legacy_type_check); @@ -507,4 +545,5 @@ void elm_test_entry(TCase *tc) tcase_add_test(tc, elm_atspi_role_get); tcase_add_test(tc, elm_entry_text_set); tcase_add_test(tc, elm_entry_magnifier); + tcase_add_test(tc, elm_entry_file_get_set); } diff --git a/src/tests/elementary/testfile_entry.txt b/src/tests/elementary/testfile_entry.txt new file mode 100644 index 00..3b18e512db --- /dev/null +++ b/src/tests/elementary/testfile_entry.txt @@ -0,0 +1 @@ +hello world diff --git a/src/tests/elementary/testfile_entry2.txt b/src/tests/elementary/testfile_entry2.txt new file mode 100644 index 00..4b870a2e68 --- /dev/null +++ b/src/tests/elementary/testfile_entry2.txt @@ -0,0 +1,2 @@ +hello elementary +hello entry --
[EGIT] [core/efl] master 03/03: eina benchmark: fix warnings on Windows 64 bits
zmike pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=79e809d94505708b224bb4a63a1a92b2e7abba4d commit 79e809d94505708b224bb4a63a1a92b2e7abba4d Author: Vincent Torri Date: Wed Mar 27 10:59:31 2019 -0400 eina benchmark: fix warnings on Windows 64 bits Summary: long is always a 32 bits type on Windows Test Plan: compilation Reviewers: raster, zmike, cedric Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8482 --- src/benchmarks/eina/ecore_hash.c | 12 ++-- src/benchmarks/eina/ecore_sheap.c | 7 --- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/benchmarks/eina/ecore_hash.c b/src/benchmarks/eina/ecore_hash.c index 4d4058859b..374a0e08da 100644 --- a/src/benchmarks/eina/ecore_hash.c +++ b/src/benchmarks/eina/ecore_hash.c @@ -460,7 +460,7 @@ _ecore_hash_bucket_destroy(Ecore_Hash_Node *list, static int _ecore_hash_node_add(Ecore_Hash *hash, Ecore_Hash_Node *node) { - unsigned long hash_val; + size_t hash_val; CHECK_PARAM_POINTER_RETURN("hash", hash, FALSE); CHECK_PARAM_POINTER_RETURN("node", node, FALSE); @@ -471,7 +471,7 @@ _ecore_hash_node_add(Ecore_Hash *hash, Ecore_Hash_Node *node) /* Compute the position in the table */ if (!hash->hash_func) - hash_val = (unsigned long)node->key % ecore_prime_table[hash->size]; + hash_val = (size_t)node->key % ecore_prime_table[hash->size]; else hash_val = ECORE_COMPUTE_HASH(hash, node->key); @@ -522,14 +522,14 @@ ecore_hash_remove(Ecore_Hash *hash, const void *key) { Ecore_Hash_Node *node = NULL; Ecore_Hash_Node *list; - unsigned long hash_val; + size_t hash_val; void *ret = NULL; CHECK_PARAM_POINTER_RETURN("hash", hash, NULL); /* Compute the position in the table */ if (!hash->hash_func) - hash_val = (unsigned long )key % ecore_prime_table[hash->size]; + hash_val = (size_t)key % ecore_prime_table[hash->size]; else hash_val = ECORE_COMPUTE_HASH(hash, key); @@ -626,7 +626,7 @@ ecore_hash_find(Ecore_Hash *hash, Ecore_Compare_Cb compare, const void *value) static Ecore_Hash_Node * _ecore_hash_node_get(Ecore_Hash *hash, const void *key) { - unsigned long hash_val; + size_t hash_val; Ecore_Hash_Node *node = NULL; CHECK_PARAM_POINTER_RETURN("hash", hash, NULL); @@ -636,7 +636,7 @@ _ecore_hash_node_get(Ecore_Hash *hash, const void *key) /* Compute the position in the table */ if (!hash->hash_func) - hash_val = (unsigned long)key % ecore_prime_table[hash->size]; + hash_val = (size_t)key % ecore_prime_table[hash->size]; else hash_val = ECORE_COMPUTE_HASH(hash, key); diff --git a/src/benchmarks/eina/ecore_sheap.c b/src/benchmarks/eina/ecore_sheap.c index 448be97918..e86c10b510 100644 --- a/src/benchmarks/eina/ecore_sheap.c +++ b/src/benchmarks/eina/ecore_sheap.c @@ -4,6 +4,7 @@ #include #include +#include #include "Ecore_Data.h" @@ -452,10 +453,10 @@ _ecore_sheap_update_data(Ecore_Sheap *heap) int ecore_direct_compare(const void *key1, const void *key2) { - unsigned long k1, k2; + uintptr_t k1, k2; - k1 = (unsigned long)key1; - k2 = (unsigned long)key2; + k1 = (uintptr_t)key1; + k2 = (uintptr_t)key2; if (k1 > k2) return 1; --