jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=315c4f761e03de99bff943cd12408db14d39cd2c
commit 315c4f761e03de99bff943cd12408db14d39cd2c Author: Jean-Philippe Andre <jp.an...@samsung.com> Date: Wed Dec 13 15:12:13 2017 +0900 text: Merge changed,user events Efl.Ui.Text and Efl.Ui.Text.Interactive were both defining it. --- src/lib/efl/interfaces/efl_text_types.eot | 12 ++++++++++++ src/lib/elementary/efl_ui_internal_text_interactive.c | 18 ++++++++---------- src/lib/elementary/efl_ui_text.c | 17 +++++++++-------- src/lib/elementary/efl_ui_text.eo | 3 ++- src/lib/elementary/efl_ui_text_interactive.eo | 13 ------------- 5 files changed, 31 insertions(+), 32 deletions(-) diff --git a/src/lib/efl/interfaces/efl_text_types.eot b/src/lib/efl/interfaces/efl_text_types.eot index d6f764023e..d3f7d204f2 100644 --- a/src/lib/efl/interfaces/efl_text_types.eot +++ b/src/lib/efl/interfaces/efl_text_types.eot @@ -7,6 +7,18 @@ enum Efl.Text.Bidirectional_Type { inherit [[Inherit text type]] } +struct Efl.Ui.Text.Change_Info { + [[This structure includes all the information about content changes. + + It's meant to be used to implement undo/redo. + ]] + content: string; [[The content added/removed]] + position: size; [[The position where it was added/removed]] + length: size; [[The length of content in characters (not bytes, actual unicode characters)]] + insert: bool; [[$true if the content was inserted, $false if removei]] + merge: bool; [[$true if can be merged with the previous one. Used for example with insertion when something is already selected]] +} + type @extern Efl.Text.Annotate.Annotation: __undefined_type; [[EFL text annotations data structure]] type @extern Efl.Text.Cursor.Cursor: __undefined_type; [[Text cursor data structure]] diff --git a/src/lib/elementary/efl_ui_internal_text_interactive.c b/src/lib/elementary/efl_ui_internal_text_interactive.c index b9e97071a0..2f8c8f859a 100644 --- a/src/lib/elementary/efl_ui_internal_text_interactive.c +++ b/src/lib/elementary/efl_ui_internal_text_interactive.c @@ -334,7 +334,7 @@ _entry_imf_event_delete_surrounding_cb(void *data, Ecore_IMF_Context *ctx EINA_U Efl_Ui_Internal_Text_Interactive_Data *en = efl_data_scope_get(obj, MY_CLASS); Ecore_IMF_Event_Delete_Surrounding *ev = event_info; Evas_Textblock_Cursor *del_start, *del_end; - Efl_Ui_Text_Interactive_Change_Info info = { NULL, 0, 0, 0, 0 }; + Efl_Ui_Text_Change_Info info = { NULL, 0, 0, 0, 0 }; int cursor_pos; int start, end; @@ -356,7 +356,7 @@ _entry_imf_event_delete_surrounding_cb(void *data, Ecore_IMF_Context *ctx EINA_U char *tmp = efl_canvas_text_range_text_get(obj, en->sel_start, en->sel_end); - efl_event_callback_legacy_call(obj, EFL_UI_TEXT_INTERACTIVE_EVENT_CHANGED_USER, &info); + efl_event_callback_legacy_call(obj, EFL_UI_TEXT_EVENT_CHANGED_USER, &info); free(tmp); @@ -585,7 +585,7 @@ _range_del_emit(Evas_Object *obj, Efl_Text_Cursor_Cursor *cur1, Efl_Text_Cursor_ { size_t start, end; char *tmp; - Efl_Ui_Text_Interactive_Change_Info info = { NULL, 0, 0, 0, 0 }; + Efl_Ui_Text_Change_Info info = { NULL, 0, 0, 0, 0 }; start = evas_textblock_cursor_pos_get(cur1); end = evas_textblock_cursor_pos_get(cur2); @@ -599,7 +599,7 @@ _range_del_emit(Evas_Object *obj, Efl_Text_Cursor_Cursor *cur1, Efl_Text_Cursor_ tmp = efl_canvas_text_range_text_get(obj, cur1, cur2); info.content = tmp; - efl_event_callback_legacy_call(obj, EFL_UI_TEXT_INTERACTIVE_EVENT_CHANGED_USER, &info); + efl_event_callback_legacy_call(obj, EFL_UI_TEXT_EVENT_CHANGED_USER, &info); if (tmp) free(tmp); @@ -616,7 +616,7 @@ _sel_range_del_emit(Evas_Object *obj, Efl_Ui_Internal_Text_Interactive_Data *en) static void _delete_emit(Eo *obj, Evas_Textblock_Cursor *c, Efl_Ui_Internal_Text_Interactive_Data *en EINA_UNUSED, size_t pos) { - Efl_Ui_Text_Interactive_Change_Info info = { NULL, 0, 0, 0, 0 }; + Efl_Ui_Text_Change_Info info = { NULL, 0, 0, 0, 0 }; Eina_Unicode content[2]; content[0] = efl_text_cursor_content_get(obj, c); content[1] = 0; @@ -630,8 +630,7 @@ _delete_emit(Eo *obj, Evas_Textblock_Cursor *c, Efl_Ui_Internal_Text_Interactive info.length = 1; info.content = tmp; - efl_event_callback_legacy_call(obj, - EFL_UI_TEXT_INTERACTIVE_EVENT_CHANGED_USER, &info); + efl_event_callback_legacy_call(obj, EFL_UI_TEXT_EVENT_CHANGED_USER, &info); if (tmp) free(tmp); evas_textblock_cursor_char_delete(c); @@ -712,7 +711,7 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void 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 }; + Efl_Ui_Text_Change_Info info = { NULL, 0, 0, 0, 0 }; if (!ev->key) return; if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; @@ -1057,8 +1056,7 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void end: if (changed_user) { - efl_event_callback_call(obj, - EFL_UI_TEXT_INTERACTIVE_EVENT_CHANGED_USER, &info); + efl_event_callback_call(obj, EFL_UI_TEXT_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 b3d2e5f155..2ee45814c3 100644 --- a/src/lib/elementary/efl_ui_text.c +++ b/src/lib/elementary/efl_ui_text.c @@ -2054,7 +2054,8 @@ _mouse_move_cb(void *data, static void _entry_changed_handle(void *data, - const Efl_Event_Description* event) + const Efl_Event_Description* event, + Efl_Ui_Text_Change_Info *info) { Evas_Coord minh; const char *text; @@ -2101,7 +2102,7 @@ _entry_changed_handle(void *data, /* callback - this could call callbacks that delete the * entry... thus... any access to sd after this could be * invalid */ - efl_event_callback_legacy_call(data, event, NULL); + efl_event_callback_legacy_call(data, event, info); } static void @@ -2149,7 +2150,7 @@ _entry_preedit_changed_signal_cb(void *data, const char *emission EINA_UNUSED, const char *source EINA_UNUSED) { - _entry_changed_handle(data, EFL_UI_TEXT_EVENT_PREEDIT_CHANGED); + _entry_changed_handle(data, EFL_UI_TEXT_EVENT_PREEDIT_CHANGED, NULL); } static void @@ -3079,7 +3080,7 @@ _efl_ui_text_efl_object_constructor(Eo *obj, Efl_Ui_Text_Data *sd) (sd->entry_edje, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set (sd->entry_edje, EVAS_HINT_FILL, EVAS_HINT_FILL); - efl_event_callback_add(text_obj, EFL_UI_TEXT_INTERACTIVE_EVENT_CHANGED_USER, + efl_event_callback_add(text_obj, EFL_UI_TEXT_EVENT_CHANGED_USER, _efl_ui_text_changed_user_cb, obj); efl_event_callback_add(text_obj, EFL_CANVAS_TEXT_EVENT_CHANGED, _efl_ui_text_changed_cb, obj); @@ -3302,7 +3303,7 @@ _efl_ui_text_efl_object_destructor(Eo *obj, Efl_Ui_Text_Data *sd) _clear_text_selection(sd); text_obj = edje_object_part_swallow_get(sd->entry_edje, "elm.text"); - efl_event_callback_del(text_obj, EFL_UI_TEXT_INTERACTIVE_EVENT_CHANGED_USER, + efl_event_callback_del(text_obj, EFL_UI_TEXT_EVENT_CHANGED_USER, _efl_ui_text_changed_user_cb, obj); efl_event_callback_del(text_obj, EFL_CANVAS_TEXT_EVENT_CHANGED, _efl_ui_text_changed_cb, obj); @@ -5238,14 +5239,14 @@ static void _efl_ui_text_changed_cb(void *data, const Efl_Event *event EINA_UNUSED) { _decoration_defer_all(data); - _entry_changed_handle(data, EFL_UI_TEXT_EVENT_CHANGED); + _entry_changed_handle(data, EFL_UI_TEXT_EVENT_CHANGED, NULL); } static void -_efl_ui_text_changed_user_cb(void *data, const Efl_Event *event EINA_UNUSED) +_efl_ui_text_changed_user_cb(void *data, const Efl_Event *event) { _decoration_defer_all(data); - _entry_changed_handle(data, EFL_UI_TEXT_EVENT_CHANGED_USER); + _entry_changed_handle(data, EFL_UI_TEXT_EVENT_CHANGED_USER, event->info); } static void diff --git a/src/lib/elementary/efl_ui_text.eo b/src/lib/elementary/efl_ui_text.eo index 54b6addf93..60cc19cfc6 100644 --- a/src/lib/elementary/efl_ui_text.eo +++ b/src/lib/elementary/efl_ui_text.eo @@ -395,7 +395,8 @@ class Efl.Ui.Text (Efl.Ui.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable, events { activated; [[Called when entry got activated]] changed; [[Called when entry changed]] - changed,user; [[Called when object changed due to user interaction]] + changed,user: Efl.Ui.Text.Change_Info; + [[The text object has changed due to user interaction]] validate; [[Called when validating]] context,open; [[Called when context menu was opened]] anchor,clicked; [[Called when anchor was clicked]] diff --git a/src/lib/elementary/efl_ui_text_interactive.eo b/src/lib/elementary/efl_ui_text_interactive.eo index f13e668857..1f19b084ea 100644 --- a/src/lib/elementary/efl_ui_text_interactive.eo +++ b/src/lib/elementary/efl_ui_text_interactive.eo @@ -1,17 +1,5 @@ import efl_text_types; -struct Efl.Ui.Text.Interactive.Change_Info { - [[This structure includes all the information about content changes. - - It's meant to be used to implement undo/redo. - ]] - content: string; [[The content added/removed]] - position: size; [[The position where it was added/removed]] - length: size; [[The length of content in characters (not bytes, actual unicode characters)]] - insert: bool; [[$true if the content was inserted, $false if removei]] - merge: bool; [[$true if can be merged with the previous one. Used for example with insertion when something is already selected]] -} - interface Efl.Ui.Text.Interactive (Efl.Text, Efl.Text.Font, Efl.Text.Format, Efl.Text.Style) { @@ -57,7 +45,6 @@ interface Efl.Ui.Text.Interactive (Efl.Text, Efl.Text.Font, } } events { - changed,user: Efl.Ui.Text.Interactive.Change_Info; [[The text object has changed due to user interaction]] selection,changed; [[The selection on the object has changed. Query using @.selection_cursors]] } } --