Great. Nice patch :)
But check my in-lined comments.

On Wed, Jul 3, 2013 at 6:43 PM, Jaehwan Kim - Enlightenment Git <
no-re...@enlightenment.org> wrote:

> jaehwan pushed a commit to branch master.
>
> commit efc204f2d30fa57dee2dbc4b0d6d713309261829
> Author: Jaehwan Kim <jae.hwan....@samsung.com>
> Date:   Wed Jul 3 18:43:19 2013 +0900
>
>     Change the method to calculate a distance which be scrolled from
> linear to sine curve.
>     And add the configuration thumbscroll_flick_distance_tolerance. It's
> the max flick distance.
> ---
>  ChangeLog                          |  5 ++++
>  NEWS                               |  2 ++
>  config/default/base.src            |  1 +
>  config/mobile/base.src             |  1 +
>  config/standard/base.src           |  1 +
>  src/bin/config.c                   | 53
> +++++++++++++++++++++++++++++++++++++-
>  src/lib/elm_config.c               | 16 ++++++++++++
>  src/lib/elm_config.h               | 23 +++++++++++++++++
>  src/lib/elm_interface_scrollable.c | 18 +++++++++++--
>  src/lib/elm_priv.h                 |  1 +
>  10 files changed, 118 insertions(+), 3 deletions(-)
>
> diff --git a/ChangeLog b/ChangeLog
> index 969bb5d..88d211f 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1482,3 +1482,8 @@
>
>          * added callback call "scroll", "scroll,anim,start",
> "scroll,anim,stop", "scroll,drag,start", "scroll,drag,stop"
>          in toolar widget.
> +
> +2013-07-03  Jaehwan Kim
> +
> +        * Change the method to calculate a distance which be scrolled
> from linear to sine curve.
> +        And add the configuration thumbscroll_flick_distance_tolerance.
> It's the max flick distance.
> diff --git a/NEWS b/NEWS
> index d2e771b..fb6563f 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -78,6 +78,7 @@ Additions:
>     * Add elm_fileselector_mime_type_filter_append and
> elm_fileselector_filters_clear to support mime type filter.
>     * Add the elm_scrollable_interface_content_viewport_resize_cb_set.
>     * added callback call "scroll", "scroll,anim,start",
> "scroll,anim,stop", "scroll,drag,start", "scroll,drag,stop" in toolar
> widget.
> +   * Add the configuration thumbscroll_flick_distance_tolerance.
>
>  Improvements:
>
> @@ -119,6 +120,7 @@ Improvements:
>     * Support language change for widget items (Ctxpopup, Hoversel,
> Naviframe, Diskselector, List, Menu, Segment_Control, Toolbar, Popup,
> MultibuttonEntry)
>     * Move cursor when mouse moves with longpress.
>     * Show magnifier when selection handlers are pressed or moved.
> +   * Change the method to calculate a distance which be scrolled from
> linear to sine curve.
>
>  Fixes:
>     * Now elm_datetime_field_limit_set() can set year limits wihtout
> problems.
> diff --git a/config/default/base.src b/config/default/base.src
> index 445a3cd..db85956 100644
> --- a/config/default/base.src
> +++ b/config/default/base.src
> @@ -6,6 +6,7 @@ group "Elm_Config" struct {
>    value "thumbscroll_threshold" int: 24;
>    value "thumbscroll_hold_threshold" int: 24;
>    value "thumbscroll_momentum_threshold" double: 100.0;
> +  value "thumbscroll_flick_distance_tolerance" int: 1000;
>    value "thumbscroll_friction" double: 1.0;
>    value "thumbscroll_min_friction" double: 1.0;
>    value "thumbscroll_friction_standard" double: 2000.0;
> diff --git a/config/mobile/base.src b/config/mobile/base.src
> index a3453ce..2b40577 100644
> --- a/config/mobile/base.src
> +++ b/config/mobile/base.src
> @@ -6,6 +6,7 @@ group "Elm_Config" struct {
>    value "thumbscroll_threshold" int: 24;
>    value "thumbscroll_hold_threshold" int: 100;
>    value "thumbscroll_momentum_threshold" double: 100.0;
> +  value "thumbscroll_flick_distance_tolerance" int: 1000;
>    value "thumbscroll_friction" double: 1.0;
>    value "thumbscroll_min_friction" double: 0.3;
>    value "thumbscroll_friction_standard" double: 3000.0;
> diff --git a/config/standard/base.src b/config/standard/base.src
> index e159689..c5a0f48 100644
> --- a/config/standard/base.src
> +++ b/config/standard/base.src
> @@ -6,6 +6,7 @@ group "Elm_Config" struct {
>    value "thumbscroll_threshold" int: 4;
>    value "thumbscroll_hold_threshold" int: 4;
>    value "thumbscroll_momentum_threshold" double: 100.0;
> +  value "thumbscroll_flick_distance_tolerance" int: 1000;
>    value "thumbscroll_friction" double: 1.0;
>    value "thumbscroll_min_friction" double: 1.0;
>    value "thumbscroll_friction_standard" double: 2000.0;
> diff --git a/src/bin/config.c b/src/bin/config.c
> index 6c3520f..4f37d9d 100644
> --- a/src/bin/config.c
> +++ b/src/bin/config.c
> @@ -347,6 +347,31 @@ tsmt_change(void *data       __UNUSED__,
>  }
>
>  static void
> +tsfdt_round(void *data       __UNUSED__,
> +            Evas_Object     *obj,
> +            void *event_info __UNUSED__)
> +{
> +   double val = elm_slider_value_get(obj);
> +   double v;
> +
> +   v = ((double)((int)(val * 10.0))) / 10.0;
> +   if (v != val) elm_slider_value_set(obj, v);
> +}
> +
> +static void
> +tsfdt_change(void *data       __UNUSED__,
> +             Evas_Object     *obj,
> +             void *event_info __UNUSED__)
> +{
> +   double tsfdt =
> elm_config_scroll_thumbscroll_flick_distance_tolerance_get();
> +   double val = elm_slider_value_get(obj);
> +
> +   if (tsfdt == val) return;
> +   elm_config_scroll_thumbscroll_flick_distance_tolerance_set(val);
> +   elm_config_all_flush();
> +}
> +
> +static void
>  tsf_round(void *data       __UNUSED__,
>            Evas_Object     *obj,
>            void *event_info __UNUSED__)
> @@ -1122,7 +1147,8 @@ _config_display_update(Evas_Object *win)
>  {
>     int flush_interval, font_c, image_c, edje_file_c, edje_col_c,
> ts_threshould,
>         ts_hold_threshold;
> -   double scale, s_bounce_friction, ts_momentum_threshold, ts_friction,
> +   double scale, s_bounce_friction, ts_momentum_threshold,
> +          ts_flick_distance_tolerance, ts_friction,
>            ts_min_friction, ts_friction_standard, ts_border_friction,
>            ts_sensitivity_friction, ts_acceleration_threshold,
>            ts_acceleration_time_limit, ts_acceleration_weight,
> page_friction,
> @@ -1148,6 +1174,7 @@ _config_display_update(Evas_Object *win)
>     ts_threshould = elm_config_scroll_thumbscroll_threshold_get();
>     ts_hold_threshold = elm_config_scroll_thumbscroll_hold_threshold_get();
>     ts_momentum_threshold =
> elm_config_scroll_thumbscroll_momentum_threshold_get();
> +   ts_flick_distance_tolerance =
> elm_config_scroll_thumbscroll_flick_distance_tolerance_get();
>     ts_friction = elm_config_scroll_thumbscroll_friction_get();
>     ts_min_friction = elm_config_scroll_thumbscroll_min_friction_get();
>     ts_friction_standard =
> elm_config_scroll_thumbscroll_friction_standard_get();
> @@ -1192,6 +1219,9 @@ _config_display_update(Evas_Object *win)
>
> "ts_momentum_threshold_slider"),
>                          ts_momentum_threshold);
>     elm_slider_value_set(evas_object_data_get(win,
> +
> "ts_flick_distance_tolerance_slider"),
> +                        ts_flick_distance_tolerance);
> +   elm_slider_value_set(evas_object_data_get(win,
>                                               "ts_friction_slider"),
>                          ts_friction);
>     elm_slider_value_set(evas_object_data_get(win,
> @@ -2888,6 +2918,27 @@ _status_config_scrolling(Evas_Object *win,
>     evas_object_smart_callback_add(sl, "delay,changed", tsmt_change,
>                                    NULL);
>
> +   LABEL_FRAME_ADD("<hilight>Thumb scroll flick distance tolerance</>");
> +
> +   sl = elm_slider_add(win);
> +   elm_object_tooltip_text_set(sl, "This is the number of pixels the
> maximum<br/>"
> +                                   "distance which can be flicked. If it
> is<br/>"
> +                                   "flicked more than this, the flick
> distance<br/>"
> +                                   "is same with maximum distance");
> +   evas_object_data_set(win, "ts_flick_distance_tolerance_slider", sl);
> +   evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
> +   evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
> +   elm_slider_span_size_set(sl, 120);
> +   elm_slider_unit_format_set(sl, "%1.0f pixels");
> +   elm_slider_indicator_format_set(sl, "%1.0f");
> +   elm_slider_min_max_set(sl, 100.0, 3000.0);
> +   elm_slider_value_set(sl,
> elm_config_scroll_thumbscroll_flick_distance_tolerance_get());
> +   elm_box_pack_end(bx, sl);
> +   evas_object_show(sl);
> +
> +   evas_object_smart_callback_add(sl, "changed", tsfdt_round, NULL);
> +   evas_object_smart_callback_add(sl, "delay,changed", tsfdt_change,
> NULL);
> +
>     LABEL_FRAME_ADD("<hilight>Thumb scroll friction</>");
>
>     sl = elm_slider_add(win);
> diff --git a/src/lib/elm_config.c b/src/lib/elm_config.c
> index 0220285..f158f2d 100644
> --- a/src/lib/elm_config.c
> +++ b/src/lib/elm_config.c
> @@ -342,6 +342,7 @@ _desc_init(void)
>     ELM_CONFIG_VAL(D, T, thumbscroll_threshold, T_INT);
>     ELM_CONFIG_VAL(D, T, thumbscroll_hold_threshold, T_INT);
>     ELM_CONFIG_VAL(D, T, thumbscroll_momentum_threshold, T_DOUBLE);
> +   ELM_CONFIG_VAL(D, T, thumbscroll_flick_distance_tolerance, T_INT);
>     ELM_CONFIG_VAL(D, T, thumbscroll_friction, T_DOUBLE);
>     ELM_CONFIG_VAL(D, T, thumbscroll_min_friction, T_DOUBLE);
>     ELM_CONFIG_VAL(D, T, thumbscroll_friction_standard, T_DOUBLE);
> @@ -1085,6 +1086,7 @@ _config_load(void)
>     _elm_config->thumbscroll_threshold = 24;
>     _elm_config->thumbscroll_hold_threshold = 24;
>     _elm_config->thumbscroll_momentum_threshold = 100.0;
> +   _elm_config->thumbscroll_flick_distance_tolerance = 1000;
>     _elm_config->thumbscroll_friction = 1.0;
>     _elm_config->thumbscroll_min_friction = 0.5;
>     _elm_config->thumbscroll_friction_standard = 1000.0;
> @@ -1507,6 +1509,8 @@ _env_get(void)
>     // FIXME: floatformat locale issues here 1.0 vs 1,0 - should just be
> 1.0
>     s = getenv("ELM_THUMBSCROLL_MOMENTUM_THRESHOLD");
>     if (s) _elm_config->thumbscroll_momentum_threshold = _elm_atof(s);
> +   s = getenv("ELM_THUMBSCROLL_FLICK_DISTANCE_TOLERANCE");
> +   if (s) _elm_config->thumbscroll_flick_distance_tolerance = atoi(s);
>     s = getenv("ELM_THUMBSCROLL_FRICTION");
>     if (s) _elm_config->thumbscroll_friction = _elm_atof(s);
>     s = getenv("ELM_THUMBSCROLL_MIN_FRICTION");
> @@ -2182,6 +2186,18 @@
> elm_config_scroll_thumbscroll_momentum_threshold_set(double threshold)
>     _elm_config->thumbscroll_momentum_threshold = threshold;
>  }
>
> +EAPI unsigned int
> +elm_config_scroll_thumbscroll_flick_distance_tolerance_get(void)
> +{
> +   return _elm_config->thumbscroll_flick_distance_tolerance;
> +}
> +
> +EAPI void
> +elm_config_scroll_thumbscroll_flick_distance_tolerance_set(unsigned int
> distance)
> +{
> +   _elm_config->thumbscroll_flick_distance_tolerance = distance;
> +}
> +
>  EAPI double
>  elm_config_scroll_thumbscroll_friction_get(void)
>  {
> diff --git a/src/lib/elm_config.h b/src/lib/elm_config.h
> index b9e38fc..6f1bd25 100644
> --- a/src/lib/elm_config.h
> +++ b/src/lib/elm_config.h
> @@ -350,6 +350,29 @@ EAPI double
> elm_config_scroll_thumbscroll_momentum_threshold_get(void);
>  EAPI void
> elm_config_scroll_thumbscroll_momentum_threshold_set(double threshold);
>
>  /**
> + * Get the number of pixels the maximum distance which can be flicked.
> + * If it is flicked more than this,
> + * the flick distance is same with maximum distance.
> + *
> + * @return the thumb scroll maximum flick distance
> + *
> + * @ingroup Scrolling
> + */
> +EAPI unsigned int
> elm_config_scroll_thumbscroll_flick_distance_tolerance_get(void);
> +
> +/**
> + * Set the number of pixels the maximum distance which can be flicked.
> + * If it is flicked more than this,
> + * the flick distance is same with maximum distance.
> + *
> + * @param distance the thumb scroll maximum flick distance
> + *
> + * @see elm_config_thumbscroll_flick_distance_tolerance_get()
> + * @ingroup Scrolling
> + */
> +EAPI void
> elm_config_scroll_thumbscroll_flick_distance_tolerance_set(unsigned int
> distance);
> +
> +/**
>   * Get the amount of inertia a scroller will impose at self scrolling
>   * animations.
>   *
> diff --git a/src/lib/elm_interface_scrollable.c
> b/src/lib/elm_interface_scrollable.c
> index 1aeb029..69e3025 100644
> --- a/src/lib/elm_interface_scrollable.c
> +++ b/src/lib/elm_interface_scrollable.c
> @@ -2400,6 +2400,7 @@ _elm_scroll_mouse_up_event_cb(void *data,
>                         if ((_elm_config->thumbscroll_friction > 0.0) &&
>                             (vel >
> _elm_config->thumbscroll_momentum_threshold))
>                           {
> +                            Evas_Coord vw, vh, max_d;
>                              int minx, miny, mx, my, px, py;
>                              double tt = 0.0, dtt = 0.0;
>
> @@ -2408,8 +2409,21 @@ _elm_scroll_mouse_up_event_cb(void *data,
>                              eo_do(sid->pan_obj, elm_obj_pan_pos_max_get
>                                    (&mx, &my));
>                              eo_do(sid->pan_obj, elm_obj_pan_pos_get(&px,
> &py));
> -                            sid->down.dx = ((double)dx / at);
> -                            sid->down.dy = ((double)dy / at);
> +                            eo_do(sid->obj,
> +
>  elm_scrollable_interface_content_viewport_size_get(&vw, &vh));
>

Above line is not needed.
vw and vh are not needed as well.



> +                            max_d =
> _elm_config->thumbscroll_flick_distance_tolerance;
> +                            if (dx > 0)
> +                              sid->down.dx = (sin((M_PI * (double)dx /
> max_d)
> +                                                  - (M_PI / 2)) + 1) *
> max_d / at;
>

How about using braces here? { }
It will look better :)

Thanks.

Daniel Juyung Seo (SeoZ)


> +                            else
> +                              sid->down.dx = (sin((M_PI * (double)dx /
> max_d)
> +                                                  + (M_PI / 2)) - 1) *
> max_d / at;
> +                            if (dy > 0)
> +                              sid->down.dy = (sin((M_PI * (double)dy /
> max_d)
> +                                                  - (M_PI / 2)) + 1) *
> max_d / at;
> +                            else
> +                              sid->down.dy = (sin((M_PI * (double)dy /
> max_d)
> +                                                  + (M_PI / 2)) - 1) *
> max_d / at;
>                              if (((sid->down.dx > 0) && (sid->down.pdx >
> 0)) ||
>                                  ((sid->down.dx < 0) && (sid->down.pdx <
> 0)) ||
>                                  ((sid->down.dy > 0) && (sid->down.pdy >
> 0)) ||
> diff --git a/src/lib/elm_priv.h b/src/lib/elm_priv.h
> index 6100b6f..cd47346 100644
> --- a/src/lib/elm_priv.h
> +++ b/src/lib/elm_priv.h
> @@ -161,6 +161,7 @@ struct _Elm_Config
>     int           thumbscroll_threshold;
>     int           thumbscroll_hold_threshold;
>     double        thumbscroll_momentum_threshold;
> +   int           thumbscroll_flick_distance_tolerance;
>     double        thumbscroll_friction;
>     double        thumbscroll_min_friction;
>     double        thumbscroll_friction_standard;
>
> --
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
>
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to