herdsman pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=4dc2001dac617a8cd9a7381b4de83bcc68578859
commit 4dc2001dac617a8cd9a7381b4de83bcc68578859 Author: Daniel Hirt <[email protected]> Date: Sat Sep 9 13:21:06 2017 +0300 Ui text: reduce calls to update functions Reduces calls to update functions when entering text. Also, remaining calls to update the cursors were moved to the decoration jobs. --- .../elementary/efl_ui_internal_text_interactive.c | 14 +++++++-- src/lib/elementary/efl_ui_text.c | 34 +++++++++++++++++----- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/src/lib/elementary/efl_ui_internal_text_interactive.c b/src/lib/elementary/efl_ui_internal_text_interactive.c index ee4c3c2c48..fd38f8dd5c 100644 --- a/src/lib/elementary/efl_ui_internal_text_interactive.c +++ b/src/lib/elementary/efl_ui_internal_text_interactive.c @@ -711,6 +711,9 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void int old_cur_pos; char *string = (char *)ev->string; Eina_Bool free_string = EINA_FALSE; + Eina_Bool changed_user = EINA_FALSE; + Efl_Ui_Text_Interactive_Change_Info info = { NULL, 0, 0, 0, 0 }; + if (!ev->key) return; if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; @@ -1031,7 +1034,6 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void } if (string) { - Efl_Ui_Text_Interactive_Change_Info info = { NULL, 0, 0, 0, 0 }; if (en->have_selection) { _sel_range_del_emit(obj, en); @@ -1042,9 +1044,10 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void info.position = efl_text_cursor_position_get(obj, cur); info.length = eina_unicode_utf8_get_len(string); + efl_event_freeze(obj); efl_text_cursor_text_insert(obj, cur, string); - efl_event_callback_legacy_call(obj, - EFL_UI_TEXT_INTERACTIVE_EVENT_CHANGED_USER, &info); + efl_event_thaw(obj); + changed_user = EINA_TRUE; ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; @@ -1052,6 +1055,11 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void } } end: + if (changed_user) + { + efl_event_callback_legacy_call(obj, + EFL_UI_TEXT_INTERACTIVE_EVENT_CHANGED_USER, &info); + } (void) 0; } diff --git a/src/lib/elementary/efl_ui_text.c b/src/lib/elementary/efl_ui_text.c index 914d0a57f7..fccb5c877c 100644 --- a/src/lib/elementary/efl_ui_text.c +++ b/src/lib/elementary/efl_ui_text.c @@ -1124,7 +1124,11 @@ _efl_ui_text_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Text_Data *sd) evas_event_thaw(evas_object_evas_get(obj)); evas_event_thaw_eval(evas_object_evas_get(obj)); - _cursor_geometry_recalc(obj); + if (!sd->deferred_decoration_cursor) + { + sd->deferred_decoration_cursor = EINA_TRUE; + _decoration_defer(obj); + } } static void @@ -2208,7 +2212,13 @@ _entry_cursor_changed_signal_cb(void *data, { edje_object_signal_emit(sd->entry_edje, "elm,action,hide,cursor", "elm"); } - _cursor_geometry_recalc(data); + + if (!sd->deferred_decoration_cursor) + { + sd->deferred_decoration_cursor = EINA_TRUE; + _decoration_defer(obj); + } + if (_elm_config->atspi_mode) elm_interface_atspi_accessible_event_emit(ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN, data, ELM_INTERFACE_ATSPI_TEXT_EVENT_ACCESS_TEXT_CARET_MOVED, NULL); } @@ -4657,12 +4667,14 @@ _update_text_cursors(Eo *obj) Evas_Coord x, y, w, h, xx, yy, ww, hh; Evas_Coord xx2, yy2; Eina_Bool bidi_cursor; + Eo *text_obj; + EFL_UI_TEXT_DATA_GET(obj, sd); if (!sd->deferred_decoration_cursor) return; sd->deferred_decoration_cursor = EINA_FALSE; - Eo *text_obj = edje_object_part_swallow_get(sd->entry_edje, "elm.text"); + text_obj = edje_object_part_swallow_get(sd->entry_edje, "elm.text"); x = y = w = h = -1; xx = yy = ww = hh = -1; @@ -5055,17 +5067,21 @@ _anchors_update(Eo *o, Efl_Ui_Text_Data *sd) Efl_Ui_Text_Rectangle *rect; Anchor *an; const char *file; + Eo *sw; + + sw = edje_object_part_swallow_get(sd->entry_edje, "elm.text"); efl_file_get(sd->entry_edje, &file, NULL); if (!sd->deferred_decoration_anchor) return; sd->deferred_decoration_anchor = EINA_FALSE; - _anchors_create(o, sd); - /* Better not to update anchors outside the view port. */ if (sd->anchors_updated) return; + efl_event_freeze(sw); + _anchors_create(o, sd); + smart = evas_object_smart_parent_get(o); clip = evas_object_clip_get( edje_object_part_swallow_get(sd->entry_edje, "elm.text")); @@ -5225,6 +5241,7 @@ _anchors_update(Eo *o, Efl_Ui_Text_Data *sd) } _unused_item_objs_free(sd); + efl_event_thaw(sw); } static void @@ -5279,8 +5296,11 @@ _efl_ui_text_cursor_changed_cb(void *data, const Efl_Event *event EINA_UNUSED) { EFL_UI_TEXT_DATA_GET(data, sd); sd->cur_changed = EINA_TRUE; - sd->deferred_decoration_cursor = EINA_TRUE; - _decoration_defer(data); + if (!sd->deferred_decoration_cursor) + { + sd->deferred_decoration_cursor = EINA_TRUE; + _decoration_defer(data); + } } static void --
