summaryrefslogtreecommitdiff
path: root/src/lib/elementary/elm_config.c
diff options
context:
space:
mode:
authorWonki Kim <wonki_.kim@samsung.com>2018-08-29 15:58:10 +0900
committerHermet Park <hermetpark@gmail.com>2018-08-29 15:58:10 +0900
commit6409cfa41b19f04ef7b4247d078d626e9ec77a8f (patch)
treea728dffaca510eae41e89aa147ff5ac2df370c8d /src/lib/elementary/elm_config.c
parent78fb9cf124e80d85e443a6bc5afe2819ee120e1a (diff)
scroller: refactory a momentum scroll animator
Summary: this patch refactories a momentum scroll animator logics. 1. animation duration animating runs within a one second now. and if it needs more time to animate, it decrease intepolation progress by dividing some value. current logic makes sense however, it is not easy to read to know how it works. this patch modify current logic to calculate distance to move, and time to animate. 2. distance to move we can apply simple physics something like mass of pan and friction of scroller itself. but this patch apply just geometric seqeunce to calculate distance to go. it's more easy to customize behavior of scroller than current sine graph based one. 3. accelerate logic scroller sets 'extra_time' to accelerate a scroller for now. but this patch modify logic not to use it. however it uses current momenutum velocity as a bais of next momentum animating. @feature Reviewers: zmike, #reviewers, Hermet Reviewed By: #reviewers, Hermet Subscribers: Hermet, cedric, zmike Tags: #efl, #do_not_merge Differential Revision: https://phab.enlightenment.org/D6643
Diffstat (limited to 'src/lib/elementary/elm_config.c')
-rw-r--r--src/lib/elementary/elm_config.c100
1 files changed, 94 insertions, 6 deletions
diff --git a/src/lib/elementary/elm_config.c b/src/lib/elementary/elm_config.c
index bfe133bbc9..fb8acf1d94 100644
--- a/src/lib/elementary/elm_config.c
+++ b/src/lib/elementary/elm_config.c
@@ -399,24 +399,34 @@ _desc_init(void)
399 ELM_CONFIG_VAL(D, T, web_backend, T_STRING); 399 ELM_CONFIG_VAL(D, T, web_backend, T_STRING);
400 ELM_CONFIG_VAL(D, T, accel_override, T_UCHAR); 400 ELM_CONFIG_VAL(D, T, accel_override, T_UCHAR);
401 ELM_CONFIG_VAL(D, T, vsync, T_UCHAR); 401 ELM_CONFIG_VAL(D, T, vsync, T_UCHAR);
402 //
402 ELM_CONFIG_VAL(D, T, thumbscroll_enable, T_UCHAR); 403 ELM_CONFIG_VAL(D, T, thumbscroll_enable, T_UCHAR);
403 ELM_CONFIG_VAL(D, T, thumbscroll_threshold, T_INT); 404 ELM_CONFIG_VAL(D, T, thumbscroll_threshold, T_INT);
404 ELM_CONFIG_VAL(D, T, thumbscroll_hold_threshold, T_INT); 405 ELM_CONFIG_VAL(D, T, thumbscroll_hold_threshold, T_INT);
405 ELM_CONFIG_VAL(D, T, thumbscroll_momentum_threshold, T_DOUBLE); 406 // bounce
406 ELM_CONFIG_VAL(D, T, thumbscroll_flick_distance_tolerance, T_INT);
407 ELM_CONFIG_VAL(D, T, thumbscroll_friction, T_DOUBLE);
408 ELM_CONFIG_VAL(D, T, thumbscroll_min_friction, T_DOUBLE);
409 ELM_CONFIG_VAL(D, T, thumbscroll_friction_standard, T_DOUBLE);
410 ELM_CONFIG_VAL(D, T, thumbscroll_bounce_friction, T_DOUBLE); 407 ELM_CONFIG_VAL(D, T, thumbscroll_bounce_friction, T_DOUBLE);
408 ELM_CONFIG_VAL(D, T, thumbscroll_bounce_enable, T_UCHAR);
411 ELM_CONFIG_VAL(D, T, thumbscroll_border_friction, T_DOUBLE); 409 ELM_CONFIG_VAL(D, T, thumbscroll_border_friction, T_DOUBLE);
412 ELM_CONFIG_VAL(D, T, thumbscroll_sensitivity_friction, T_DOUBLE); 410 ELM_CONFIG_VAL(D, T, thumbscroll_sensitivity_friction, T_DOUBLE);
411 // momeuntum
412 ELM_CONFIG_VAL(D, T, thumbscroll_momentum_threshold, T_DOUBLE);
413 ELM_CONFIG_VAL(D, T, thumbscroll_momentum_distance_max, T_INT);
414 ELM_CONFIG_VAL(D, T, thumbscroll_momentum_friction, T_DOUBLE);
415 ELM_CONFIG_VAL(D, T, thumbscroll_momentum_animation_duration_min_limit, T_DOUBLE);
416 ELM_CONFIG_VAL(D, T, thumbscroll_momentum_animation_duration_max_limit, T_DOUBLE);
417 // acceleration
413 ELM_CONFIG_VAL(D, T, thumbscroll_acceleration_threshold, T_DOUBLE); 418 ELM_CONFIG_VAL(D, T, thumbscroll_acceleration_threshold, T_DOUBLE);
414 ELM_CONFIG_VAL(D, T, thumbscroll_acceleration_time_limit, T_DOUBLE); 419 ELM_CONFIG_VAL(D, T, thumbscroll_acceleration_time_limit, T_DOUBLE);
415 ELM_CONFIG_VAL(D, T, thumbscroll_acceleration_weight, T_DOUBLE); 420 ELM_CONFIG_VAL(D, T, thumbscroll_acceleration_weight, T_DOUBLE);
421 //deprecated
422 ELM_CONFIG_VAL(D, T, thumbscroll_friction, T_DOUBLE);
423 ELM_CONFIG_VAL(D, T, thumbscroll_min_friction, T_DOUBLE);
424 ELM_CONFIG_VAL(D, T, thumbscroll_friction_standard, T_DOUBLE);
425 ELM_CONFIG_VAL(D, T, thumbscroll_flick_distance_tolerance, T_INT);
426 //
416 ELM_CONFIG_VAL(D, T, page_scroll_friction, T_DOUBLE); 427 ELM_CONFIG_VAL(D, T, page_scroll_friction, T_DOUBLE);
417 ELM_CONFIG_VAL(D, T, bring_in_scroll_friction, T_DOUBLE); 428 ELM_CONFIG_VAL(D, T, bring_in_scroll_friction, T_DOUBLE);
418 ELM_CONFIG_VAL(D, T, zoom_friction, T_DOUBLE); 429 ELM_CONFIG_VAL(D, T, zoom_friction, T_DOUBLE);
419 ELM_CONFIG_VAL(D, T, thumbscroll_bounce_enable, T_UCHAR);
420 ELM_CONFIG_VAL(D, T, scroll_smooth_start_enable, T_UCHAR); 430 ELM_CONFIG_VAL(D, T, scroll_smooth_start_enable, T_UCHAR);
421 ELM_CONFIG_VAL(D, T, scroll_animation_disable, T_UCHAR); 431 ELM_CONFIG_VAL(D, T, scroll_animation_disable, T_UCHAR);
422 ELM_CONFIG_VAL(D, T, scroll_accel_factor, T_DOUBLE); 432 ELM_CONFIG_VAL(D, T, scroll_accel_factor, T_DOUBLE);
@@ -1742,7 +1752,9 @@ _config_load(void)
1742 _elm_config->thumbscroll_hold_threshold = 24; 1752 _elm_config->thumbscroll_hold_threshold = 24;
1743 _elm_config->thumbscroll_momentum_threshold = 100.0; 1753 _elm_config->thumbscroll_momentum_threshold = 100.0;
1744 _elm_config->thumbscroll_flick_distance_tolerance = 1000; 1754 _elm_config->thumbscroll_flick_distance_tolerance = 1000;
1755 _elm_config->thumbscroll_momentum_distance_max = 1000;
1745 _elm_config->thumbscroll_friction = 1.0; 1756 _elm_config->thumbscroll_friction = 1.0;
1757 _elm_config->thumbscroll_momentum_friction = 1.0;
1746 _elm_config->thumbscroll_min_friction = 0.5; 1758 _elm_config->thumbscroll_min_friction = 0.5;
1747 _elm_config->thumbscroll_friction_standard = 1000.0; 1759 _elm_config->thumbscroll_friction_standard = 1000.0;
1748 _elm_config->thumbscroll_bounce_friction = 0.5; 1760 _elm_config->thumbscroll_bounce_friction = 0.5;
@@ -1750,6 +1762,8 @@ _config_load(void)
1750 _elm_config->thumbscroll_acceleration_threshold = 500.0; 1762 _elm_config->thumbscroll_acceleration_threshold = 500.0;
1751 _elm_config->thumbscroll_acceleration_time_limit = 0.7; 1763 _elm_config->thumbscroll_acceleration_time_limit = 0.7;
1752 _elm_config->thumbscroll_acceleration_weight = 1.5; 1764 _elm_config->thumbscroll_acceleration_weight = 1.5;
1765 _elm_config->thumbscroll_momentum_animation_duration_min_limit = 0.3;
1766 _elm_config->thumbscroll_momentum_animation_duration_max_limit = 1.5;
1753 _elm_config->page_scroll_friction = 0.5; 1767 _elm_config->page_scroll_friction = 0.5;
1754 _elm_config->bring_in_scroll_friction = 0.5; 1768 _elm_config->bring_in_scroll_friction = 0.5;
1755 _elm_config->zoom_friction = 0.5; 1769 _elm_config->zoom_friction = 0.5;
@@ -1896,13 +1910,19 @@ _elm_config_reload_do(void)
1896 KEEP_VAL(thumbscroll_hold_threshold); 1910 KEEP_VAL(thumbscroll_hold_threshold);
1897 KEEP_VAL(thumbscroll_momentum_threshold); 1911 KEEP_VAL(thumbscroll_momentum_threshold);
1898 KEEP_VAL(thumbscroll_flick_distance_tolerance); 1912 KEEP_VAL(thumbscroll_flick_distance_tolerance);
1913 KEEP_VAL(thumbscroll_momentum_distance_max);
1899 KEEP_VAL(thumbscroll_friction); 1914 KEEP_VAL(thumbscroll_friction);
1915 KEEP_VAL(thumbscroll_momentum_friction);
1900 KEEP_VAL(thumbscroll_min_friction); 1916 KEEP_VAL(thumbscroll_min_friction);
1901 KEEP_VAL(thumbscroll_friction_standard); 1917 KEEP_VAL(thumbscroll_friction_standard);
1902 KEEP_VAL(thumbscroll_bounce_friction); 1918 KEEP_VAL(thumbscroll_bounce_friction);
1903 KEEP_VAL(thumbscroll_acceleration_threshold); 1919 KEEP_VAL(thumbscroll_acceleration_threshold);
1904 KEEP_VAL(thumbscroll_acceleration_time_limit); 1920 KEEP_VAL(thumbscroll_acceleration_time_limit);
1905 KEEP_VAL(thumbscroll_acceleration_weight); 1921 KEEP_VAL(thumbscroll_acceleration_weight);
1922
1923 KEEP_VAL(thumbscroll_momentum_animation_duration_min_limit);
1924 KEEP_VAL(thumbscroll_momentum_animation_duration_max_limit);
1925
1906 KEEP_VAL(page_scroll_friction); 1926 KEEP_VAL(page_scroll_friction);
1907 KEEP_VAL(bring_in_scroll_friction); 1927 KEEP_VAL(bring_in_scroll_friction);
1908 KEEP_VAL(zoom_friction); 1928 KEEP_VAL(zoom_friction);
@@ -2557,8 +2577,12 @@ _env_get(void)
2557 if (s) _elm_config->thumbscroll_momentum_threshold = _elm_atof(s); 2577 if (s) _elm_config->thumbscroll_momentum_threshold = _elm_atof(s);
2558 s = getenv("ELM_THUMBSCROLL_FLICK_DISTANCE_TOLERANCE"); 2578 s = getenv("ELM_THUMBSCROLL_FLICK_DISTANCE_TOLERANCE");
2559 if (s) _elm_config->thumbscroll_flick_distance_tolerance = atoi(s); 2579 if (s) _elm_config->thumbscroll_flick_distance_tolerance = atoi(s);
2580 s = getenv("ELM_THUMBSCROLL_MOMENTUM_DISTANCE_MAX");
2581 if (s) _elm_config->thumbscroll_momentum_distance_max = atoi(s);
2560 s = getenv("ELM_THUMBSCROLL_FRICTION"); 2582 s = getenv("ELM_THUMBSCROLL_FRICTION");
2561 if (s) _elm_config->thumbscroll_friction = _elm_atof(s); 2583 if (s) _elm_config->thumbscroll_friction = _elm_atof(s);
2584 s = getenv("ELM_THUMBSCROLL_MOMENTUM_FRICTION");
2585 if (s) _elm_config->thumbscroll_momentum_friction = _elm_atof(s);
2562 s = getenv("ELM_THUMBSCROLL_MIN_FRICTION"); 2586 s = getenv("ELM_THUMBSCROLL_MIN_FRICTION");
2563 if (s) _elm_config->thumbscroll_min_friction = _elm_atof(s); 2587 if (s) _elm_config->thumbscroll_min_friction = _elm_atof(s);
2564 s = getenv("ELM_THUMBSCROLL_FRICTION_STANDARD"); 2588 s = getenv("ELM_THUMBSCROLL_FRICTION_STANDARD");
@@ -3675,6 +3699,19 @@ elm_config_scroll_thumbscroll_flick_distance_tolerance_set(unsigned int distance
3675 _elm_config->thumbscroll_flick_distance_tolerance = distance; 3699 _elm_config->thumbscroll_flick_distance_tolerance = distance;
3676} 3700}
3677 3701
3702EAPI unsigned int
3703elm_config_scroll_thumbscroll_momentum_distance_max_get(void)
3704{
3705 return _elm_config->thumbscroll_momentum_distance_max;
3706}
3707
3708EAPI void
3709elm_config_scroll_thumbscroll_momentum_distance_max_set(unsigned int distance)
3710{
3711 _elm_config->priv.thumbscroll_momentum_distance_max = EINA_TRUE;
3712 _elm_config->thumbscroll_momentum_distance_max = distance;
3713}
3714
3678EAPI double 3715EAPI double
3679elm_config_scroll_thumbscroll_friction_get(void) 3716elm_config_scroll_thumbscroll_friction_get(void)
3680{ 3717{
@@ -3689,6 +3726,19 @@ elm_config_scroll_thumbscroll_friction_set(double friction)
3689} 3726}
3690 3727
3691EAPI double 3728EAPI double
3729elm_config_scroll_thumbscroll_momentum_friction_get(void)
3730{
3731 return _elm_config->thumbscroll_momentum_friction;
3732}
3733
3734EAPI void
3735elm_config_scroll_thumbscroll_momentum_friction_set(double friction)
3736{
3737 _elm_config->priv.thumbscroll_momentum_friction = EINA_TRUE;
3738 _elm_config->thumbscroll_momentum_friction = friction;
3739}
3740
3741EAPI double
3692elm_config_scroll_thumbscroll_min_friction_get(void) 3742elm_config_scroll_thumbscroll_min_friction_get(void)
3693{ 3743{
3694 return _elm_config->thumbscroll_min_friction; 3744 return _elm_config->thumbscroll_min_friction;
@@ -3867,6 +3917,32 @@ elm_config_scroll_thumbscroll_acceleration_weight_set(double weight)
3867 _elm_config->thumbscroll_acceleration_weight = weight; 3917 _elm_config->thumbscroll_acceleration_weight = weight;
3868} 3918}
3869 3919
3920EAPI double
3921elm_config_scroll_thumbscroll_momentum_animation_duration_min_limit_get(void)
3922{
3923 return _elm_config->thumbscroll_momentum_animation_duration_min_limit;
3924}
3925
3926EAPI void
3927elm_config_scroll_thumbscroll_momentum_animation_duration_min_limit_set(double min)
3928{
3929 _elm_config->priv.thumbscroll_momentum_animation_duration_min_limit = EINA_TRUE;
3930 _elm_config->thumbscroll_momentum_animation_duration_min_limit = min;
3931}
3932
3933EAPI double
3934elm_config_scroll_thumbscroll_momentum_animation_duration_max_limit_get(void)
3935{
3936 return _elm_config->thumbscroll_momentum_animation_duration_max_limit;
3937}
3938
3939EAPI void
3940elm_config_scroll_thumbscroll_momentum_animation_duration_max_limit_set(double max)
3941{
3942 _elm_config->priv.thumbscroll_momentum_animation_duration_max_limit = EINA_TRUE;
3943 _elm_config->thumbscroll_momentum_animation_duration_max_limit = max;
3944}
3945
3870EAPI Elm_Focus_Autoscroll_Mode 3946EAPI Elm_Focus_Autoscroll_Mode
3871elm_config_focus_autoscroll_mode_get(void) 3947elm_config_focus_autoscroll_mode_get(void)
3872{ 3948{
@@ -4888,7 +4964,9 @@ _efl_config_global_efl_config_config_set(Eo *obj EINA_UNUSED, void *_pd EINA_UNU
4888 CONFIG_SETI(scroll_thumbscroll_hold_threshold); 4964 CONFIG_SETI(scroll_thumbscroll_hold_threshold);
4889 CONFIG_SETD(scroll_thumbscroll_momentum_threshold); 4965 CONFIG_SETD(scroll_thumbscroll_momentum_threshold);
4890 CONFIG_SETI(scroll_thumbscroll_flick_distance_tolerance); 4966 CONFIG_SETI(scroll_thumbscroll_flick_distance_tolerance);
4967 CONFIG_SETI(scroll_thumbscroll_momentum_distance_max);
4891 CONFIG_SETD(scroll_thumbscroll_friction); 4968 CONFIG_SETD(scroll_thumbscroll_friction);
4969 CONFIG_SETD(scroll_thumbscroll_momentum_friction);
4892 CONFIG_SETD(scroll_thumbscroll_min_friction); 4970 CONFIG_SETD(scroll_thumbscroll_min_friction);
4893 CONFIG_SETD(scroll_thumbscroll_friction_standard); 4971 CONFIG_SETD(scroll_thumbscroll_friction_standard);
4894 CONFIG_SETD(scroll_thumbscroll_border_friction); 4972 CONFIG_SETD(scroll_thumbscroll_border_friction);
@@ -4901,6 +4979,10 @@ _efl_config_global_efl_config_config_set(Eo *obj EINA_UNUSED, void *_pd EINA_UNU
4901 CONFIG_SETD(scroll_thumbscroll_acceleration_threshold); 4979 CONFIG_SETD(scroll_thumbscroll_acceleration_threshold);
4902 CONFIG_SETD(scroll_thumbscroll_acceleration_time_limit); 4980 CONFIG_SETD(scroll_thumbscroll_acceleration_time_limit);
4903 CONFIG_SETD(scroll_thumbscroll_acceleration_weight); 4981 CONFIG_SETD(scroll_thumbscroll_acceleration_weight);
4982
4983 CONFIG_SETD(scroll_thumbscroll_momentum_animation_duration_min_limit);
4984 CONFIG_SETD(scroll_thumbscroll_momentum_animation_duration_max_limit);
4985
4904 CONFIG_SETE(focus_autoscroll_mode); 4986 CONFIG_SETE(focus_autoscroll_mode);
4905 CONFIG_SETE(slider_indicator_visible_mode); 4987 CONFIG_SETE(slider_indicator_visible_mode);
4906 CONFIG_SETD(longpress_timeout); 4988 CONFIG_SETD(longpress_timeout);
@@ -5026,7 +5108,9 @@ _efl_config_global_efl_config_config_get(const Eo *obj EINA_UNUSED, void *_pd EI
5026 CONFIG_GETI(scroll_thumbscroll_hold_threshold); 5108 CONFIG_GETI(scroll_thumbscroll_hold_threshold);
5027 CONFIG_GETD(scroll_thumbscroll_momentum_threshold); 5109 CONFIG_GETD(scroll_thumbscroll_momentum_threshold);
5028 CONFIG_GETI(scroll_thumbscroll_flick_distance_tolerance); 5110 CONFIG_GETI(scroll_thumbscroll_flick_distance_tolerance);
5111 CONFIG_GETI(scroll_thumbscroll_momentum_distance_max);
5029 CONFIG_GETD(scroll_thumbscroll_friction); 5112 CONFIG_GETD(scroll_thumbscroll_friction);
5113 CONFIG_GETD(scroll_thumbscroll_momentum_friction);
5030 CONFIG_GETD(scroll_thumbscroll_min_friction); 5114 CONFIG_GETD(scroll_thumbscroll_min_friction);
5031 CONFIG_GETD(scroll_thumbscroll_friction_standard); 5115 CONFIG_GETD(scroll_thumbscroll_friction_standard);
5032 CONFIG_GETD(scroll_thumbscroll_border_friction); 5116 CONFIG_GETD(scroll_thumbscroll_border_friction);
@@ -5039,6 +5123,10 @@ _efl_config_global_efl_config_config_get(const Eo *obj EINA_UNUSED, void *_pd EI
5039 CONFIG_GETD(scroll_thumbscroll_acceleration_threshold); 5123 CONFIG_GETD(scroll_thumbscroll_acceleration_threshold);
5040 CONFIG_GETD(scroll_thumbscroll_acceleration_time_limit); 5124 CONFIG_GETD(scroll_thumbscroll_acceleration_time_limit);
5041 CONFIG_GETD(scroll_thumbscroll_acceleration_weight); 5125 CONFIG_GETD(scroll_thumbscroll_acceleration_weight);
5126
5127 CONFIG_GETD(scroll_thumbscroll_momentum_animation_duration_min_limit);
5128 CONFIG_GETD(scroll_thumbscroll_momentum_animation_duration_max_limit);
5129
5042 CONFIG_GETE(focus_autoscroll_mode); 5130 CONFIG_GETE(focus_autoscroll_mode);
5043 CONFIG_GETE(slider_indicator_visible_mode); 5131 CONFIG_GETE(slider_indicator_visible_mode);
5044 CONFIG_GETD(longpress_timeout); 5132 CONFIG_GETD(longpress_timeout);