bu5hm4n pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=5154b5a8fca093fadeec5278e465385b5dcdb63a

commit 5154b5a8fca093fadeec5278e465385b5dcdb63a
Author: Ali Alzyod <[email protected]>
Date:   Mon Dec 30 15:36:02 2019 +0000

    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 <[email protected]>
    Differential Revision: https://phab.enlightenment.org/D10987
---
 .../elementary/efl_ui_internal_text_interactive.c  | 24 ++++++++++++++--------
 src/lib/elementary/efl_ui_textbox.c                |  6 ++----
 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);

-- 


Reply via email to