config: Added two APIs to enable/disable focus auto scroll bring in feature.
authorAmitesh Singh <amitesh.sh@samsung.com>
Sat, 26 Apr 2014 19:15:26 +0000 (04:15 +0900)
committerDaniel Juyung Seo <seojuyung2@gmail.com>
Sat, 26 Apr 2014 19:15:26 +0000 (04:15 +0900)
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

14 files changed:
legacy/elementary/config/default/base.src
legacy/elementary/config/mobile/base.src
legacy/elementary/config/standard/base.src
legacy/elementary/src/bin/test_gengrid.c
legacy/elementary/src/bin/test_genlist.c
legacy/elementary/src/bin/test_list.c
legacy/elementary/src/bin/test_toolbar.c
legacy/elementary/src/lib/elm_config.c
legacy/elementary/src/lib/elm_config.h
legacy/elementary/src/lib/elm_gengrid.c
legacy/elementary/src/lib/elm_genlist.c
legacy/elementary/src/lib/elm_list.c
legacy/elementary/src/lib/elm_priv.h
legacy/elementary/src/lib/elm_toolbar.c

index 73aff11..3f48258 100644 (file)
@@ -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;
index 4fb7f07..6f2d976 100644 (file)
@@ -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;
index 6552e83..7472f1f 100644 (file)
@@ -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;
index cac0973..9b49762 100644 (file)
@@ -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");
index 4557804..12e9a02 100644 (file)
@@ -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");
index 4939f2f..c780798 100644 (file)
@@ -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");
index 1487c17..510899f 100644 (file)
@@ -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");
index f80a62b..59e287f 100644 (file)
@@ -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)
 {
index 4478068..c958186 100644 (file)
@@ -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);
+
+/**
  * @}
  */
 
index dd30714..bfcecae 100644 (file)
@@ -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))
index bf9298f..22785ba 100644 (file)
@@ -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))
index fd5def2..aeb91ae 100644 (file)
@@ -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)))
      {
index 86afbed..7848233 100644 (file)
@@ -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;
index 455e94a..45b61c2 100644 (file)
@@ -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