summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Alzyod <ali198724@gmail.com>2019-12-30 15:36:02 +0000
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-12-31 11:56:59 +0100
commit5154b5a8fca093fadeec5278e465385b5dcdb63a (patch)
tree454727f6bcf04f240cc45e34fe2b2ba11b66705d
parent2ec10f18d33c77c5103e16f85874e8b527e73ef8 (diff)
downloadefl-5154b5a8fca093fadeec5278e465385b5dcdb63a.tar.gz
efl_ui_text: support focus navigation
With this commit you can move the focus from the textbox widget to the surrounding widgets, (as it is done in legacy). ref T8538 ref T8522 Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D10987
-rw-r--r--src/lib/elementary/efl_ui_internal_text_interactive.c24
-rw-r--r--src/lib/elementary/efl_ui_textbox.c6
2 files changed, 18 insertions, 12 deletions
diff --git a/src/lib/elementary/efl_ui_internal_text_interactive.c b/src/lib/elementary/efl_ui_internal_text_interactive.c
index a0bbba6469..2bb112f265 100644
--- a/src/lib/elementary/efl_ui_internal_text_interactive.c
+++ b/src/lib/elementary/efl_ui_internal_text_interactive.c
@@ -1137,8 +1137,10 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void
{
_key_down_sel_pre(obj, cur, en, shift, EINA_FALSE);
- efl_text_cursor_line_jump_by(cur, -1);
- ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+ if (efl_text_interactive_have_selection_get(obj))
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+ if (efl_text_cursor_line_jump_by(cur, -1))
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
_key_down_sel_post(obj, cur, en, shift);
}
@@ -1151,8 +1153,10 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void
{
_key_down_sel_pre(obj, cur, en, shift, EINA_TRUE);
- efl_text_cursor_line_jump_by(cur, 1);
- ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+ if (efl_text_interactive_have_selection_get(obj))
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+ if (efl_text_cursor_line_jump_by(cur, 1))
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
_key_down_sel_post(obj, cur, en, shift);
}
@@ -1163,14 +1167,16 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void
_compose_seq_reset(en);
_key_down_sel_pre(obj, cur, en, shift, EINA_FALSE);
- efl_text_cursor_move(cur,EFL_TEXT_CURSOR_MOVE_TYPE_CHAR_PREV);
#if defined(__APPLE__) && defined(__MACH__)
if (altgr) efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_START);
#else
/* If control is pressed, go to the start of the word */
if (control) efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_START);
#endif
- ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+ if (efl_text_interactive_have_selection_get(obj))
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+ if (efl_text_cursor_move(cur,EFL_TEXT_CURSOR_MOVE_TYPE_CHAR_PREV))
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
_key_down_sel_post(obj, cur, en, shift);
}
@@ -1186,8 +1192,10 @@ _key_down_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void
/* If control is pressed, go to the end of the word */
if (control) efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_WORD_END);
#endif
- efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_CHAR_NEXT);
- ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+ if (efl_text_interactive_have_selection_get(obj))
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+ if (efl_text_cursor_move(cur, EFL_TEXT_CURSOR_MOVE_TYPE_CHAR_NEXT))
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
_key_down_sel_post(obj, cur, en, shift);
}
diff --git a/src/lib/elementary/efl_ui_textbox.c b/src/lib/elementary/efl_ui_textbox.c
index 6d91f21519..da63751e53 100644
--- a/src/lib/elementary/efl_ui_textbox.c
+++ b/src/lib/elementary/efl_ui_textbox.c
@@ -870,9 +870,7 @@ _efl_ui_textbox_efl_ui_focus_object_on_focus_update(Eo *obj, Efl_Ui_Textbox_Data
if (!efl_text_interactive_editable_get(obj)) return EINA_FALSE;
- top = elm_widget_top_get(obj);
- if (top && efl_isa(top, EFL_UI_WIN_CLASS))
- top_is_win = EINA_TRUE;
+ top = efl_provider_find(obj, EFL_UI_WIN_CLASS);
if (efl_ui_focus_object_focus_get(obj))
{
@@ -882,7 +880,7 @@ _efl_ui_textbox_efl_ui_focus_object_on_focus_update(Eo *obj, Efl_Ui_Textbox_Data
if (sd->scroll)
efl_layout_signal_emit(sd->scr_edje, "efl,action,focus", "efl");
- if (top && top_is_win && efl_input_text_input_panel_autoshow_get(obj) && !efl_input_text_input_panel_show_on_demand_get(obj))
+ if (top && efl_input_text_input_panel_autoshow_get(obj) && !efl_input_text_input_panel_show_on_demand_get(obj))
elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_ON);
if (_elm_config->atspi_mode)
efl_access_state_changed_signal_emit(obj, EFL_ACCESS_STATE_TYPE_FOCUSED, EINA_TRUE);