summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Alzyod <ali198724@gmail.com>2020-01-23 16:07:42 +0900
committerWooHyun Jung <wh0705.jung@samsung.com>2020-01-23 16:07:42 +0900
commit3d2f99af9eca265e0b166a2b9f2686e6ba3e9f83 (patch)
treea6b7ee4908f64e212e004134bd4d813e26627b5e
parent09e3972d14aaf2b61690d119660490cf9d9929a4 (diff)
efl.text.interactive: use Eina_Int_Range for selection range event
Summary: 1- add new Eina type (Eina_Int_Range). which represents int range (start, Len). 2- Use this type instead of Efl.Text_Range with selection events. Reviewers: cedric, woohyun, bu5hm4n, segfaultxavi, zmike Reviewed By: woohyun Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8570 Differential Revision: https://phab.enlightenment.org/D11128
-rw-r--r--src/lib/efl/interfaces/efl_text_types.eot7
-rw-r--r--src/lib/elementary/efl_text_interactive.eo2
-rw-r--r--src/lib/elementary/efl_ui_internal_text_interactive.c5
-rw-r--r--src/lib/elementary/elm_entry.c4
4 files changed, 4 insertions, 14 deletions
diff --git a/src/lib/efl/interfaces/efl_text_types.eot b/src/lib/efl/interfaces/efl_text_types.eot
index d32ab8d2d3..956a8085c1 100644
--- a/src/lib/efl/interfaces/efl_text_types.eot
+++ b/src/lib/efl/interfaces/efl_text_types.eot
@@ -21,10 +21,3 @@ struct @beta Efl.Text_Change_Info {
21 insertion: bool; [[$true if the content was inserted, $false if removed]] 21 insertion: bool; [[$true if the content was inserted, $false if removed]]
22 mergeable: bool; [[$true if can be merged with the previous one. Used for example with insertion when something is already selected]] 22 mergeable: bool; [[$true if can be merged with the previous one. Used for example with insertion when something is already selected]]
23} 23}
24
25struct @beta Efl.Text_Range {
26 [[This structure includes text position range (from/to).
27 ]]
28 start: int; [[The start postion.]]
29 end: int; [[The end position.]]
30}
diff --git a/src/lib/elementary/efl_text_interactive.eo b/src/lib/elementary/efl_text_interactive.eo
index 933aad0cb1..f090648bf3 100644
--- a/src/lib/elementary/efl_text_interactive.eo
+++ b/src/lib/elementary/efl_text_interactive.eo
@@ -75,7 +75,7 @@ interface @beta Efl.Text_Interactive extends Efl.Text, Efl.Text_Font_Properties,
75 event but only the last one will emit a @[.changed,user] event. 75 event but only the last one will emit a @[.changed,user] event.
76 ]] 76 ]]
77 have_selection,changed: bool; [[Emitted when the @.have_selection property value changes.]] 77 have_selection,changed: bool; [[Emitted when the @.have_selection property value changes.]]
78 selection,changed: Efl.Text_Range; [[Emitted when selection has changed. Query using @.selection_cursors.]] 78 selection,changed: Eina.Range; [[Emitted when selection has changed. Query using @.selection_cursors.]]
79 redo,request: void; [[Emitted when a redo operation is requested.]] 79 redo,request: void; [[Emitted when a redo operation is requested.]]
80 undo,request: void; [[Emitted when a undo operation is requested.]] 80 undo,request: void; [[Emitted when a undo operation is requested.]]
81 changed,user: Efl.Text_Change_Info; [[Emitted when the text content has changed due to user interaction.]] 81 changed,user: Efl.Text_Change_Info; [[Emitted when the text content has changed due to user interaction.]]
diff --git a/src/lib/elementary/efl_ui_internal_text_interactive.c b/src/lib/elementary/efl_ui_internal_text_interactive.c
index 8c39ed6287..dd9f8a41f8 100644
--- a/src/lib/elementary/efl_ui_internal_text_interactive.c
+++ b/src/lib/elementary/efl_ui_internal_text_interactive.c
@@ -796,9 +796,8 @@ _emit_sel_state( Eo *o, Efl_Ui_Internal_Text_Interactive_Data *en)
796 } 796 }
797 else 797 else
798 { 798 {
799 Efl_Text_Range range = {0}; 799 Eina_Range range = eina_range_from_to(efl_text_cursor_position_get(en->sel_start),
800 range.start = efl_text_cursor_position_get(en->sel_start); 800 efl_text_cursor_position_get(en->sel_end));
801 range.end = efl_text_cursor_position_get(en->sel_end);
802 efl_event_callback_call(o, EFL_TEXT_INTERACTIVE_EVENT_SELECTION_CHANGED, &range); 801 efl_event_callback_call(o, EFL_TEXT_INTERACTIVE_EVENT_SELECTION_CHANGED, &range);
803 } 802 }
804} 803}
diff --git a/src/lib/elementary/elm_entry.c b/src/lib/elementary/elm_entry.c
index 826e2e0c91..ab1f11544b 100644
--- a/src/lib/elementary/elm_entry.c
+++ b/src/lib/elementary/elm_entry.c
@@ -2384,10 +2384,8 @@ _entry_selection_changed_signal_cb(void *data,
2384 2384
2385 if (!sd) return; 2385 if (!sd) return;
2386 sd->have_selection = EINA_TRUE; 2386 sd->have_selection = EINA_TRUE;
2387 Efl_Text_Range range = {0};
2388 //FIXME how to get selection range in legacy !? 2387 //FIXME how to get selection range in legacy !?
2389 range.start = 0; 2388 Eina_Range range = EINA_RANGE_EMPTY();
2390 range.end = 0;
2391 efl_event_callback_legacy_call 2389 efl_event_callback_legacy_call
2392 (data, EFL_TEXT_INTERACTIVE_EVENT_SELECTION_CHANGED, &range); 2390 (data, EFL_TEXT_INTERACTIVE_EVENT_SELECTION_CHANGED, &range);
2393 // XXX: still try primary selection even if on wl in case it's 2391 // XXX: still try primary selection even if on wl in case it's