ami pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=1c7defb8ff900e399f9446807420e45576531cb3

commit 1c7defb8ff900e399f9446807420e45576531cb3
Author: Youngbok Shin <youngb.s...@samsung.com>
Date:   Wed Aug 5 12:27:11 2015 +0530

    focus/list/genlist/gengrid: fix focus highlight issues on list widgets when 
auto focus enable is on.
    
    Summary:
    elm_list, elm_genlist widgets are handle focus highlight
    relying on only elm_widget_focus_highlight_enabled_get() API.
    The API is not considered about auto focus highlight feature.
    So, we need to check a flag for auto focus from _elm_config.
    It resolves T2555.
    @fix
    
    Test Plan: elementary_test -> List Focus or Genlist Focus
    
    Reviewers: raster, cedric, SanghyeonLee, singh.amitesh
    
    Reviewed By: SanghyeonLee, singh.amitesh
    
    Maniphest Tasks: T2555
    
    Differential Revision: https://phab.enlightenment.org/D2914
---
 src/bin/test_gengrid.c | 46 ++++++++++++++++++++++++++++++++++++++++++----
 src/bin/test_genlist.c | 46 ++++++++++++++++++++++++++++++++++++++++++----
 src/bin/test_list.c    | 46 ++++++++++++++++++++++++++++++++++++++++++----
 src/lib/elm_gengrid.c  |  6 +++---
 src/lib/elm_genlist.c  |  8 ++++----
 src/lib/elm_list.c     |  6 +++---
 src/lib/elm_win.c      |  2 +-
 7 files changed, 137 insertions(+), 23 deletions(-)

diff --git a/src/bin/test_gengrid.c b/src/bin/test_gengrid.c
index ffd4857..93d7f38 100644
--- a/src/bin/test_gengrid.c
+++ b/src/bin/test_gengrid.c
@@ -1610,6 +1610,22 @@ _gg_focus_focus_move_policy_changed_cb(void *data 
EINA_UNUSED,
 }
 
 static void
+_gg_focus_win_auto_focus_enable_changed(void *data EINA_UNUSED,
+                                        Evas_Object *obj,
+                                        void *event_info EINA_UNUSED)
+{
+   elm_config_window_auto_focus_enable_set(elm_check_state_get(obj));
+}
+
+static void
+_gg_focus_win_auto_focus_animate_changed(void *data EINA_UNUSED,
+                                         Evas_Object *obj,
+                                         void *event_info EINA_UNUSED)
+{
+   elm_config_window_auto_focus_animate_set(elm_check_state_get(obj));
+}
+
+static void
 _gg_focus_focus_highlight_changed_cb(void *data,
                                      Evas_Object *obj,
                                      void *event_info EINA_UNUSED)
@@ -1666,8 +1682,10 @@ test_gengrid_focus(void *data EINA_UNUSED,
    int i, n;
 
    win = elm_win_util_standard_add("gengrid-focus", "Gengrid Focus");
-   elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
-   elm_win_focus_highlight_animate_set(win, EINA_TRUE);
+   elm_config_window_auto_focus_enable_set(EINA_TRUE);
+   elm_config_window_auto_focus_animate_set(EINA_TRUE);
+   elm_win_focus_highlight_enabled_set(win, EINA_FALSE);
+   elm_win_focus_highlight_animate_set(win, EINA_FALSE);
    elm_win_autodel_set(win, EINA_TRUE);
 
    bx_horiz = elm_box_add(win);
@@ -1734,10 +1752,30 @@ test_gengrid_focus(void *data EINA_UNUSED,
    evas_object_show(bx_opt);
 
    ck = elm_check_add(bx_opt);
-   elm_object_text_set(ck, "Focus Highlight");
+   elm_object_text_set(ck, "Window Auto Focus Enable");
+   elm_check_state_set(ck, EINA_TRUE);
+   evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0);
+   evas_object_smart_callback_add(ck, "changed",
+                                  _gg_focus_win_auto_focus_enable_changed,
+                                  NULL);
+   elm_box_pack_end(bx_opt, ck);
+   evas_object_show(ck);
+
+   ck = elm_check_add(bx_opt);
+   elm_object_text_set(ck, "Window Auto Focus Animate");
    elm_check_state_set(ck, EINA_TRUE);
    evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0);
    evas_object_smart_callback_add(ck, "changed",
+                                  _gg_focus_win_auto_focus_animate_changed,
+                                  NULL);
+   elm_box_pack_end(bx_opt, ck);
+   evas_object_show(ck);
+
+   ck = elm_check_add(bx_opt);
+   elm_object_text_set(ck, "Focus Highlight");
+   elm_check_state_set(ck, EINA_FALSE);
+   evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0);
+   evas_object_smart_callback_add(ck, "changed",
                                   _gg_focus_focus_highlight_changed_cb,
                                   win);
    elm_box_pack_end(bx_opt, ck);
