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
This commit is contained in:
Youngbok Shin 2015-08-05 12:27:11 +05:30 committed by Amitesh Singh
parent aee3de2306
commit 3fb443df95
7 changed files with 137 additions and 23 deletions

View File

@ -1609,6 +1609,22 @@ _gg_focus_focus_move_policy_changed_cb(void *data EINA_UNUSED,
elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_IN);
}
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,
@ -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,9 +1752,29 @@ 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);
@ -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,

View File

@ -4183,6 +4183,22 @@ _gl_focus_focus_on_selection_changed_cb(void *data, Evas_Object *obj,
_gl_focus_focus_on_selection_set(data, obj, nextstate);
}
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,9 +4468,29 @@ _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);
@ -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);

View File

@ -1291,6 +1291,22 @@ test_list_focus_focus_check_changed(void *data, Evas_Object *obj,
test_list_focus_focus_on_selection_set(data, obj, nextstate);
}
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,9 +1519,29 @@ _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);
@ -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,

View File

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

View File

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

View File

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

View File

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