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)
downloadefl-3d2f99af9eca265e0b166a2b9f2686e6ba3e9f83.tar.gz
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 {
insertion: bool; [[$true if the content was inserted, $false if removed]]
mergeable: bool; [[$true if can be merged with the previous one. Used for example with insertion when something is already selected]]
}
-
-struct @beta Efl.Text_Range {
- [[This structure includes text position range (from/to).
- ]]
- start: int; [[The start postion.]]
- end: int; [[The end position.]]
-}
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,
event but only the last one will emit a @[.changed,user] event.
]]
have_selection,changed: bool; [[Emitted when the @.have_selection property value changes.]]
- selection,changed: Efl.Text_Range; [[Emitted when selection has changed. Query using @.selection_cursors.]]
+ selection,changed: Eina.Range; [[Emitted when selection has changed. Query using @.selection_cursors.]]
redo,request: void; [[Emitted when a redo operation is requested.]]
undo,request: void; [[Emitted when a undo operation is requested.]]
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)
}
else
{
- Efl_Text_Range range = {0};
- range.start = efl_text_cursor_position_get(en->sel_start);
- range.end = efl_text_cursor_position_get(en->sel_end);
+ Eina_Range range = eina_range_from_to(efl_text_cursor_position_get(en->sel_start),
+ efl_text_cursor_position_get(en->sel_end));
efl_event_callback_call(o, EFL_TEXT_INTERACTIVE_EVENT_SELECTION_CHANGED, &range);
}
}
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,
if (!sd) return;
sd->have_selection = EINA_TRUE;
- Efl_Text_Range range = {0};
//FIXME how to get selection range in legacy !?
- range.start = 0;
- range.end = 0;
+ Eina_Range range = EINA_RANGE_EMPTY();
efl_event_callback_legacy_call
(data, EFL_TEXT_INTERACTIVE_EVENT_SELECTION_CHANGED, &range);
// XXX: still try primary selection even if on wl in case it's