diff options
author | Amitesh Singh <amitesh.sh@samsung.com> | 2014-04-27 04:15:26 +0900 |
---|---|---|
committer | Daniel Juyung Seo <seojuyung2@gmail.com> | 2014-04-27 04:15:26 +0900 |
commit | d1b0e5c94e9148ce281d2b62309c19482a654e31 (patch) | |
tree | 8f55a0887f3531b31a8645497013394cc41a7cdc | |
parent | 26ad9b6bac7447445a9bfcfc1befc5a6d44dfee5 (diff) | |
download | elementary-d1b0e5c94e9148ce281d2b62309c19482a654e31.tar.gz |
config: Added two APIs to enable/disable focus auto scroll bring in feature.
Summary:
Summary:
- APIs
- elm_config_focus_auto_scroll_bring_in_enabled_set
- elm_config_focus_auto_scroll_bring_in_enabled_get
- list/genlist/toolbar/gengrid: Using this feature for scrolling for focus movement.
- Added test case in "List Focus", "Genlist Focus", "Toolbar Focus" and "Gengrid Focus"
@feature
Test Plan: elementary_test->"List Focus", "Genlist Focus", "Toolbar Focus" & "Gengrid Focus".
Reviewers: raster, seoz
CC: seoz
Differential Revision: https://phab.enlightenment.org/D799
-rw-r--r-- | config/default/base.src | 1 | ||||
-rw-r--r-- | config/mobile/base.src | 1 | ||||
-rw-r--r-- | config/standard/base.src | 1 | ||||
-rw-r--r-- | src/bin/test_gengrid.c | 17 | ||||
-rw-r--r-- | src/bin/test_genlist.c | 17 | ||||
-rw-r--r-- | src/bin/test_list.c | 17 | ||||
-rw-r--r-- | src/bin/test_toolbar.c | 18 | ||||
-rw-r--r-- | src/lib/elm_config.c | 16 | ||||
-rw-r--r-- | src/lib/elm_config.h | 20 | ||||
-rw-r--r-- | src/lib/elm_gengrid.c | 8 | ||||
-rw-r--r-- | src/lib/elm_genlist.c | 7 | ||||
-rw-r--r-- | src/lib/elm_list.c | 7 | ||||
-rw-r--r-- | src/lib/elm_priv.h | 1 | ||||
-rw-r--r-- | src/lib/elm_toolbar.c | 7 |
14 files changed, 133 insertions, 5 deletions
diff --git a/config/default/base.src b/config/default/base.src index 73aff115a..3f482581d 100644 --- a/config/default/base.src +++ b/config/default/base.src @@ -26,6 +26,7 @@ group "Elm_Config" struct { value "scroll_smooth_history_weight" double: 0.1; value "scroll_smooth_future_time" double: 0.0; value "scroll_smooth_time_window" double: 0.01; + value "focus_auto_scroll_bring_in_enable" uchar: 0; value "scale" double: 1.0; value "bgpixmap" int: 0; value "compositing" int: 1; diff --git a/config/mobile/base.src b/config/mobile/base.src index 4fb7f0705..6f2d976e7 100644 --- a/config/mobile/base.src +++ b/config/mobile/base.src @@ -26,6 +26,7 @@ group "Elm_Config" struct { value "scroll_smooth_history_weight" double: 0.1; value "scroll_smooth_future_time" double: 0.0; value "scroll_smooth_time_window" double: 0.01; + value "focus_auto_scroll_bring_in_enable" uchar: 0; value "scale" double: 1.0; value "bgpixmap" int: 0; value "compositing" int: 1; diff --git a/config/standard/base.src b/config/standard/base.src index 6552e83f5..7472f1f6a 100644 --- a/config/standard/base.src +++ b/config/standard/base.src @@ -26,6 +26,7 @@ group "Elm_Config" struct { value "scroll_smooth_history_weight" double: 0.1; value "scroll_smooth_future_time" double: 0.0; value "scroll_smooth_time_window" double: 0.01; + value "focus_auto_scroll_bring_in_enable" uchar: 0; value "scale" double: 1.0; value "bgpixmap" int: 0; value "compositing" int: 1; diff --git a/src/bin/test_gengrid.c b/src/bin/test_gengrid.c index cac0973b5..9b49762fe 100644 --- a/src/bin/test_gengrid.c +++ b/src/bin/test_gengrid.c @@ -1363,6 +1363,14 @@ _test_gengrid_focus_focus_animate_check_changed(void *data, } static void +_test_gengrid_focus_bring_in_changed(void *data EINA_UNUSED, + Evas_Object *obj, + void *event_info EINA_UNUSED) +{ + elm_config_focus_auto_scroll_bring_in_enabled_set(elm_check_state_get(obj)); +} + +static void _grid_reorder_mode(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) { @@ -1486,6 +1494,15 @@ test_gengrid_focus(void *data EINA_UNUSED, elm_box_pack_end(bx_opt, ck); evas_object_show(ck); + ck = elm_check_add(bx_opt); + elm_object_text_set(ck, "Focus Auto scroll bring in enable"); + evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0); + evas_object_smart_callback_add(ck, "changed", _test_gengrid_focus_bring_in_changed, + NULL); + elm_check_state_set(ck, elm_config_focus_auto_scroll_bring_in_enabled_get()); + elm_box_pack_end(bx_opt, ck); + evas_object_show(ck); + //Focus movement policy fr = elm_frame_add(bx); elm_object_text_set(fr, "Focus Movement Policy"); diff --git a/src/bin/test_genlist.c b/src/bin/test_genlist.c index 4557804fb..12e9a02fb 100644 --- a/src/bin/test_genlist.c +++ b/src/bin/test_genlist.c @@ -3800,6 +3800,14 @@ _focus_button_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED, printf("Button clicked: %s\n", (char *)data); } +static void +_test_genlist_focus_bring_in_changed(void *data EINA_UNUSED, + Evas_Object *obj, + void *event_info EINA_UNUSED) +{ + elm_config_focus_auto_scroll_bring_in_enabled_set(elm_check_state_get(obj)); +} + void test_genlist_focus(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, @@ -3963,6 +3971,15 @@ test_genlist_focus(void *data EINA_UNUSED, elm_box_pack_end(bx_opt, chk); evas_object_show(chk); + chk = elm_check_add(bx_opt); + elm_object_text_set(chk, "Focus Auto scroll bring in enable"); + evas_object_size_hint_weight_set(chk, EVAS_HINT_EXPAND, 0.0); + evas_object_smart_callback_add(chk, "changed", _test_genlist_focus_bring_in_changed, + NULL); + elm_check_state_set(chk, elm_config_focus_auto_scroll_bring_in_enabled_get()); + elm_box_pack_end(bx_opt, chk); + evas_object_show(chk); + // Focus Movement Policy fr = elm_frame_add(bx); elm_object_text_set(fr, "Focus Movement Policy"); diff --git a/src/bin/test_list.c b/src/bin/test_list.c index 4939f2f16..c7807983c 100644 --- a/src/bin/test_list.c +++ b/src/bin/test_list.c @@ -1397,6 +1397,14 @@ _focus_button_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED, } static void +_test_list_focus_bring_in_changed(void *data EINA_UNUSED, + Evas_Object *obj, + void *event_info EINA_UNUSED) +{ + elm_config_focus_auto_scroll_bring_in_enabled_set(elm_check_state_get(obj)); +} + +static void _test_list_focus(const char *name, const char *title, Eina_Bool horiz) { Evas_Object *win, *li, *btn, *bx, *bx2, *fr, *bx_opt, *chk, *bx_btn; @@ -1532,6 +1540,15 @@ _test_list_focus(const char *name, const char *title, Eina_Bool horiz) elm_box_pack_end(bx_opt, chk); evas_object_show(chk); + chk = elm_check_add(bx_opt); + elm_object_text_set(chk, "Focus Auto scroll bring in enable"); + evas_object_size_hint_weight_set(chk, EVAS_HINT_EXPAND, 0.0); + evas_object_smart_callback_add(chk, "changed", _test_list_focus_bring_in_changed, + NULL); + elm_check_state_set(chk, elm_config_focus_auto_scroll_bring_in_enabled_get()); + elm_box_pack_end(bx_opt, chk); + evas_object_show(chk); + // Focus Movement Policy fr = elm_frame_add(bx); elm_object_text_set(fr, "Focus Movement Policy"); diff --git a/src/bin/test_toolbar.c b/src/bin/test_toolbar.c index 1487c175b..510899f5c 100644 --- a/src/bin/test_toolbar.c +++ b/src/bin/test_toolbar.c @@ -1126,6 +1126,14 @@ test_toolbar_focus_focus_move_policy_changed(void *data EINA_UNUSED, elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_IN); } +static void +_test_toolbar_focus_bring_in_changed(void *data EINA_UNUSED, + Evas_Object *obj, + void *event_info EINA_UNUSED) +{ + elm_config_focus_auto_scroll_bring_in_enabled_set(elm_check_state_get(obj)); +} + void test_toolbar_focus(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { @@ -1212,6 +1220,16 @@ test_toolbar_focus(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e evas_object_smart_callback_add(chk, "changed", _test_toolbar_focus_focus_animate_check_changed, win); + + chk = elm_check_add(bx_opt); + elm_object_text_set(chk, "Focus Auto scroll bring in enable"); + evas_object_size_hint_weight_set(chk, EVAS_HINT_EXPAND, 0.0); + evas_object_smart_callback_add(chk, "changed", _test_toolbar_focus_bring_in_changed, + NULL); + elm_check_state_set(chk, elm_config_focus_auto_scroll_bring_in_enabled_get()); + elm_box_pack_end(bx_opt, chk); + evas_object_show(chk); + // Focus movement policy fr = elm_frame_add(bx); elm_object_text_set(fr, "Focus Movement Policy"); diff --git a/src/lib/elm_config.c b/src/lib/elm_config.c index f80a62b97..59e287fb9 100644 --- a/src/lib/elm_config.c +++ b/src/lib/elm_config.c @@ -507,6 +507,7 @@ _desc_init(void) ELM_CONFIG_VAL(D, T, scroll_smooth_history_weight, T_DOUBLE); ELM_CONFIG_VAL(D, T, scroll_smooth_future_time, T_DOUBLE); ELM_CONFIG_VAL(D, T, scroll_smooth_time_window, T_DOUBLE); + ELM_CONFIG_VAL(D, T, focus_auto_scroll_bring_in_enable, T_UCHAR); ELM_CONFIG_VAL(D, T, scale, T_DOUBLE); ELM_CONFIG_VAL(D, T, bgpixmap, T_INT); ELM_CONFIG_VAL(D, T, compositing, T_INT); @@ -2027,6 +2028,9 @@ _env_get(void) if (s) _elm_config->scroll_smooth_future_time = _elm_atof(s); s = getenv("ELM_SCROLL_SMOOTH_TIME_WINDOW"); if (s) _elm_config->scroll_smooth_time_window = _elm_atof(s); + s = getenv("ELM_FOCUS_AUTO_SCROLL_BRING_IN_ENABLE"); + if (s) _elm_config->focus_auto_scroll_bring_in_enable = !!atoi(s); + s = getenv("ELM_THEME"); if (s) eina_stringshare_replace(&_elm_config->theme, s); @@ -2923,6 +2927,18 @@ elm_config_scroll_thumbscroll_acceleration_weight_set(double weight) _elm_config->thumbscroll_acceleration_weight = weight; } +EAPI Eina_Bool +elm_config_focus_auto_scroll_bring_in_enabled_get(void) +{ + return _elm_config->focus_auto_scroll_bring_in_enable; +} + +EAPI void +elm_config_focus_auto_scroll_bring_in_enabled_set(Eina_Bool enabled) +{ + _elm_config->focus_auto_scroll_bring_in_enable = !!enabled; +} + EAPI void elm_config_longpress_timeout_set(double longpress_timeout) { diff --git a/src/lib/elm_config.h b/src/lib/elm_config.h index 4478068d2..c95818653 100644 --- a/src/lib/elm_config.h +++ b/src/lib/elm_config.h @@ -551,6 +551,26 @@ EAPI double elm_config_scroll_thumbscroll_acceleration_weight_get(void); EAPI void elm_config_scroll_thumbscroll_acceleration_weight_set(double weight); /** + * Get enable status of focus auto scroll bring in. + * + * @see elm_config_focus_auto_scroll_bring_in_enabled_set() + * @ingroup Focus + * @since 1.10 + */ +EAPI Eina_Bool elm_config_focus_auto_scroll_bring_in_enabled_get(void); + +/** + * Set enable status of focus auto scroll bring in. + * + * @param enabled enable scroll bring in if @c EINA_TRUE, disable otherwise + * + * @see elm_config_focus_auto_scroll_bring_in_enabled_get() + * @ingroup Focus + * @since 1.10 + */ +EAPI void elm_config_focus_auto_scroll_bring_in_enabled_set(Eina_Bool enabled); + +/** * @} */ diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c index dd30714cc..bfcecaebf 100644 --- a/src/lib/elm_gengrid.c +++ b/src/lib/elm_gengrid.c @@ -1487,8 +1487,12 @@ _elm_gengrid_item_focused(Elm_Gen_Item *it) (elm_widget_item_disabled_get(it))) return; - elm_gengrid_item_show - ((Elm_Object_Item *)it, ELM_GENGRID_ITEM_SCROLLTO_IN); + if (!_elm_config->focus_auto_scroll_bring_in_enable) + elm_gengrid_item_show + ((Elm_Object_Item *)it, ELM_GENGRID_ITEM_SCROLLTO_IN); + else + elm_gengrid_item_bring_in + ((Elm_Object_Item *)it, ELM_GENGRID_ITEM_SCROLLTO_IN); sd->focused_item = (Elm_Object_Item *)it; if (elm_widget_focus_highlight_enabled_get(obj)) diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c index bf9298f0f..22785bac5 100644 --- a/src/lib/elm_genlist.c +++ b/src/lib/elm_genlist.c @@ -2432,7 +2432,12 @@ _elm_genlist_item_focused(Elm_Gen_Item *it) (elm_widget_item_disabled_get(it))) return; - elm_genlist_item_show((Elm_Object_Item *)it, ELM_GENLIST_ITEM_SCROLLTO_IN); + if (!_elm_config->focus_auto_scroll_bring_in_enable) + elm_genlist_item_show((Elm_Object_Item *)it, + ELM_GENLIST_ITEM_SCROLLTO_IN); + else + elm_genlist_item_bring_in((Elm_Object_Item *)it, + ELM_GENLIST_ITEM_SCROLLTO_IN); sd->focused_item = (Elm_Object_Item *)it; if (elm_widget_focus_highlight_enabled_get(obj)) diff --git a/src/lib/elm_list.c b/src/lib/elm_list.c index fd5def28b..aeb91ae88 100644 --- a/src/lib/elm_list.c +++ b/src/lib/elm_list.c @@ -1081,7 +1081,12 @@ _elm_list_item_focused(Elm_List_Item *it) evas_object_geometry_get(VIEW(it), &x, &y, &w, &h); evas_object_geometry_get(sd->hit_rect, &sx, &sy, &sw, &sh); if ((x < sx) || (y < sy)|| ((x + w) > (sx + sw)) || ((y + h) > (sy + sh))) - elm_list_item_show((Elm_Object_Item *)it); + { + if (!_elm_config->focus_auto_scroll_bring_in_enable) + elm_list_item_show((Elm_Object_Item *)it); + else + elm_list_item_bring_in((Elm_Object_Item *)it); + } sd->focused_item = (Elm_Object_Item *)it; if (elm_widget_focus_highlight_enabled_get(WIDGET(it))) { diff --git a/src/lib/elm_priv.h b/src/lib/elm_priv.h index 86afbed21..784823345 100644 --- a/src/lib/elm_priv.h +++ b/src/lib/elm_priv.h @@ -234,6 +234,7 @@ struct _Elm_Config 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. */ 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. */ 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.*/ + unsigned char focus_auto_scroll_bring_in_enable; /**< This shows the enabled status of focus auto scroll bring in feature. This is disabled by default.*/ int toolbar_shrink_mode; unsigned char fileselector_expand_enable; unsigned char fileselector_double_tap_navigation_enable; diff --git a/src/lib/elm_toolbar.c b/src/lib/elm_toolbar.c index 455e94a20..45b61c29e 100644 --- a/src/lib/elm_toolbar.c +++ b/src/lib/elm_toolbar.c @@ -601,7 +601,12 @@ _elm_toolbar_item_focused(Elm_Toolbar_Item *it) return; sd->focused_item = it; - elm_toolbar_item_show((Elm_Object_Item *)it, ELM_TOOLBAR_ITEM_SCROLLTO_IN); + if (!_elm_config->focus_auto_scroll_bring_in_enable) + elm_toolbar_item_show((Elm_Object_Item *)it, + ELM_TOOLBAR_ITEM_SCROLLTO_IN); + else + elm_toolbar_item_bring_in((Elm_Object_Item *)it, + ELM_TOOLBAR_ITEM_SCROLLTO_IN); if (elm_widget_focus_highlight_enabled_get(obj)) { edje_object_signal_emit |