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
This commit is contained in:
Ali Alzyod 2019-12-30 15:36:02 +00:00 committed by Marcel Hollerbach
parent 2ec10f18d3
commit 5154b5a8fc
2 changed files with 18 additions and 12 deletions

View File

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

View File

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