diff options
author | Daniel Hirt <hirt.danny@gmail.com> | 2017-09-12 08:38:51 +0300 |
---|---|---|
committer | Daniel Hirt <hirt.danny@gmail.com> | 2017-09-13 19:25:32 +0300 |
commit | 7d17d0f620eb6994ea5b517934d84280293ec02b (patch) | |
tree | c345f3f61b1f07f5e526f8c979fdb5f5e577c787 | |
parent | 18dbfa0d263f8aea03b0acba336c24af94b0fa28 (diff) | |
download | efl-7d17d0f620eb6994ea5b517934d84280293ec02b.tar.gz |
Ui text: add Efl.Ui.Text_Async object
Adds "Efl.Ui.Text_Async" object.
This new widget uses the "async_layout" functionality of the underlying
Efl.Canvas.Text_Async object.
Currently, if "editable" mode is enabled, there is no asynchronous
layout, as interactive operations (e.g. typing) should get processed
immediately. Thus, only "non-editable" instructs the text object to do
asynchronous layout.
@feature
-rw-r--r-- | src/Makefile_Elementary.am | 1 | ||||
-rw-r--r-- | src/bin/elementary/test.c | 4 | ||||
-rw-r--r-- | src/bin/elementary/test_efl_ui_text.c | 177 | ||||
-rw-r--r-- | src/lib/elementary/Elementary.h | 1 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_text.c | 216 |
5 files changed, 335 insertions, 64 deletions
diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am index d192a136c5..3aad9f341b 100644 --- a/src/Makefile_Elementary.am +++ b/src/Makefile_Elementary.am @@ -124,6 +124,7 @@ elm_public_eolian_files = \ lib/elementary/efl_ui_text_interactive.eo \ lib/elementary/efl_ui_text.eo \ lib/elementary/efl_ui_text_editable.eo \ + lib/elementary/efl_ui_text_async.eo \ lib/elementary/efl_config_global.eo \ lib/elementary/efl_ui_clock.eo \ lib/elementary/efl_ui_cursor.eo \ diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c index 93282b5b02..5b699187ee 100644 --- a/src/bin/elementary/test.c +++ b/src/bin/elementary/test.c @@ -312,6 +312,8 @@ void test_code_diff_inline(void *data, Evas_Object *obj, void *event_info); void test_efl_ui_text(void *data, Evas_Object *obj, void *event_info); void test_efl_ui_text_label(void *data, Evas_Object *obj, void *event_info); +void test_efl_ui_text_async(void *data, Evas_Object *obj, void *event_info); +void test_efl_ui_text_async_genlist(void *data, Evas_Object *obj, void *event_info); void test_evas_mask(void *data, Edje_Object *obj, void *event_info); void test_gfx_filters(void *data, Evas_Object *obj, void *event_info); void test_evas_snapshot(void *data, Evas_Object *obj, void *event_info); @@ -747,6 +749,8 @@ add_tests: ADD_TEST(NULL, "Entries", "Entry Password", test_entry_password); ADD_TEST(NULL, "Entries", "Efl UI Text", test_efl_ui_text); ADD_TEST(NULL, "Entries", "Efl UI Text Label", test_efl_ui_text_label); + ADD_TEST(NULL, "Entries", "Efl UI Text Async", test_efl_ui_text_async); + ADD_TEST(NULL, "Entries", "Efl UI Text Async Genlist", test_efl_ui_text_async_genlist); //------------------------------// ADD_TEST(NULL, "Advanced Entries", "Code Entry Markup", test_code_welcome); diff --git a/src/bin/elementary/test_efl_ui_text.c b/src/bin/elementary/test_efl_ui_text.c index 862c832e16..4feca1dc1d 100644 --- a/src/bin/elementary/test_efl_ui_text.c +++ b/src/bin/elementary/test_efl_ui_text.c @@ -255,3 +255,180 @@ test_efl_ui_text(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve evas_object_resize(win, 480, 320); evas_object_show(win); } + +void +test_efl_ui_text_async(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Evas_Object *win, *bx, *bx2, *bx3, *en; + + win = elm_win_util_standard_add("entry", "Entry"); + elm_win_autodel_set(win, EINA_TRUE); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + en = efl_add(EFL_UI_TEXT_ASYNC_CLASS, win, + efl_text_wrap_set(efl_added, EFL_TEXT_FORMAT_WRAP_WORD), + efl_text_multiline_set(efl_added, EINA_TRUE) + ); + + printf("Added Efl.Ui.Text object\n"); + efl_key_data_set(en, "wrap_idx", 0); + efl_text_set(en, "Hello world! Goodbye world! This is a test text for the" + " new UI Text widget.\xE2\x80\xA9This is the next paragraph.\nThis" + " is the next line.\nThis is Yet another line! Line and paragraph" + " separators are actually different!"); + efl_text_font_set(en, "Sans", 10); + efl_text_normal_color_set(en, 255, 255, 255, 255); + + elm_box_pack_end(bx, en); + elm_object_focus_set(en, EINA_TRUE); + + bx2 = elm_box_add(win); + elm_box_horizontal_set(bx2, EINA_TRUE); + evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); + + bx3 = elm_box_add(win); + elm_box_horizontal_set(bx3, EINA_TRUE); + evas_object_size_hint_weight_set(bx3, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(bx3, EVAS_HINT_FILL, EVAS_HINT_FILL); + + elm_box_pack_end(bx, bx3); + elm_box_pack_end(bx, bx2); + evas_object_show(bx3); + evas_object_show(bx2); + + evas_object_resize(win, 480, 320); + evas_object_show(win); +} + +struct _api_data +{ + unsigned int state; /* What state we are testing */ + void *box; /* Use this to get box content */ + + Elm_Genlist_Item_Class *itc; + Elm_Genlist_Item_Class *itc1; + Elm_Genlist_Item_Class *itc2; + void *gl; + + void *filter_data; /* The data used for filtering */ + int scrollto; +}; +typedef struct _api_data api_data; + +static void +_cleanup_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + api_data *api = (api_data *)data; + if (api->filter_data) free(api->filter_data); + free(api); +} + +static void +gl_sel(void *data, Evas_Object *obj, void *event_info) +{ + printf("sel item data [%p] on genlist obj [%p], item pointer [%p], index [%d]\n", + data, obj, event_info, elm_genlist_item_index_get(event_info)); +} + +static void +_genlist_del_cb(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, + void *event_info EINA_UNUSED) +{ + if (!data) return; + + elm_genlist_item_class_free(data); +} + +static Evas_Object +*gl_content_get(void *data EINA_UNUSED, Evas_Object *obj, const char *part EINA_UNUSED) +{ + Evas_Object *ic = efl_add(EFL_UI_TEXT_ASYNC_CLASS, obj, + //efl_text_multiline_set(efl_added, EINA_TRUE), + efl_text_font_set(efl_added, "Sans", 10) + ); + efl_text_set(ic, "Hello world! Goodbye world! This is a test text for the" + " new UI Text widget.\xE2\x80\xA9This is the next paragraph.\nThis" + " is the next line.\nThis is Yet another line! Line and paragraph" + " separators are actually different!"); + //char buf[PATH_MAX]; + //Evas_Object *ic = elm_label_add(obj); + //elm_object_text_set(ic, "Hello world\n"); + + //if (!strcmp(part, "elm.swallow.end")) + // snprintf(buf, sizeof(buf), "%s/images/bubble.png", elm_app_data_dir_get()); + //else + // snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); + //elm_image_file_set(ic, buf, NULL); + //evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + return ic; +} + +void +test_efl_ui_text_async_genlist(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Evas_Object *win, *bg, *gl, *bx; + Elm_Object_Item *gli[10]; + + api_data *api = calloc(1, sizeof(api_data)); + win = elm_win_add(NULL, "Genlist with text", ELM_WIN_BASIC); + elm_win_title_set(win, "Genlist with Text"); + elm_win_autodel_set(win, EINA_TRUE); + evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api); + + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + gl = elm_genlist_add(win); + elm_genlist_mode_set(gl, ELM_LIST_COMPRESS); + evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + api->gl = gl; + evas_object_show(gl); + + api->itc1 = elm_genlist_item_class_new(); + api->itc1->item_style = "default"; + //api->itc1->func.text_get = gl_text_get; + api->itc1->func.content_get = gl_content_get; + //api->itc1->func.state_get = gl_state_get; + api->itc1->func.del = NULL; + + gli[0] = elm_genlist_item_append(gl, api->itc1, + (void *)1001/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */, + (void *)1001/* func data */); + gli[1] = elm_genlist_item_append(gl, api->itc1, + (void *)1002/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */, + (void *)1002/* func data */); + gli[2] = elm_genlist_item_append(gl, api->itc1, + (void *)1003/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */, + (void *)1003/* func data */); + gli[3] = elm_genlist_item_prepend(gl, api->itc1, + (void *)1004/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */, + (void *)1004/* func data */); + gli[4] = elm_genlist_item_prepend(gl, api->itc1, + (void *)1005/* item data */, NULL/* parent */, ELM_GENLIST_ITEM_NONE, gl_sel/* func */, + (void *)1005/* func data */); + gli[5] = elm_genlist_item_insert_before(gl, api->itc1, + (void *)1006/* item data */, NULL/* parent */, gli[2]/* rel */, ELM_GENLIST_ITEM_NONE, + gl_sel/* func */, (void *)1006/* func data */); + gli[6] = elm_genlist_item_insert_after(gl, api->itc1, + (void *)1007/* item data */, NULL/* parent */, gli[2]/* rel */, ELM_GENLIST_ITEM_NONE, + gl_sel/* func */, (void *)1007/* func data */); + elm_box_pack_end(bx, gl); + + evas_object_event_callback_add(gl, EVAS_CALLBACK_DEL, _genlist_del_cb, api->itc1); + + evas_object_resize(win, 320, 320); + evas_object_show(win); +} diff --git a/src/lib/elementary/Elementary.h b/src/lib/elementary/Elementary.h index ed2fd39964..61c7c9351f 100644 --- a/src/lib/elementary/Elementary.h +++ b/src/lib/elementary/Elementary.h @@ -276,6 +276,7 @@ EAPI extern Elm_Version *elm_version; # include <efl_ui_text_interactive.eo.h> # include <efl_ui_text.eo.h> # include <efl_ui_text_editable.eo.h> +# include <efl_ui_text_async.eo.h> # include <efl_ui_clock.eo.h> # include <efl_ui_image_factory.eo.h> #include <efl_ui_slider_interval.eo.h> diff --git a/src/lib/elementary/efl_ui_text.c b/src/lib/elementary/efl_ui_text.c index 24aa926a91..12f6b68ed4 100644 --- a/src/lib/elementary/efl_ui_text.c +++ b/src/lib/elementary/efl_ui_text.c @@ -42,7 +42,6 @@ struct _Efl_Ui_Text_Data Eo *cursor_bidi; Evas_Object *start_handler; Evas_Object *end_handler; - Ecore_Job *deferred_recalc_job; Ecore_Job *deferred_decoration_job; Ecore_Timer *longpress_timer; Ecore_Timer *delay_write; @@ -92,6 +91,11 @@ struct _Efl_Ui_Text_Data Elm_Cnp_Mode cnp_mode; Elm_Sel_Format drop_format; + struct { + char *text; + Eina_Bool enabled; + } async; + Eina_Bool input_panel_return_key_disabled : 1; Eina_Bool drag_selection_asked : 1; Eina_Bool sel_handler_disabled : 1; @@ -127,7 +131,6 @@ struct _Efl_Ui_Text_Data Eina_Bool scroll : 1; Eina_Bool input_panel_show_on_demand : 1; Eina_Bool anchors_updated : 1; - Eina_Bool test_bit : 1; }; struct _Anchor @@ -916,7 +919,7 @@ _efl_ui_text_elm_widget_theme_apply(Eo *obj, Efl_Ui_Text_Data *sd) theme_apply = elm_obj_widget_theme_apply(efl_cast(obj, ELM_WIDGET_CLASS)); if (!theme_apply) return EFL_UI_THEME_APPLY_FAILED; - evas_event_freeze(evas_object_evas_get(obj)); + efl_event_freeze(obj); edje_object_mirrored_set (wd->resize_obj, efl_ui_mirrored_get(obj)); @@ -1017,12 +1020,10 @@ _efl_ui_text_elm_widget_theme_apply(Eo *obj, Efl_Ui_Text_Data *sd) } sd->changed = EINA_TRUE; - elm_layout_sizing_eval(obj); sd->has_text = !sd->has_text; _efl_ui_text_guide_update(obj, !sd->has_text); - evas_event_thaw(evas_object_evas_get(obj)); - evas_event_thaw_eval(evas_object_evas_get(obj)); + efl_event_thaw(obj); efl_event_callback_legacy_call(obj, EFL_UI_LAYOUT_EVENT_THEME_CHANGED, NULL); @@ -1036,13 +1037,13 @@ _cursor_geometry_recalc(Evas_Object *obj) { EFL_UI_TEXT_DATA_GET(obj, sd); - efl_event_callback_legacy_call(obj, EFL_UI_TEXT_EVENT_CURSOR_CHANGED, NULL); - Evas_Coord x, y, w, h; Evas_Coord x2, y2, w2, h2; Evas_Coord cx, cy, cw, ch; Eina_Rectangle sr; + if (!sd->editable) return; + cx = cy = cw = ch = 0; x2 = y2 = w2 = h2 = 0; x = y = w = h = 0; @@ -1067,38 +1068,23 @@ _cursor_geometry_recalc(Evas_Object *obj) elm_widget_show_region_set(obj, sr, EINA_FALSE); } -EOLIAN static void -_efl_ui_text_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Text_Data *sd) +static void +_layout_text_sizing_eval(Eo *obj, Evas_Coord tw, Evas_Coord th) { - Evas_Coord minw, minh, resw, resh; - Evas_Coord fw, fh; Eo *sw; - Eina_Bool wrap; - - evas_object_geometry_get(obj, NULL, NULL, &resw, &resh); - - sw = edje_object_part_swallow_get(sd->entry_edje, "elm.text"); - if (!sw) return; - - wrap = efl_text_wrap_get(sw); + Evas_Coord minw, minh; - if (!sd->changed && (resw == sd->ent_w) && (resh == sd->ent_h)) return; - - sd->changed = EINA_FALSE; - sd->ent_w = resw; - sd->ent_h = resh; + efl_event_freeze(obj); + EFL_UI_TEXT_DATA_GET(obj, sd); - evas_event_freeze(evas_object_evas_get(obj)); + sw = edje_object_part_swallow_get(sd->entry_edje, "elm.text"); if (sd->scroll) { - Evas_Coord vw, vh; - Evas_Coord tw, th; + Evas_Coord vw = 0, vh = 0; + elm_interface_scrollable_content_viewport_geometry_get(obj, NULL, NULL, &vw, &vh); - efl_gfx_size_set(sd->entry_edje, vw, vh); - efl_gfx_size_get(sw, &tw, &th); - efl_canvas_text_size_formatted_get(sw, &fw, &fh); - evas_object_size_hint_min_set(sw, fw, fh); + evas_object_size_hint_min_set(sw, tw, th); edje_object_size_min_calc(sd->entry_edje, &minw, &minh); evas_object_size_hint_min_set(sw, -1, -1); @@ -1112,20 +1098,84 @@ _efl_ui_text_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Text_Data *sd) } else { - efl_canvas_text_size_formatted_get(sw, &fw, &fh); - evas_object_size_hint_min_set(sw, fw, fh); + Eina_Bool wrap; + + wrap = efl_text_wrap_get(sw); + evas_object_size_hint_min_set(sw, tw, th); edje_object_size_min_calc(sd->entry_edje, &minw, &minh); evas_object_size_hint_min_set(sw, -1, -1); if (wrap == EFL_TEXT_FORMAT_WRAP_NONE) { + _decoration_defer_all(obj); + efl_event_thaw(obj); evas_object_size_hint_min_set(obj, minw, minh); + return; } } - evas_event_thaw(evas_object_evas_get(obj)); - evas_event_thaw_eval(evas_object_evas_get(obj)); + _decoration_defer_all(obj); + efl_event_thaw(obj); +} + +typedef struct _Layout_Ctx Layout_Ctx; +struct _Layout_Ctx +{ + Eo *obj; +}; + +static Eina_Value +_on_layout_complete(void *data, const Eina_Value v) +{ + Layout_Ctx *c = data; + Eina_Rectangle r; + eina_value_pget(&v, &r); + _layout_text_sizing_eval(c->obj, 1, 1); + free(c); + return v; +} + +EOLIAN static void +_efl_ui_text_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Text_Data *sd) +{ + Evas_Coord resw, resh; + Eo *sw; + Eina_Bool can_async; + + evas_object_geometry_get(obj, NULL, NULL, &resw, &resh); + + sw = edje_object_part_swallow_get(sd->entry_edje, "elm.text"); + if (!sw) return; - if (!sd->deferred_decoration_cursor) + if (!sd->changed && (resw == sd->ent_w) && (resh == sd->ent_h)) return; + + sd->changed = EINA_FALSE; + sd->ent_w = resw; + sd->ent_h = resh; + + can_async = !sd->editable && sd->async.enabled; + + efl_event_freeze(obj); + if (sd->scroll) + { + Evas_Coord vw = 0, vh = 0; + elm_interface_scrollable_content_viewport_geometry_get(obj, NULL, NULL, &vw, &vh); + efl_gfx_size_set(sd->entry_edje, vw, vh); + } + if (can_async) + { + Eina_Future *f; + Layout_Ctx *c = calloc(1, sizeof(*c)); + c->obj = obj; + efl_event_thaw(obj); + f = efl_canvas_text_async_layout(sw); + eina_future_then_easy(f, _on_layout_complete, NULL, NULL, NULL, c); + } + else { + /* Don't defer - complete the sizing evaluation now */ + Evas_Coord fw, fh; + efl_canvas_text_size_formatted_get(obj, &fw, &fh); + efl_event_thaw(obj); + _layout_text_sizing_eval(obj, fw, fh); sd->deferred_decoration_cursor = EINA_TRUE; _decoration_defer(obj); } @@ -2088,7 +2138,7 @@ _entry_changed_handle(void *data, single_line = !efl_text_multiline_get(obj); - evas_event_freeze(evas_object_evas_get(data)); + efl_event_freeze(obj); sd->changed = EINA_TRUE; /* Reset the size hints which are no more relevant. Keep the * height, this is a hack, but doesn't really matter cause we'll @@ -2105,8 +2155,7 @@ _entry_changed_handle(void *data, elm_layout_sizing_eval(data); ELM_SAFE_FREE(sd->text, eina_stringshare_del); ELM_SAFE_FREE(sd->delay_write, ecore_timer_del); - evas_event_thaw(evas_object_evas_get(data)); - evas_event_thaw_eval(evas_object_evas_get(data)); + efl_event_thaw(obj); if ((sd->auto_save) && (sd->file)) sd->delay_write = ecore_timer_add(EFL_UI_TEXT_DELAY_WRITE_TIME, _delay_write, data); @@ -2213,11 +2262,8 @@ _entry_cursor_changed_signal_cb(void *data, edje_object_signal_emit(sd->entry_edje, "elm,action,hide,cursor", "elm"); } - if (!sd->deferred_decoration_cursor) - { - sd->deferred_decoration_cursor = EINA_TRUE; - _decoration_defer(obj); - } + 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); @@ -2962,8 +3008,18 @@ _efl_ui_text_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Text_Data *priv) /* XXX: needs to be before efl_canvas_group_add, since the latter will * trigger a layout_sizing_eval call and requires the canvas text object to * be instantiated. */ - text_obj = efl_add(EFL_UI_INTERNAL_TEXT_INTERACTIVE_CLASS, obj); + if (priv->async.enabled) + { + text_obj = efl_add(EFL_UI_INTERNAL_TEXT_INTERACTIVE_CLASS, obj, + efl_canvas_text_async_set(efl_added, EINA_TRUE)); + } + else + { + text_obj = efl_add(EFL_UI_INTERNAL_TEXT_INTERACTIVE_CLASS, obj); + } + efl_composite_attach(obj, text_obj); + priv->text_obj = text_obj; // FIXME: use the theme, when a proper theming option is available // (possibly, text_classes). @@ -2974,7 +3030,6 @@ _efl_ui_text_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Text_Data *priv) efl_canvas_group_add(efl_super(obj, MY_CLASS)); elm_widget_sub_object_parent_add(obj); - priv->test_bit = EINA_TRUE; priv->entry_edje = wd->resize_obj; priv->cnp_mode = ELM_CNP_MODE_PLAINTEXT; @@ -3012,6 +3067,15 @@ _efl_ui_text_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Text_Data *priv) evas_object_event_callback_add(priv->entry_edje, EVAS_CALLBACK_MOVE, _efl_ui_text_move_cb, obj); + /* Async layout */ + if (priv->async.enabled) + { +#if 0 + efl_event_callback_add(text_obj, + EFL_CANVAS_TEXT_EVENT_ASYNC_LAYOUT_COMPLETE, + _on_layout_complete, obj); +#endif + } priv->hit_rect = evas_object_rectangle_add(evas_object_evas_get(obj)); evas_object_data_set(priv->hit_rect, "_elm_leaveme", obj); @@ -3106,7 +3170,7 @@ _efl_ui_text_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Text_Data *priv) edje_object_part_text_select_allow_set (priv->entry_edje, "elm.text", EINA_TRUE); - elm_layout_sizing_eval(obj); + //elm_layout_sizing_eval(obj); efl_ui_text_input_panel_layout_set(obj, ELM_INPUT_PANEL_LAYOUT_NORMAL); efl_ui_text_input_panel_enabled_set(obj, EINA_TRUE); @@ -3189,7 +3253,7 @@ _efl_ui_text_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Text_Data *sd) _efl_ui_text_anchor_hover_end(obj, sd); _efl_ui_text_anchor_hover_parent_set(obj, sd, NULL); - evas_event_freeze(evas_object_evas_get(obj)); + efl_event_freeze(obj); eina_stringshare_del(sd->file); @@ -3204,7 +3268,6 @@ _efl_ui_text_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Text_Data *sd) entries = eina_list_remove(entries, obj); eina_stringshare_del(sd->cut_sel); eina_stringshare_del(sd->text); - ecore_job_del(sd->deferred_recalc_job); ecore_job_del(sd->deferred_decoration_job); if (sd->append_text_idler) { @@ -3232,8 +3295,7 @@ _efl_ui_text_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Text_Data *sd) free(sd->input_panel_imdata); eina_stringshare_del(sd->anchor_hover.hover_style); - evas_event_thaw(evas_object_evas_get(obj)); - evas_event_thaw_eval(evas_object_evas_get(obj)); + efl_event_thaw(obj); if (sd->start_handler) { @@ -3333,7 +3395,7 @@ _cb_deleted(void *data EINA_UNUSED, const Efl_Event *ev) } EOLIAN static Eo * -_efl_ui_text_efl_object_constructor(Eo *obj, Efl_Ui_Text_Data *_pd EINA_UNUSED) +_efl_ui_text_efl_object_constructor(Eo *obj, Efl_Ui_Text_Data *pd EINA_UNUSED) { obj = efl_constructor(efl_super(obj, MY_CLASS)); efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY); @@ -3350,6 +3412,7 @@ EOLIAN static void _efl_ui_text_efl_object_destructor(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *pd) { ecore_job_del(pd->deferred_decoration_job); + pd->deferred_decoration_job = NULL; efl_destructor(efl_super(obj, MY_CLASS)); } @@ -5260,18 +5323,19 @@ static void _deferred_decoration_job(void *data) { EFL_UI_TEXT_DATA_GET(data, sd); - - sd->deferred_decoration_job = NULL; _update_decorations(data); + sd->deferred_decoration_job = NULL; } static void _decoration_defer(Eo *obj) { EFL_UI_TEXT_DATA_GET(obj, sd); - ecore_job_del(sd->deferred_decoration_job); - sd->deferred_decoration_job = - ecore_job_add(_deferred_decoration_job, obj); + if (!sd->deferred_decoration_job) + { + sd->deferred_decoration_job = + ecore_job_add(_deferred_decoration_job, obj); + } } static void @@ -5296,11 +5360,8 @@ _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; - if (!sd->deferred_decoration_cursor) - { - sd->deferred_decoration_cursor = EINA_TRUE; - _decoration_defer(data); - } + sd->deferred_decoration_cursor = EINA_TRUE; + _decoration_defer(data); } static void @@ -5358,13 +5419,40 @@ ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) #define EFL_UI_TEXT_EXTRA_OPS \ EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_ui_text), \ ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_text), \ - ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX) + ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \ #include "efl_ui_text.eo.c" +EOLIAN static Eo * +_efl_ui_text_async_efl_object_constructor(Eo *obj, void *_pd EINA_UNUSED) +{ + obj = efl_constructor(efl_super(obj, EFL_UI_TEXT_ASYNC_CLASS)); + return obj; +} + +EOLIAN static void +_efl_ui_text_async_efl_canvas_group_group_add(Eo *obj, void *_pd EINA_UNUSED) +{ + EFL_UI_TEXT_DATA_GET(obj, sd); + sd->async.enabled = EINA_TRUE; + efl_canvas_group_add(efl_super(obj, EFL_UI_TEXT_ASYNC_CLASS)); +} + +EOLIAN static void +_efl_ui_text_async_efl_canvas_group_group_del(Eo *obj, void *_pd EINA_UNUSED) +{ + efl_canvas_group_del(efl_super(obj, EFL_UI_TEXT_ASYNC_CLASS)); +} + +#define EFL_UI_TEXT_ASYNC_EXTRA_OPS \ + EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_ui_text_async) + +#include "efl_ui_text_async.eo.c" + #undef MY_CLASS #define MY_CLASS EFL_UI_TEXT_EDITABLE_CLASS + EOLIAN static Eo * _efl_ui_text_editable_efl_object_constructor(Eo *obj, void *_pd EINA_UNUSED) { |