summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorAnil Kumar Nahak <ak.nahak@samsung.com>2014-07-21 18:55:55 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-07-21 18:55:55 +0900
commit20b61442a71309e5feed9038bf802ed016bd0b3a (patch)
tree6c853b88712af30fe42826673595862e75a9e650 /src/lib
parent89b9141d37da3cd4c0906d07a39eafd137019934 (diff)
Focus: first item should be focused when there is no focused/selected item
Summary: First item of widget should be focused when focus comes to the widget for first time. Test Plan: elementary_test -to "Genlist Focus" elementary_test -to "Gengrid Focus" elementary_test -to "List Focus" elementary_test -to "toolbar Focus" Reviewers: seoz Differential Revision: https://phab.enlightenment.org/D1135
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/elm_config.c17
-rw-r--r--src/lib/elm_config.h22
-rw-r--r--src/lib/elm_gengrid.c5
-rw-r--r--src/lib/elm_genlist.c5
-rw-r--r--src/lib/elm_list.c7
-rw-r--r--src/lib/elm_priv.h1
-rw-r--r--src/lib/elm_toolbar.c8
7 files changed, 51 insertions, 14 deletions
diff --git a/src/lib/elm_config.c b/src/lib/elm_config.c
index b308928a0..96430ce50 100644
--- a/src/lib/elm_config.c
+++ b/src/lib/elm_config.c
@@ -529,6 +529,7 @@ _desc_init(void)
529 ELM_CONFIG_VAL(D, T, focus_move_policy, T_UCHAR); 529 ELM_CONFIG_VAL(D, T, focus_move_policy, T_UCHAR);
530 ELM_CONFIG_VAL(D, T, focus_autoscroll_mode, T_UCHAR); 530 ELM_CONFIG_VAL(D, T, focus_autoscroll_mode, T_UCHAR);
531 ELM_CONFIG_VAL(D, T, item_select_on_focus_disable, T_UCHAR); 531 ELM_CONFIG_VAL(D, T, item_select_on_focus_disable, T_UCHAR);
532 ELM_CONFIG_VAL(D, T, first_item_focus_on_first_focus_in, T_UCHAR);
532 ELM_CONFIG_VAL(D, T, toolbar_shrink_mode, T_INT); 533 ELM_CONFIG_VAL(D, T, toolbar_shrink_mode, T_INT);
533 ELM_CONFIG_VAL(D, T, fileselector_expand_enable, T_UCHAR); 534 ELM_CONFIG_VAL(D, T, fileselector_expand_enable, T_UCHAR);
534 ELM_CONFIG_VAL(D, T, fileselector_double_tap_navigation_enable, T_UCHAR); 535 ELM_CONFIG_VAL(D, T, fileselector_double_tap_navigation_enable, T_UCHAR);
@@ -1546,6 +1547,7 @@ _config_load(void)
1546 _elm_config->focus_highlight_animate = EINA_TRUE; 1547 _elm_config->focus_highlight_animate = EINA_TRUE;
1547 _elm_config->focus_highlight_clip_disable = EINA_FALSE; 1548 _elm_config->focus_highlight_clip_disable = EINA_FALSE;
1548 _elm_config->focus_move_policy = ELM_FOCUS_MOVE_POLICY_CLICK; 1549 _elm_config->focus_move_policy = ELM_FOCUS_MOVE_POLICY_CLICK;
1550 _elm_config->first_item_focus_on_first_focus_in = EINA_FALSE;
1549 _elm_config->item_select_on_focus_disable = EINA_TRUE; 1551 _elm_config->item_select_on_focus_disable = EINA_TRUE;
1550 _elm_config->toolbar_shrink_mode = 2; 1552 _elm_config->toolbar_shrink_mode = 2;
1551 _elm_config->fileselector_expand_enable = EINA_FALSE; 1553 _elm_config->fileselector_expand_enable = EINA_FALSE;
@@ -2166,6 +2168,9 @@ _env_get(void)
2166 s = getenv("ELM_ITEM_SELECT_ON_FOCUS_DISABLE"); 2168 s = getenv("ELM_ITEM_SELECT_ON_FOCUS_DISABLE");
2167 if (s) _elm_config->item_select_on_focus_disable = !!atoi(s); 2169 if (s) _elm_config->item_select_on_focus_disable = !!atoi(s);
2168 2170
2171 s = getenv("ELM_FIRST_ITEM_FOCUS_ON_FIRST_FOCUS_IN");
2172 if (s) _elm_config->first_item_focus_on_first_focus_in = !!atoi(s);
2173
2169 s = getenv("ELM_TOOLBAR_SHRINK_MODE"); 2174 s = getenv("ELM_TOOLBAR_SHRINK_MODE");
2170 if (s) _elm_config->toolbar_shrink_mode = atoi(s); 2175 if (s) _elm_config->toolbar_shrink_mode = atoi(s);
2171 2176
@@ -2736,6 +2741,18 @@ elm_config_item_select_on_focus_disabled_set(Eina_Bool disable)
2736} 2741}
2737 2742
2738EAPI Eina_Bool 2743EAPI Eina_Bool
2744elm_config_first_item_focus_on_first_focusin_get(void)
2745{
2746 return _elm_config->first_item_focus_on_first_focus_in;
2747}
2748
2749EAPI void
2750elm_config_first_item_focus_on_first_focusin_set(Eina_Bool enable)
2751{
2752 _elm_config->first_item_focus_on_first_focus_in = !!enable;
2753}
2754
2755EAPI Eina_Bool
2739elm_config_scroll_bounce_enabled_get(void) 2756elm_config_scroll_bounce_enabled_get(void)
2740{ 2757{
2741 return _elm_config->thumbscroll_bounce_enable; 2758 return _elm_config->thumbscroll_bounce_enable;
diff --git a/src/lib/elm_config.h b/src/lib/elm_config.h
index 9d29f3751..7cf9a59c4 100644
--- a/src/lib/elm_config.h
+++ b/src/lib/elm_config.h
@@ -1343,6 +1343,28 @@ EAPI Eina_Bool elm_config_item_select_on_focus_disabled_get(void);
1343EAPI void elm_config_item_select_on_focus_disabled_set(Eina_Bool enabled); 1343EAPI void elm_config_item_select_on_focus_disabled_set(Eina_Bool enabled);
1344 1344
1345/** 1345/**
1346 * Get status of first item focus on first focusin feature.
1347 *
1348 * @return The first item focus on first focusin status
1349 *
1350 * @see elm_config_first_item_focus_on_first_focusin_set
1351 * @since 1.11
1352 * @ingroup Focus
1353 */
1354EAPI Eina_Bool elm_config_first_item_focus_on_first_focusin_get(void);
1355
1356/**
1357 * Set the first item focus on first focusin feature.
1358 *
1359 * @param enable first_item_focus_on_first_focusin if @c EINA_TRUE, enable otherwise
1360 *
1361 * @see elm_config_first_item_focus_on_first_focusin_get
1362 * @since 1.11
1363 * @ingroup Focus
1364 */
1365EAPI void elm_config_first_item_focus_on_first_focusin_set(Eina_Bool enabled);
1366
1367/**
1346 * Get the system mirrored mode. This determines the default mirrored mode 1368 * Get the system mirrored mode. This determines the default mirrored mode
1347 * of widgets. 1369 * of widgets.
1348 * 1370 *
diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c
index e4c28f996..eb94d5f03 100644
--- a/src/lib/elm_gengrid.c
+++ b/src/lib/elm_gengrid.c
@@ -2949,13 +2949,12 @@ _elm_gengrid_elm_widget_on_focus(Eo *obj, Elm_Gengrid_Data *sd)
2949 it = sd->last_focused_item; 2949 it = sd->last_focused_item;
2950 else if (sd->last_selected_item) 2950 else if (sd->last_selected_item)
2951 it = sd->last_selected_item; 2951 it = sd->last_selected_item;
2952 /* TODO: make it optional on 1.11. Disable this until then 2952 else if (_elm_config->first_item_focus_on_first_focus_in &&
2953 else if (elm_widget_focus_highlight_enabled_get(obj)) 2953 elm_widget_focus_highlight_enabled_get(obj))
2954 { 2954 {
2955 it = elm_gengrid_first_item_get(obj); 2955 it = elm_gengrid_first_item_get(obj);
2956 is_sel = EINA_TRUE; 2956 is_sel = EINA_TRUE;
2957 } 2957 }
2958 */
2959 2958
2960 if (it) 2959 if (it)
2961 { 2960 {
diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c
index cdf9456e1..7857d37d0 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -2932,13 +2932,12 @@ _elm_genlist_elm_widget_on_focus(Eo *obj, Elm_Genlist_Data *sd)
2932 it = sd->last_focused_item; 2932 it = sd->last_focused_item;
2933 else if (sd->last_selected_item) 2933 else if (sd->last_selected_item)
2934 it = sd->last_selected_item; 2934 it = sd->last_selected_item;
2935 /* TODO: make it optional on 1.11. Disable this until then 2935 else if (_elm_config->first_item_focus_on_first_focus_in &&
2936 else if (elm_widget_focus_highlight_enabled_get(obj)) 2936 elm_widget_focus_highlight_enabled_get(obj))
2937 { 2937 {
2938 it = elm_genlist_first_item_get(obj); 2938 it = elm_genlist_first_item_get(obj);
2939 is_sel = EINA_TRUE; 2939 is_sel = EINA_TRUE;
2940 } 2940 }
2941 */
2942 2941
2943 if (it) 2942 if (it)
2944 { 2943 {
diff --git a/src/lib/elm_list.c b/src/lib/elm_list.c
index 09b164945..fa9c03acd 100644
--- a/src/lib/elm_list.c
+++ b/src/lib/elm_list.c
@@ -1223,13 +1223,12 @@ _elm_list_elm_widget_on_focus(Eo *obj, Elm_List_Data *sd)
1223 it = sd->last_focused_item; 1223 it = sd->last_focused_item;
1224 else if (sd->last_selected_item) 1224 else if (sd->last_selected_item)
1225 it = sd->last_selected_item; 1225 it = sd->last_selected_item;
1226 /* TODO: make it optional on 1.11 1226 else if (_elm_config->first_item_focus_on_first_focus_in &&
1227 else if (elm_widget_focus_highlight_enabled_get(obj)) 1227 elm_widget_focus_highlight_enabled_get(obj))
1228 { 1228 {
1229 it = eina_list_data_get(sd->items); 1229 it = elm_list_first_item_get(obj);
1230 is_sel = EINA_TRUE; 1230 is_sel = EINA_TRUE;
1231 } 1231 }
1232 */
1233 1232
1234 if (it) 1233 if (it)
1235 { 1234 {
diff --git a/src/lib/elm_priv.h b/src/lib/elm_priv.h
index e84bad5ee..c8d3e97b1 100644
--- a/src/lib/elm_priv.h
+++ b/src/lib/elm_priv.h
@@ -230,6 +230,7 @@ struct _Elm_Config
230 unsigned char focus_highlight_clip_disable; /**< This shows disabled status of focus highlight clip feature. This value is false by default so the focus highlight is clipped. */ 230 unsigned char focus_highlight_clip_disable; /**< This shows disabled status of focus highlight clip feature. This value is false by default so the focus highlight is clipped. */
231 unsigned char focus_move_policy; /**< This show how the elementary focus is moved to another object. Focus can be moved by click or mouse_in. */ 231 unsigned char focus_move_policy; /**< This show how the elementary focus is moved to another object. Focus can be moved by click or mouse_in. */
232 unsigned char item_select_on_focus_disable; /**< This shows the disabled status of select on focus feature. This value is false by default so that select on focus feature is enabled by default.*/ 232 unsigned char item_select_on_focus_disable; /**< This shows the disabled status of select on focus feature. This value is false by default so that select on focus feature is enabled by default.*/
233 unsigned char first_item_focus_on_first_focus_in; /**< This sets the first item focus on first focus in feature*/
233 Elm_Focus_Autoscroll_Mode focus_autoscroll_mode; /**< This shows the focus auto scroll mode. By default, @c ELM_FOCUS_AUTOSCROLL_MODE_SHOW is set. */ 234 Elm_Focus_Autoscroll_Mode focus_autoscroll_mode; /**< This shows the focus auto scroll mode. By default, @c ELM_FOCUS_AUTOSCROLL_MODE_SHOW is set. */
234 int toolbar_shrink_mode; 235 int toolbar_shrink_mode;
235 unsigned char fileselector_expand_enable; 236 unsigned char fileselector_expand_enable;
diff --git a/src/lib/elm_toolbar.c b/src/lib/elm_toolbar.c
index fdaa4e07f..546773966 100644
--- a/src/lib/elm_toolbar.c
+++ b/src/lib/elm_toolbar.c
@@ -740,10 +740,10 @@ _elm_toolbar_elm_widget_on_focus(Eo *obj, Elm_Toolbar_Data *sd)
740 { 740 {
741 if (sd->last_focused_item) 741 if (sd->last_focused_item)
742 it = sd->last_focused_item; 742 it = sd->last_focused_item;
743 /* TODO: make it optional on 1.11. Disable this until then 743 else if (_elm_config->first_item_focus_on_first_focus_in &&
744 else 744 elm_widget_focus_highlight_enabled_get(obj))
745 it = (Elm_Object_Item *)ELM_TOOLBAR_ITEM_FROM_INLIST(sd->items); 745 it = elm_toolbar_first_item_get(obj);
746 */ 746
747 if (it) 747 if (it)
748 { 748 {
749 it = _elm_toolbar_nearest_visible_item_get(obj, it); 749 it = _elm_toolbar_nearest_visible_item_get(obj, it);