@@ -1745,7 +1783,7 @@ test_gengrid_focus(void *data EINA_UNUSED,
 
    ck = elm_check_add(bx_opt);
    elm_object_text_set(ck, "Focus Animation");
-   elm_check_state_set(ck, EINA_TRUE);
+   elm_check_state_set(ck, EINA_FALSE);
    evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0);
    evas_object_smart_callback_add(ck, "changed",
                                   _gg_focus_focus_animate_changed_cb,
diff --git a/src/bin/test_genlist.c b/src/bin/test_genlist.c
index 01b5311..9114665 100644
--- a/src/bin/test_genlist.c
+++ b/src/bin/test_genlist.c
@@ -4184,6 +4184,22 @@ _gl_focus_focus_on_selection_changed_cb(void *data, 
Evas_Object *obj,
 }
 
 static void
+_gl_focus_win_auto_focus_enable_changed(void *data EINA_UNUSED,
+                                        Evas_Object *obj,
+                                        void *event_info EINA_UNUSED)
+{
+   elm_config_window_auto_focus_enable_set(elm_check_state_get(obj));
+}
+
+static void
+_gl_focus_win_auto_focus_animate_changed(void *data EINA_UNUSED,
+                                         Evas_Object *obj,
+                                         void *event_info EINA_UNUSED)
+{
+   elm_config_window_auto_focus_animate_set(elm_check_state_get(obj));
+}
+
+static void
 _gl_focus_focus_highlight_changed_cb(void *data, Evas_Object *obj,
                                      void *event_info EINA_UNUSED)
 {
@@ -4452,10 +4468,30 @@ _test_genlist_focus_option_panel_create(Evas_Object 
*win, Evas_Object *bx,
    evas_object_show(bx_opt);
 
    chk = elm_check_add(bx_opt);
-   elm_object_text_set(chk, "Focus Highlight");
+   elm_object_text_set(chk, "Window Auto Focus Enable");
+   elm_check_state_set(chk, EINA_TRUE);
+   evas_object_size_hint_weight_set(chk, EVAS_HINT_EXPAND, 0.0);
+   evas_object_smart_callback_add(chk, "changed",
+                                  _gl_focus_win_auto_focus_enable_changed,
+                                  NULL);
+   elm_box_pack_end(bx_opt, chk);
+   evas_object_show(chk);
+
+   chk = elm_check_add(bx_opt);
+   elm_object_text_set(chk, "Window Auto Focus Animate");
    elm_check_state_set(chk, EINA_TRUE);
    evas_object_size_hint_weight_set(chk, EVAS_HINT_EXPAND, 0.0);
    evas_object_smart_callback_add(chk, "changed",
+                                  _gl_focus_win_auto_focus_animate_changed,
+                                  NULL);
+   elm_box_pack_end(bx_opt, chk);
+   evas_object_show(chk);
+
+   chk = elm_check_add(bx_opt);
+   elm_object_text_set(chk, "Focus Highlight");
+   elm_check_state_set(chk, EINA_FALSE);
+   evas_object_size_hint_weight_set(chk, EVAS_HINT_EXPAND, 0.0);
+   evas_object_smart_callback_add(chk, "changed",
                                   _gl_focus_focus_highlight_changed_cb,
                                   win);
    elm_box_pack_end(bx_opt, chk);
@@ -4463,7 +4499,7 @@ _test_genlist_focus_option_panel_create(Evas_Object *win, 
Evas_Object *bx,
 
    chk = elm_check_add(bx_opt);
    elm_object_text_set(chk, "Focus Animation");
-   elm_check_state_set(chk, EINA_TRUE);
+   elm_check_state_set(chk, EINA_FALSE);
    evas_object_size_hint_weight_set(chk, EVAS_HINT_EXPAND, 0.0);
    evas_object_smart_callback_add(chk, "changed",
                                   _gl_focus_focus_animate_changed_cb,
@@ -4616,8 +4652,10 @@ test_genlist_focus(void *data EINA_UNUSED,
    evas_object_event_callback_add(win, EVAS_CALLBACK_DEL,
                                   _gl_focus_win_del_cb, NULL);
 
-   elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
-   elm_win_focus_highlight_animate_set(win, EINA_TRUE);
+   elm_config_window_auto_focus_enable_set(EINA_TRUE);
+   elm_config_window_auto_focus_animate_set(EINA_TRUE);
+   elm_win_focus_highlight_enabled_set(win, EINA_FALSE);
+   elm_win_focus_highlight_animate_set(win, EINA_FALSE);
 
    bx = elm_box_add(win);
    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
diff --git a/src/bin/test_list.c b/src/bin/test_list.c
index 12cea7c..95d7aa6 100644
--- a/src/bin/test_list.c
+++ b/src/bin/test_list.c
@@ -1292,6 +1292,22 @@ test_list_focus_focus_check_changed(void *data, 
Evas_Object *obj,
 }
 
 static void
+test_list_focus_win_auto_focus_enable_check_changed(void *data EINA_UNUSED,
+                                                    Evas_Object *obj,
+                                                    void *event_info 
EINA_UNUSED)
+{
+   elm_config_window_auto_focus_enable_set(elm_check_state_get(obj));
+}
+
+static void
+test_list_focus_win_auto_focus_animate_check_changed(void *data EINA_UNUSED,
+                                                     Evas_Object *obj,
+                                                     void *event_info 
EINA_UNUSED)
+{
+   elm_config_window_auto_focus_animate_set(elm_check_state_get(obj));
+}
+
+static void
 test_list_focus_focus_highlight_check_changed(void *data, Evas_Object *obj,
                                               void *event_info EINA_UNUSED)
 {
@@ -1428,8 +1444,10 @@ _test_list_focus(const char *name, const char *title, 
Eina_Bool horiz)
    evas_object_event_callback_add(win, EVAS_CALLBACK_DEL,
                                   _test_list_focus_win_del_cb, NULL);
 
-   elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
-   elm_win_focus_highlight_animate_set(win, EINA_TRUE);
+   elm_config_window_auto_focus_enable_set(EINA_TRUE);
+   elm_config_window_auto_focus_animate_set(EINA_TRUE);
+   elm_win_focus_highlight_enabled_set(win, EINA_FALSE);
+   elm_win_focus_highlight_animate_set(win, EINA_FALSE);
 
    bx = elm_box_add(win);
    evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -1501,10 +1519,30 @@ _test_list_focus(const char *name, const char *title, 
Eina_Bool horiz)
    evas_object_show(bx_opt);
 
    chk = elm_check_add(bx_opt);
-   elm_object_text_set(chk, "Focus Highlight");
+   elm_object_text_set(chk, "Window Auto Focus Enable");
+   elm_check_state_set(chk, EINA_TRUE);
+   evas_object_size_hint_weight_set(chk, EVAS_HINT_EXPAND, 0.0);
+   evas_object_smart_callback_add(chk, "changed",
+                                  
test_list_focus_win_auto_focus_enable_check_changed,
+                                  NULL);
+   elm_box_pack_end(bx_opt, chk);
+   evas_object_show(chk);
+
+   chk = elm_check_add(bx_opt);
+   elm_object_text_set(chk, "Window Auto Focus Animate");
    elm_check_state_set(chk, EINA_TRUE);
    evas_object_size_hint_weight_set(chk, EVAS_HINT_EXPAND, 0.0);
    evas_object_smart_callback_add(chk, "changed",
+                                  
test_list_focus_win_auto_focus_animate_check_changed,
+                                  NULL);
+   elm_box_pack_end(bx_opt, chk);
+   evas_object_show(chk);
+
+   chk = elm_check_add(bx_opt);
+   elm_object_text_set(chk, "Focus Highlight");
+   elm_check_state_set(chk, EINA_FALSE);
+   evas_object_size_hint_weight_set(chk, EVAS_HINT_EXPAND, 0.0);
+   evas_object_smart_callback_add(chk, "changed",
                                   
test_list_focus_focus_highlight_check_changed,
                                   win);
    elm_box_pack_end(bx_opt, chk);
@@ -1512,7 +1550,7 @@ _test_list_focus(const char *name, const char *title, 
Eina_Bool horiz)
 
    chk = elm_check_add(bx_opt);
    elm_object_text_set(chk, "Focus Animation");
-   elm_check_state_set(chk, EINA_TRUE);
+   elm_check_state_set(chk, EINA_FALSE);
    evas_object_size_hint_weight_set(chk, EVAS_HINT_EXPAND, 0.0);
    evas_object_smart_callback_add(chk, "changed",
                                   test_list_focus_focus_animate_check_changed,
diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c
index 010c099..74e99e7 100644
--- a/src/lib/elm_gengrid.c
+++ b/src/lib/elm_gengrid.c
@@ -210,7 +210,7 @@ _item_cache_add(Elm_Gen_Item *it)
         if (eo_do_ret(EO_OBJ(it), tmp, elm_wdg_item_disabled_get()))
           edje_object_signal_emit(itc->base_view, "elm,state,enabled", "elm");
         if (it == (Elm_Gen_Item *)sd->focused_item &&
-            elm_widget_focus_highlight_enabled_get(obj))
+            (elm_widget_focus_highlight_enabled_get(obj) || 
_elm_config->win_auto_focus_enable))
           edje_object_signal_emit(itc->base_view, "elm,state,unfocused", 
"elm");
 
         ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
@@ -1292,7 +1292,7 @@ _elm_gengrid_item_focus_raise(Elm_Gen_Item *it)
    Evas_Object *obj = WIDGET(it);
    ELM_GENGRID_DATA_GET(obj, sd);
 
-   if (elm_widget_focus_highlight_enabled_get(obj))
+   if (elm_widget_focus_highlight_enabled_get(obj) || 
_elm_config->win_auto_focus_enable)
      {
         edje_object_signal_emit
            (VIEW(it), "elm,state,focused", "elm");
@@ -2043,7 +2043,7 @@ _elm_gengrid_item_unfocused(Elm_Object_Item *eo_it)
        (eo_it != sd->focused_item))
      return;
 
-   if (elm_widget_focus_highlight_enabled_get(obj))
+   if (elm_widget_focus_highlight_enabled_get(obj) || 
_elm_config->win_auto_focus_enable)
      {
         ELM_GENGRID_ITEM_DATA_GET(sd->focused_item, focus_it);
         edje_object_signal_emit
diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c
index b8395e2..38ce5d4 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -1274,7 +1274,7 @@ _elm_genlist_item_state_update(Elm_Gen_Item *it)
              (it->deco_all_view, SIGNAL_EXPANDED, "elm");
      }
    if (it == (Elm_Gen_Item *)GL_IT(it)->wsd->focused_item &&
-       elm_widget_focus_highlight_enabled_get(WIDGET(it)))
+       (elm_widget_focus_highlight_enabled_get(WIDGET(it)) || 
_elm_config->win_auto_focus_enable))
      edje_object_signal_emit(VIEW(it), SIGNAL_FOCUSED, "elm");
 }
 
@@ -1529,7 +1529,7 @@ _item_cache_add(Elm_Gen_Item *it)
    if (eo_do_ret(EO_OBJ(it), tmp, elm_wdg_item_disabled_get()))
      edje_object_signal_emit(itc->base_view, SIGNAL_ENABLED, "elm");
    if (it == (Elm_Gen_Item *)sd->focused_item &&
-       elm_widget_focus_highlight_enabled_get(obj))
+       (elm_widget_focus_highlight_enabled_get(obj) || 
_elm_config->win_auto_focus_enable))
      edje_object_signal_emit(itc->base_view, SIGNAL_UNFOCUSED, "elm");
 
    ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
@@ -1765,7 +1765,7 @@ _item_realize(Elm_Gen_Item *it,
         if (EO_OBJ(it) == sd->focused_item)
           {
              const char *focus_raise;
-             if (elm_widget_focus_highlight_enabled_get(WIDGET(it)))
+             if (elm_widget_focus_highlight_enabled_get(WIDGET(it)) || 
_elm_config->win_auto_focus_enable)
                edje_object_signal_emit(VIEW(it), SIGNAL_FOCUSED, "elm");
 
              focus_raise = edje_object_data_get(VIEW(it), "focusraise");
@@ -2828,7 +2828,7 @@ _key_action_move_dir(Evas_Object *obj, 
Elm_Focus_Direction dir, Eina_Bool multi)
    if (ret)
      return EINA_TRUE;
 
-   focus_only = _elm_config->item_select_on_focus_disable && 
elm_widget_focus_highlight_enabled_get(obj);
+   focus_only = _elm_config->item_select_on_focus_disable;
    // handle item loop feature
    if (sd->item_loop_enable && !sd->item_looping_on)
      {
diff --git a/src/lib/elm_list.c b/src/lib/elm_list.c
index 7c9d086..739df22 100644
--- a/src/lib/elm_list.c
+++ b/src/lib/elm_list.c
@@ -383,7 +383,7 @@ _elm_list_elm_widget_event_direction(Evas_Object *obj, 
Elm_Focus_Direction dir,
      }
 
    // move focus or selection according to the configuration
-   focus_only = _elm_config->item_select_on_focus_disable && 
elm_widget_focus_highlight_enabled_get(obj);
+   focus_only = _elm_config->item_select_on_focus_disable;
    if (focus_only)
      ret = _item_focused_next(obj, dir);
    else
@@ -1148,7 +1148,7 @@ _elm_list_item_focused(Elm_Object_Item *eo_it)
           }
      }
    sd->focused_item = eo_it;
-   if (elm_widget_focus_highlight_enabled_get(WIDGET(it)))
+   if (elm_widget_focus_highlight_enabled_get(WIDGET(it)) || 
_elm_config->win_auto_focus_enable)
      {
         edje_object_signal_emit
            (VIEW(it), "elm,state,focused", "elm");
@@ -1176,7 +1176,7 @@ _elm_list_item_unfocused(Elm_Object_Item *eo_it)
    if (_is_no_select(it))
      return;
 
-   if (elm_widget_focus_highlight_enabled_get(obj))
+   if (elm_widget_focus_highlight_enabled_get(obj) || 
_elm_config->win_auto_focus_enable)
      {
         ELM_LIST_ITEM_DATA_GET(sd->focused_item, focus_it);
         edje_object_signal_emit
diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c
index 5c0d807..3fafa50 100644
--- a/src/lib/elm_win.c
+++ b/src/lib/elm_win.c
@@ -5453,7 +5453,7 @@ _elm_win_focus_highlight_start(Evas_Object *obj)
 {
    ELM_WIN_DATA_GET(obj, sd);
 
-   if (!elm_win_focus_highlight_enabled_get(obj)) return;
+   if (!(sd->focus_highlight.enabled) && !(sd->focus_highlight.auto_enabled)) 
return;
    sd->focus_highlight.cur.visible = EINA_TRUE;
    sd->focus_highlight.geometry_changed = EINA_TRUE;
    _elm_win_focus_highlight_reconfigure_job(obj);

-- 


Reply via email to