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
This commit is contained in:
Ali Alzyod 2020-01-23 16:07:42 +09:00 committed by WooHyun Jung
parent 09e3972d14
commit 3d2f99af9e
4 changed files with 4 additions and 14 deletions

View File

@ -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.]]
}

View File

@ -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.]]

View File

@ -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);
}
}

View File

@ -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