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-20 14:50:09 +0300 |
commit | 1a854d892f83b6933d3523cf7d188215600df04d (patch) | |
tree | afee3acd4ae1824518cc11f49ae9098c70968c0a | |
parent | b63c3620dff8930f4ad029351c6d455414062c02 (diff) |
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 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 | 2 | ||||
-rw-r--r-- | src/bin/elementary/test_efl_ui_text.c | 49 | ||||
-rw-r--r-- | src/lib/elementary/Elementary.h | 1 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_text.c | 207 | ||||
-rw-r--r-- | src/lib/elementary/efl_ui_text_async.eo | 11 |
6 files changed, 206 insertions, 65 deletions
diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am index 119668dcd6..a7f28742dd 100644 --- a/src/Makefile_Elementary.am +++ b/src/Makefile_Elementary.am | |||
@@ -124,6 +124,7 @@ elm_public_eolian_files = \ | |||
124 | lib/elementary/efl_ui_text_interactive.eo \ | 124 | lib/elementary/efl_ui_text_interactive.eo \ |
125 | lib/elementary/efl_ui_text.eo \ | 125 | lib/elementary/efl_ui_text.eo \ |
126 | lib/elementary/efl_ui_text_editable.eo \ | 126 | lib/elementary/efl_ui_text_editable.eo \ |
127 | lib/elementary/efl_ui_text_async.eo \ | ||
127 | lib/elementary/efl_config_global.eo \ | 128 | lib/elementary/efl_config_global.eo \ |
128 | lib/elementary/efl_ui_clock.eo \ | 129 | lib/elementary/efl_ui_clock.eo \ |
129 | lib/elementary/efl_ui_cursor.eo \ | 130 | lib/elementary/efl_ui_cursor.eo \ |
diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c index 87bd979330..8220261035 100644 --- a/src/bin/elementary/test.c +++ b/src/bin/elementary/test.c | |||
@@ -313,6 +313,7 @@ void test_code_diff_inline(void *data, Evas_Object *obj, void *event_info); | |||
313 | 313 | ||
314 | void test_efl_ui_text(void *data, Evas_Object *obj, void *event_info); | 314 | void test_efl_ui_text(void *data, Evas_Object *obj, void *event_info); |
315 | void test_efl_ui_text_label(void *data, Evas_Object *obj, void *event_info); | 315 | void test_efl_ui_text_label(void *data, Evas_Object *obj, void *event_info); |
316 | void test_efl_ui_text_async(void *data, Evas_Object *obj, void *event_info); | ||
316 | void test_evas_mask(void *data, Edje_Object *obj, void *event_info); | 317 | void test_evas_mask(void *data, Edje_Object *obj, void *event_info); |
317 | void test_gfx_filters(void *data, Evas_Object *obj, void *event_info); | 318 | void test_gfx_filters(void *data, Evas_Object *obj, void *event_info); |
318 | void test_evas_snapshot(void *data, Evas_Object *obj, void *event_info); | 319 | void test_evas_snapshot(void *data, Evas_Object *obj, void *event_info); |
@@ -749,6 +750,7 @@ add_tests: | |||
749 | ADD_TEST(NULL, "Entries", "Entry Password", test_entry_password); | 750 | ADD_TEST(NULL, "Entries", "Entry Password", test_entry_password); |
750 | ADD_TEST(NULL, "Entries", "Efl UI Text", test_efl_ui_text); | 751 | ADD_TEST(NULL, "Entries", "Efl UI Text", test_efl_ui_text); |
751 | ADD_TEST(NULL, "Entries", "Efl UI Text Label", test_efl_ui_text_label); | 752 | ADD_TEST(NULL, "Entries", "Efl UI Text Label", test_efl_ui_text_label); |
753 | ADD_TEST(NULL, "Entries", "Efl UI Text Async", test_efl_ui_text_async); | ||
752 | 754 | ||
753 | //------------------------------// | 755 | //------------------------------// |
754 | ADD_TEST(NULL, "Advanced Entries", "Code Entry Markup", test_code_welcome); | 756 | 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 e7e70ed22d..3934af4b0e 100644 --- a/src/bin/elementary/test_efl_ui_text.c +++ b/src/bin/elementary/test_efl_ui_text.c | |||
@@ -255,3 +255,52 @@ test_efl_ui_text(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve | |||
255 | evas_object_resize(win, 480, 320); | 255 | evas_object_resize(win, 480, 320); |
256 | evas_object_show(win); | 256 | evas_object_show(win); |
257 | } | 257 | } |
258 | |||
259 | void | ||
260 | test_efl_ui_text_async(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) | ||
261 | { | ||
262 | Evas_Object *win, *bx, *bx2, *bx3, *en; | ||
263 | |||
264 | win = elm_win_util_standard_add("entry", "Entry"); | ||
265 | elm_win_autodel_set(win, EINA_TRUE); | ||
266 | |||
267 | bx = elm_box_add(win); | ||
268 | evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
269 | elm_win_resize_object_add(win, bx); | ||
270 | evas_object_show(bx); | ||
271 | |||
272 | en = efl_add(EFL_UI_TEXT_ASYNC_CLASS, win, | ||
273 | efl_text_wrap_set(efl_added, EFL_TEXT_FORMAT_WRAP_WORD), | ||
274 | efl_text_multiline_set(efl_added, EINA_TRUE) | ||
275 | ); | ||
276 | |||
277 | printf("Added Efl.Ui.Text object\n"); | ||
278 | efl_key_data_set(en, "wrap_idx", 0); | ||
279 | efl_text_set(en, "Hello world! Goodbye world! This is a test text for the" | ||
280 | " new UI Text widget.\xE2\x80\xA9This is the next paragraph.\nThis" | ||
281 | " is the next line.\nThis is Yet another line! Line and paragraph" | ||
282 | " separators are actually different!"); | ||
283 | efl_text_font_set(en, "Sans", 10); | ||
284 | efl_text_normal_color_set(en, 255, 255, 255, 255); | ||
285 | |||
286 | elm_box_pack_end(bx, en); | ||
287 | elm_object_focus_set(en, EINA_TRUE); | ||
288 | |||
289 | bx2 = elm_box_add(win); | ||
290 | elm_box_horizontal_set(bx2, EINA_TRUE); | ||
291 | evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); | ||
292 | evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
293 | |||
294 | bx3 = elm_box_add(win); | ||
295 | elm_box_horizontal_set(bx3, EINA_TRUE); | ||
296 | evas_object_size_hint_weight_set(bx3, EVAS_HINT_EXPAND, 0.0); | ||
297 | evas_object_size_hint_align_set(bx3, EVAS_HINT_FILL, EVAS_HINT_FILL); | ||
298 | |||
299 | elm_box_pack_end(bx, bx3); | ||
300 | elm_box_pack_end(bx, bx2); | ||
301 | evas_object_show(bx3); | ||
302 | evas_object_show(bx2); | ||
303 | |||
304 | evas_object_resize(win, 480, 320); | ||
305 | evas_object_show(win); | ||
306 | } | ||
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; | |||
276 | # include <efl_ui_text_interactive.eo.h> | 276 | # include <efl_ui_text_interactive.eo.h> |
277 | # include <efl_ui_text.eo.h> | 277 | # include <efl_ui_text.eo.h> |
278 | # include <efl_ui_text_editable.eo.h> | 278 | # include <efl_ui_text_editable.eo.h> |
279 | # include <efl_ui_text_async.eo.h> | ||
279 | # include <efl_ui_clock.eo.h> | 280 | # include <efl_ui_clock.eo.h> |
280 | # include <efl_ui_image_factory.eo.h> | 281 | # include <efl_ui_image_factory.eo.h> |
281 | #include <efl_ui_slider_interval.eo.h> | 282 | #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 da1442e835..353b39207d 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 | |||
42 | Eo *cursor_bidi; | 42 | Eo *cursor_bidi; |
43 | Evas_Object *start_handler; | 43 | Evas_Object *start_handler; |
44 | Evas_Object *end_handler; | 44 | Evas_Object *end_handler; |
45 | Ecore_Job *deferred_recalc_job; | ||
46 | Ecore_Job *deferred_decoration_job; | 45 | Ecore_Job *deferred_decoration_job; |
47 | Ecore_Timer *longpress_timer; | 46 | Ecore_Timer *longpress_timer; |
48 | Ecore_Timer *delay_write; | 47 | Ecore_Timer *delay_write; |
@@ -92,6 +91,11 @@ struct _Efl_Ui_Text_Data | |||
92 | Elm_Cnp_Mode cnp_mode; | 91 | Elm_Cnp_Mode cnp_mode; |
93 | Elm_Sel_Format drop_format; | 92 | Elm_Sel_Format drop_format; |
94 | 93 | ||
94 | struct { | ||
95 | char *text; | ||
96 | Eina_Bool enabled; | ||
97 | } async; | ||
98 | |||
95 | Eina_Bool input_panel_return_key_disabled : 1; | 99 | Eina_Bool input_panel_return_key_disabled : 1; |
96 | Eina_Bool drag_selection_asked : 1; | 100 | Eina_Bool drag_selection_asked : 1; |
97 | Eina_Bool sel_handler_disabled : 1; | 101 | Eina_Bool sel_handler_disabled : 1; |
@@ -127,7 +131,6 @@ struct _Efl_Ui_Text_Data | |||
127 | Eina_Bool scroll : 1; | 131 | Eina_Bool scroll : 1; |
128 | Eina_Bool input_panel_show_on_demand : 1; | 132 | Eina_Bool input_panel_show_on_demand : 1; |
129 | Eina_Bool anchors_updated : 1; | 133 | Eina_Bool anchors_updated : 1; |
130 | Eina_Bool test_bit : 1; | ||
131 | }; | 134 | }; |
132 | 135 | ||
133 | struct _Anchor | 136 | struct _Anchor |
@@ -916,7 +919,7 @@ _efl_ui_text_elm_widget_theme_apply(Eo *obj, Efl_Ui_Text_Data *sd) | |||
916 | theme_apply = elm_obj_widget_theme_apply(efl_cast(obj, ELM_WIDGET_CLASS)); | 919 | theme_apply = elm_obj_widget_theme_apply(efl_cast(obj, ELM_WIDGET_CLASS)); |
917 | if (!theme_apply) return EFL_UI_THEME_APPLY_FAILED; | 920 | if (!theme_apply) return EFL_UI_THEME_APPLY_FAILED; |
918 | 921 | ||
919 | evas_event_freeze(evas_object_evas_get(obj)); | 922 | efl_event_freeze(obj); |
920 | 923 | ||
921 | edje_object_mirrored_set | 924 | edje_object_mirrored_set |
922 | (wd->resize_obj, efl_ui_mirrored_get(obj)); | 925 | (wd->resize_obj, efl_ui_mirrored_get(obj)); |
@@ -1010,12 +1013,10 @@ _efl_ui_text_elm_widget_theme_apply(Eo *obj, Efl_Ui_Text_Data *sd) | |||
1010 | } | 1013 | } |
1011 | 1014 | ||
1012 | sd->changed = EINA_TRUE; | 1015 | sd->changed = EINA_TRUE; |
1013 | elm_layout_sizing_eval(obj); | ||
1014 | 1016 | ||
1015 | sd->has_text = !sd->has_text; | 1017 | sd->has_text = !sd->has_text; |
1016 | _efl_ui_text_guide_update(obj, !sd->has_text); | 1018 | _efl_ui_text_guide_update(obj, !sd->has_text); |
1017 | evas_event_thaw(evas_object_evas_get(obj)); | 1019 | efl_event_thaw(obj); |
1018 | evas_event_thaw_eval(evas_object_evas_get(obj)); | ||
1019 | 1020 | ||
1020 | efl_event_callback_legacy_call(obj, EFL_UI_LAYOUT_EVENT_THEME_CHANGED, NULL); | 1021 | efl_event_callback_legacy_call(obj, EFL_UI_LAYOUT_EVENT_THEME_CHANGED, NULL); |
1021 | 1022 | ||
@@ -1029,12 +1030,12 @@ _cursor_geometry_recalc(Evas_Object *obj) | |||
1029 | { | 1030 | { |
1030 | EFL_UI_TEXT_DATA_GET(obj, sd); | 1031 | EFL_UI_TEXT_DATA_GET(obj, sd); |
1031 | 1032 | ||
1032 | efl_event_callback_legacy_call(obj, EFL_UI_TEXT_EVENT_CURSOR_CHANGED, NULL); | ||
1033 | |||
1034 | Evas_Coord x, y, w, h; | 1033 | Evas_Coord x, y, w, h; |
1035 | Evas_Coord x2, y2, w2, h2; | 1034 | Evas_Coord x2, y2, w2, h2; |
1036 | Evas_Coord cx, cy, cw, ch; | 1035 | Evas_Coord cx, cy, cw, ch; |
1037 | 1036 | ||
1037 | if (!sd->editable) return; | ||
1038 | |||
1038 | cx = cy = cw = ch = 0; | 1039 | cx = cy = cw = ch = 0; |
1039 | x2 = y2 = w2 = h2 = 0; | 1040 | x2 = y2 = w2 = h2 = 0; |
1040 | x = y = w = h = 0; | 1041 | x = y = w = h = 0; |
@@ -1058,37 +1059,22 @@ _cursor_geometry_recalc(Evas_Object *obj) | |||
1058 | elm_widget_show_region_set(obj, EINA_RECT(cx, cy, cw, ch), EINA_FALSE); | 1059 | elm_widget_show_region_set(obj, EINA_RECT(cx, cy, cw, ch), EINA_FALSE); |
1059 | } | 1060 | } |
1060 | 1061 | ||
1061 | EOLIAN static void | 1062 | static void |
1062 | _efl_ui_text_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Text_Data *sd) | 1063 | _layout_text_sizing_eval(Eo *obj, Evas_Coord tw, Evas_Coord th) |
1063 | { | 1064 | { |
1064 | Evas_Coord minw, minh, resw, resh; | ||
1065 | Evas_Coord fw, fh; | ||
1066 | Eo *sw; | 1065 | Eo *sw; |
1067 | Eina_Bool wrap; | 1066 | Evas_Coord minw, minh; |
1068 | |||
1069 | evas_object_geometry_get(obj, NULL, NULL, &resw, &resh); | ||
1070 | |||
1071 | sw = edje_object_part_swallow_get(sd->entry_edje, "elm.text"); | ||
1072 | if (!sw) return; | ||
1073 | 1067 | ||
1074 | wrap = efl_text_wrap_get(sw); | 1068 | efl_event_freeze(obj); |
1075 | |||
1076 | if (!sd->changed && (resw == sd->ent_w) && (resh == sd->ent_h)) return; | ||
1077 | |||
1078 | sd->changed = EINA_FALSE; | ||
1079 | sd->ent_w = resw; | ||
1080 | sd->ent_h = resh; | ||
1081 | 1069 | ||
1070 | EFL_UI_TEXT_DATA_GET(obj, sd); | ||
1082 | 1071 | ||
1083 | evas_event_freeze(evas_object_evas_get(obj)); | 1072 | sw = edje_object_part_swallow_get(sd->entry_edje, "elm.text"); |
1084 | if (sd->scroll) | 1073 | if (sd->scroll) |
1085 | { | 1074 | { |
1086 | Evas_Coord vw, vh; | 1075 | Evas_Coord vw = 0, vh = 0; |
1087 | elm_interface_scrollable_content_viewport_geometry_get(obj, NULL, NULL, &vw, &vh); | 1076 | elm_interface_scrollable_content_viewport_geometry_get(obj, NULL, NULL, &vw, &vh); |
1088 | efl_gfx_size_set(sd->entry_edje, EINA_SIZE2D(vw, vh)); | 1077 | evas_object_size_hint_min_set(sw, tw, th); |
1089 | //efl_gfx_size_get(sw, &tw, &th); //unused? | ||
1090 | efl_canvas_text_size_formatted_get(sw, &fw, &fh); | ||
1091 | evas_object_size_hint_min_set(sw, fw, fh); | ||
1092 | edje_object_size_min_calc(sd->entry_edje, &minw, &minh); | 1078 | edje_object_size_min_calc(sd->entry_edje, &minw, &minh); |
1093 | evas_object_size_hint_min_set(sw, -1, -1); | 1079 | evas_object_size_hint_min_set(sw, -1, -1); |
1094 | 1080 | ||
@@ -1102,20 +1088,84 @@ _efl_ui_text_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Text_Data *sd) | |||
1102 | } | 1088 | } |
1103 | else | 1089 | else |
1104 | { | 1090 | { |
1105 | efl_canvas_text_size_formatted_get(sw, &fw, &fh); | 1091 | Eina_Bool wrap; |
1106 | evas_object_size_hint_min_set(sw, fw, fh); | 1092 | |
1093 | wrap = efl_text_wrap_get(sw); | ||
1094 | evas_object_size_hint_min_set(sw, tw, th); | ||
1107 | edje_object_size_min_calc(sd->entry_edje, &minw, &minh); | 1095 | edje_object_size_min_calc(sd->entry_edje, &minw, &minh); |
1108 | evas_object_size_hint_min_set(sw, -1, -1); | 1096 | evas_object_size_hint_min_set(sw, -1, -1); |
1109 | if (wrap == EFL_TEXT_FORMAT_WRAP_NONE) | 1097 | if (wrap == EFL_TEXT_FORMAT_WRAP_NONE) |
1110 | { | 1098 | { |
1099 | _decoration_defer_all(obj); | ||
1100 | efl_event_thaw(obj); | ||
1111 | evas_object_size_hint_min_set(obj, minw, minh); | 1101 | evas_object_size_hint_min_set(obj, minw, minh); |
1102 | return; | ||
1112 | } | 1103 | } |
1113 | } | 1104 | } |
1114 | evas_event_thaw(evas_object_evas_get(obj)); | 1105 | _decoration_defer_all(obj); |
1115 | evas_event_thaw_eval(evas_object_evas_get(obj)); | 1106 | efl_event_thaw(obj); |
1107 | } | ||
1108 | |||
1109 | typedef struct _Layout_Ctx Layout_Ctx; | ||
1110 | struct _Layout_Ctx | ||
1111 | { | ||
1112 | Eo *obj; | ||
1113 | }; | ||
1114 | |||
1115 | static Eina_Value | ||
1116 | _on_layout_complete(void *data, const Eina_Value v) | ||
1117 | { | ||
1118 | Layout_Ctx *c = data; | ||
1119 | Eina_Rectangle r; | ||
1120 | eina_value_pget(&v, &r); | ||
1121 | _layout_text_sizing_eval(c->obj, 1, 1); | ||
1122 | free(c); | ||
1123 | return v; | ||
1124 | } | ||
1125 | |||
1126 | EOLIAN static void | ||
1127 | _efl_ui_text_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Text_Data *sd) | ||
1128 | { | ||
1129 | Evas_Coord resw, resh; | ||
1130 | Eo *sw; | ||
1131 | Eina_Bool can_async; | ||
1132 | |||
1133 | evas_object_geometry_get(obj, NULL, NULL, &resw, &resh); | ||
1134 | |||
1135 | sw = edje_object_part_swallow_get(sd->entry_edje, "elm.text"); | ||
1136 | if (!sw) return; | ||
1137 | |||
1138 | if (!sd->changed && (resw == sd->ent_w) && (resh == sd->ent_h)) return; | ||
1139 | |||
1140 | sd->changed = EINA_FALSE; | ||
1141 | sd->ent_w = resw; | ||
1142 | sd->ent_h = resh; | ||
1143 | |||
1144 | can_async = !sd->editable && sd->async.enabled; | ||
1116 | 1145 | ||
1117 | if (!sd->deferred_decoration_cursor) | 1146 | efl_event_freeze(obj); |
1147 | if (sd->scroll) | ||
1148 | { | ||
1149 | Evas_Coord vw = 0, vh = 0; | ||
1150 | elm_interface_scrollable_content_viewport_geometry_get(obj, NULL, NULL, &vw, &vh); | ||
1151 | efl_gfx_size_set(sd->entry_edje, EINA_SIZE2D(vw, vh)); | ||
1152 | } | ||
1153 | if (can_async) | ||
1154 | { | ||
1155 | Eina_Future *f; | ||
1156 | Layout_Ctx *c = calloc(1, sizeof(*c)); | ||
1157 | c->obj = obj; | ||
1158 | efl_event_thaw(obj); | ||
1159 | f = efl_canvas_text_async_layout(sw); | ||
1160 | eina_future_then_easy(f, _on_layout_complete, NULL, NULL, NULL, c); | ||
1161 | } | ||
1162 | else | ||
1118 | { | 1163 | { |
1164 | /* Don't defer - complete the sizing evaluation now */ | ||
1165 | Evas_Coord fw, fh; | ||
1166 | efl_canvas_text_size_formatted_get(obj, &fw, &fh); | ||
1167 | efl_event_thaw(obj); | ||
1168 | _layout_text_sizing_eval(obj, fw, fh); | ||
1119 | sd->deferred_decoration_cursor = EINA_TRUE; | 1169 | sd->deferred_decoration_cursor = EINA_TRUE; |
1120 | _decoration_defer(obj); | 1170 | _decoration_defer(obj); |
1121 | } | 1171 | } |
@@ -2078,7 +2128,7 @@ _entry_changed_handle(void *data, | |||
2078 | 2128 | ||
2079 | single_line = !efl_text_multiline_get(obj); | 2129 | single_line = !efl_text_multiline_get(obj); |
2080 | 2130 | ||
2081 | evas_event_freeze(evas_object_evas_get(data)); | 2131 | efl_event_freeze(obj); |
2082 | sd->changed = EINA_TRUE; | 2132 | sd->changed = EINA_TRUE; |
2083 | /* Reset the size hints which are no more relevant. Keep the | 2133 | /* Reset the size hints which are no more relevant. Keep the |
2084 | * height, this is a hack, but doesn't really matter cause we'll | 2134 | * height, this is a hack, but doesn't really matter cause we'll |
@@ -2095,8 +2145,7 @@ _entry_changed_handle(void *data, | |||
2095 | elm_layout_sizing_eval(data); | 2145 | elm_layout_sizing_eval(data); |
2096 | ELM_SAFE_FREE(sd->text, eina_stringshare_del); | 2146 | ELM_SAFE_FREE(sd->text, eina_stringshare_del); |
2097 | ELM_SAFE_FREE(sd->delay_write, ecore_timer_del); | 2147 | ELM_SAFE_FREE(sd->delay_write, ecore_timer_del); |
2098 | evas_event_thaw(evas_object_evas_get(data)); | 2148 | efl_event_thaw(obj); |
2099 | evas_event_thaw_eval(evas_object_evas_get(data)); | ||
2100 | if ((sd->auto_save) && (sd->file)) | 2149 | if ((sd->auto_save) && (sd->file)) |
2101 | sd->delay_write = ecore_timer_add(EFL_UI_TEXT_DELAY_WRITE_TIME, | 2150 | sd->delay_write = ecore_timer_add(EFL_UI_TEXT_DELAY_WRITE_TIME, |
2102 | _delay_write, data); | 2151 | _delay_write, data); |
@@ -2203,11 +2252,8 @@ _entry_cursor_changed_signal_cb(void *data, | |||
2203 | edje_object_signal_emit(sd->entry_edje, "elm,action,hide,cursor", "elm"); | 2252 | edje_object_signal_emit(sd->entry_edje, "elm,action,hide,cursor", "elm"); |
2204 | } | 2253 | } |
2205 | 2254 | ||
2206 | if (!sd->deferred_decoration_cursor) | 2255 | sd->deferred_decoration_cursor = EINA_TRUE; |
2207 | { | 2256 | _decoration_defer(obj); |
2208 | sd->deferred_decoration_cursor = EINA_TRUE; | ||
2209 | _decoration_defer(obj); | ||
2210 | } | ||
2211 | 2257 | ||
2212 | if (_elm_config->atspi_mode) | 2258 | if (_elm_config->atspi_mode) |
2213 | elm_interface_atspi_accessible_event_emit(ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN, data, ELM_INTERFACE_ATSPI_TEXT_EVENT_ACCESS_TEXT_CARET_MOVED, NULL); | 2259 | elm_interface_atspi_accessible_event_emit(ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN, data, ELM_INTERFACE_ATSPI_TEXT_EVENT_ACCESS_TEXT_CARET_MOVED, NULL); |
@@ -2949,11 +2995,10 @@ _efl_ui_text_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Text_Data *priv) | |||
2949 | 2995 | ||
2950 | ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); | 2996 | ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); |
2951 | 2997 | ||
2952 | /* XXX: needs to be before efl_canvas_group_add, since the latter will | ||
2953 | * trigger a layout_sizing_eval call and requires the canvas text object to | ||
2954 | * be instantiated. */ | ||
2955 | text_obj = efl_add(EFL_UI_INTERNAL_TEXT_INTERACTIVE_CLASS, obj); | 2998 | text_obj = efl_add(EFL_UI_INTERNAL_TEXT_INTERACTIVE_CLASS, obj); |
2999 | |||
2956 | efl_composite_attach(obj, text_obj); | 3000 | efl_composite_attach(obj, text_obj); |
3001 | priv->text_obj = text_obj; | ||
2957 | 3002 | ||
2958 | // FIXME: use the theme, when a proper theming option is available | 3003 | // FIXME: use the theme, when a proper theming option is available |
2959 | // (possibly, text_classes). | 3004 | // (possibly, text_classes). |
@@ -2964,7 +3009,6 @@ _efl_ui_text_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Text_Data *priv) | |||
2964 | efl_canvas_group_add(efl_super(obj, MY_CLASS)); | 3009 | efl_canvas_group_add(efl_super(obj, MY_CLASS)); |
2965 | elm_widget_sub_object_parent_add(obj); | 3010 | elm_widget_sub_object_parent_add(obj); |
2966 | 3011 | ||
2967 | priv->test_bit = EINA_TRUE; | ||
2968 | priv->entry_edje = wd->resize_obj; | 3012 | priv->entry_edje = wd->resize_obj; |
2969 | 3013 | ||
2970 | priv->cnp_mode = ELM_CNP_MODE_PLAINTEXT; | 3014 | priv->cnp_mode = ELM_CNP_MODE_PLAINTEXT; |
@@ -3002,6 +3046,15 @@ _efl_ui_text_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Text_Data *priv) | |||
3002 | evas_object_event_callback_add(priv->entry_edje, EVAS_CALLBACK_MOVE, | 3046 | evas_object_event_callback_add(priv->entry_edje, EVAS_CALLBACK_MOVE, |
3003 | _efl_ui_text_move_cb, obj); | 3047 | _efl_ui_text_move_cb, obj); |
3004 | 3048 | ||
3049 | /* Async layout */ | ||
3050 | if (priv->async.enabled) | ||
3051 | { | ||
3052 | #if 0 | ||
3053 | efl_event_callback_add(text_obj, | ||
3054 | EFL_CANVAS_TEXT_EVENT_ASYNC_LAYOUT_COMPLETE, | ||
3055 | _on_layout_complete, obj); | ||
3056 | #endif | ||
3057 | } | ||
3005 | 3058 | ||
3006 | priv->hit_rect = evas_object_rectangle_add(evas_object_evas_get(obj)); | 3059 | priv->hit_rect = evas_object_rectangle_add(evas_object_evas_get(obj)); |
3007 | evas_object_data_set(priv->hit_rect, "_elm_leaveme", obj); | 3060 | evas_object_data_set(priv->hit_rect, "_elm_leaveme", obj); |
@@ -3096,7 +3149,7 @@ _efl_ui_text_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Text_Data *priv) | |||
3096 | edje_object_part_text_select_allow_set | 3149 | edje_object_part_text_select_allow_set |
3097 | (priv->entry_edje, "elm.text", EINA_TRUE); | 3150 | (priv->entry_edje, "elm.text", EINA_TRUE); |
3098 | 3151 | ||
3099 | elm_layout_sizing_eval(obj); | 3152 | //elm_layout_sizing_eval(obj); |
3100 | 3153 | ||
3101 | efl_ui_text_input_panel_layout_set(obj, ELM_INPUT_PANEL_LAYOUT_NORMAL); | 3154 | efl_ui_text_input_panel_layout_set(obj, ELM_INPUT_PANEL_LAYOUT_NORMAL); |
3102 | efl_ui_text_input_panel_enabled_set(obj, EINA_TRUE); | 3155 | efl_ui_text_input_panel_enabled_set(obj, EINA_TRUE); |
@@ -3179,7 +3232,7 @@ _efl_ui_text_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Text_Data *sd) | |||
3179 | _efl_ui_text_anchor_hover_end(obj, sd); | 3232 | _efl_ui_text_anchor_hover_end(obj, sd); |
3180 | _efl_ui_text_anchor_hover_parent_set(obj, sd, NULL); | 3233 | _efl_ui_text_anchor_hover_parent_set(obj, sd, NULL); |
3181 | 3234 | ||
3182 | evas_event_freeze(evas_object_evas_get(obj)); | 3235 | efl_event_freeze(obj); |
3183 | 3236 | ||
3184 | eina_stringshare_del(sd->file); | 3237 | eina_stringshare_del(sd->file); |
3185 | 3238 | ||
@@ -3194,7 +3247,6 @@ _efl_ui_text_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Text_Data *sd) | |||
3194 | entries = eina_list_remove(entries, obj); | 3247 | entries = eina_list_remove(entries, obj); |
3195 | eina_stringshare_del(sd->cut_sel); | 3248 | eina_stringshare_del(sd->cut_sel); |
3196 | eina_stringshare_del(sd->text); | 3249 | eina_stringshare_del(sd->text); |
3197 | ecore_job_del(sd->deferred_recalc_job); | ||
3198 | ecore_job_del(sd->deferred_decoration_job); | 3250 | ecore_job_del(sd->deferred_decoration_job); |
3199 | if (sd->append_text_idler) | 3251 | if (sd->append_text_idler) |
3200 | { | 3252 | { |
@@ -3222,8 +3274,7 @@ _efl_ui_text_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Text_Data *sd) | |||
3222 | free(sd->input_panel_imdata); | 3274 | free(sd->input_panel_imdata); |
3223 | eina_stringshare_del(sd->anchor_hover.hover_style); | 3275 | eina_stringshare_del(sd->anchor_hover.hover_style); |
3224 | 3276 | ||
3225 | evas_event_thaw(evas_object_evas_get(obj)); | 3277 | efl_event_thaw(obj); |
3226 | evas_event_thaw_eval(evas_object_evas_get(obj)); | ||
3227 | 3278 | ||
3228 | if (sd->start_handler) | 3279 | if (sd->start_handler) |
3229 | { | 3280 | { |
@@ -3322,7 +3373,7 @@ _cb_deleted(void *data EINA_UNUSED, const Efl_Event *ev) | |||
3322 | } | 3373 | } |
3323 | 3374 | ||
3324 | EOLIAN static Eo * | 3375 | EOLIAN static Eo * |
3325 | _efl_ui_text_efl_object_constructor(Eo *obj, Efl_Ui_Text_Data *_pd EINA_UNUSED) | 3376 | _efl_ui_text_efl_object_constructor(Eo *obj, Efl_Ui_Text_Data *pd EINA_UNUSED) |
3326 | { | 3377 | { |
3327 | obj = efl_constructor(efl_super(obj, MY_CLASS)); | 3378 | obj = efl_constructor(efl_super(obj, MY_CLASS)); |
3328 | efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY); | 3379 | efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY); |
@@ -3339,6 +3390,7 @@ EOLIAN static void | |||
3339 | _efl_ui_text_efl_object_destructor(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *pd) | 3390 | _efl_ui_text_efl_object_destructor(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *pd) |
3340 | { | 3391 | { |
3341 | ecore_job_del(pd->deferred_decoration_job); | 3392 | ecore_job_del(pd->deferred_decoration_job); |
3393 | pd->deferred_decoration_job = NULL; | ||
3342 | efl_destructor(efl_super(obj, MY_CLASS)); | 3394 | efl_destructor(efl_super(obj, MY_CLASS)); |
3343 | } | 3395 | } |
3344 | 3396 | ||
@@ -5255,18 +5307,19 @@ static void | |||
5255 | _deferred_decoration_job(void *data) | 5307 | _deferred_decoration_job(void *data) |
5256 | { | 5308 | { |
5257 | EFL_UI_TEXT_DATA_GET(data, sd); | 5309 | EFL_UI_TEXT_DATA_GET(data, sd); |
5258 | |||
5259 | sd->deferred_decoration_job = NULL; | ||
5260 | _update_decorations(data); | 5310 | _update_decorations(data); |
5311 | sd->deferred_decoration_job = NULL; | ||
5261 | } | 5312 | } |
5262 | 5313 | ||
5263 | static void | 5314 | static void |
5264 | _decoration_defer(Eo *obj) | 5315 | _decoration_defer(Eo *obj) |
5265 | { | 5316 | { |
5266 | EFL_UI_TEXT_DATA_GET(obj, sd); | 5317 | EFL_UI_TEXT_DATA_GET(obj, sd); |
5267 | ecore_job_del(sd->deferred_decoration_job); | 5318 | if (!sd->deferred_decoration_job) |
5268 | sd->deferred_decoration_job = | 5319 | { |
5269 | ecore_job_add(_deferred_decoration_job, obj); | 5320 | sd->deferred_decoration_job = |
5321 | ecore_job_add(_deferred_decoration_job, obj); | ||
5322 | } | ||
5270 | } | 5323 | } |
5271 | 5324 | ||
5272 | static void | 5325 | static void |
@@ -5291,11 +5344,8 @@ _efl_ui_text_cursor_changed_cb(void *data, const Efl_Event *event EINA_UNUSED) | |||
5291 | { | 5344 | { |
5292 | EFL_UI_TEXT_DATA_GET(data, sd); | 5345 | EFL_UI_TEXT_DATA_GET(data, sd); |
5293 | sd->cur_changed = EINA_TRUE; | 5346 | sd->cur_changed = EINA_TRUE; |
5294 | if (!sd->deferred_decoration_cursor) | 5347 | sd->deferred_decoration_cursor = EINA_TRUE; |
5295 | { | 5348 | _decoration_defer(data); |
5296 | sd->deferred_decoration_cursor = EINA_TRUE; | ||
5297 | _decoration_defer(data); | ||
5298 | } | ||
5299 | } | 5349 | } |
5300 | 5350 | ||
5301 | static void | 5351 | static void |
@@ -5353,13 +5403,40 @@ ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX) | |||
5353 | #define EFL_UI_TEXT_EXTRA_OPS \ | 5403 | #define EFL_UI_TEXT_EXTRA_OPS \ |
5354 | EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_ui_text), \ | 5404 | EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_ui_text), \ |
5355 | ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_text), \ | 5405 | ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_text), \ |
5356 | ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX) | 5406 | ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \ |
5357 | 5407 | ||
5358 | #include "efl_ui_text.eo.c" | 5408 | #include "efl_ui_text.eo.c" |
5359 | 5409 | ||
5410 | EOLIAN static Eo * | ||
5411 | _efl_ui_text_async_efl_object_constructor(Eo *obj, void *_pd EINA_UNUSED) | ||
5412 | { | ||
5413 | obj = efl_constructor(efl_super(obj, EFL_UI_TEXT_ASYNC_CLASS)); | ||
5414 | return obj; | ||
5415 | } | ||
5416 | |||
5417 | EOLIAN static void | ||
5418 | _efl_ui_text_async_efl_canvas_group_group_add(Eo *obj, void *_pd EINA_UNUSED) | ||
5419 | { | ||
5420 | EFL_UI_TEXT_DATA_GET(obj, sd); | ||
5421 | sd->async.enabled = EINA_TRUE; | ||
5422 | efl_canvas_group_add(efl_super(obj, EFL_UI_TEXT_ASYNC_CLASS)); | ||
5423 | } | ||
5424 | |||
5425 | EOLIAN static void | ||
5426 | _efl_ui_text_async_efl_canvas_group_group_del(Eo *obj, void *_pd EINA_UNUSED) | ||
5427 | { | ||
5428 | efl_canvas_group_del(efl_super(obj, EFL_UI_TEXT_ASYNC_CLASS)); | ||
5429 | } | ||
5430 | |||
5431 | #define EFL_UI_TEXT_ASYNC_EXTRA_OPS \ | ||
5432 | EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_ui_text_async) | ||
5433 | |||
5434 | #include "efl_ui_text_async.eo.c" | ||
5435 | |||
5360 | #undef MY_CLASS | 5436 | #undef MY_CLASS |
5361 | #define MY_CLASS EFL_UI_TEXT_EDITABLE_CLASS | 5437 | #define MY_CLASS EFL_UI_TEXT_EDITABLE_CLASS |
5362 | 5438 | ||
5439 | |||
5363 | EOLIAN static Eo * | 5440 | EOLIAN static Eo * |
5364 | _efl_ui_text_editable_efl_object_constructor(Eo *obj, void *_pd EINA_UNUSED) | 5441 | _efl_ui_text_editable_efl_object_constructor(Eo *obj, void *_pd EINA_UNUSED) |
5365 | { | 5442 | { |
diff --git a/src/lib/elementary/efl_ui_text_async.eo b/src/lib/elementary/efl_ui_text_async.eo new file mode 100644 index 0000000000..52061e5380 --- /dev/null +++ b/src/lib/elementary/efl_ui_text_async.eo | |||
@@ -0,0 +1,11 @@ | |||
1 | class Efl.Ui.Text_Async (Efl.Ui.Text) | ||
2 | { | ||
3 | [[Efl UI text async class | ||
4 | |||
5 | @since 1.21 | ||
6 | ]] | ||
7 | data: null; | ||
8 | implements { | ||
9 | Efl.Object.constructor; | ||
10 | } | ||
11 | } | ||