forgot to make window of smoothing configurable. fix minor macro
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 10 Jun 2011 05:07:21 +0000 (05:07 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 10 Jun 2011 05:07:21 +0000 (05:07 +0000)
oopsie too.

git-svn-id: https://svn.enlightenment.org/svn/e/trunk/elementary@60165 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

config/illume/base.src
config/standard/base.src
src/bin/test.c
src/lib/elm_config.c
src/lib/elm_priv.h
src/lib/els_scroller.c

index 02a73c5..5945aa7 100644 (file)
@@ -14,7 +14,8 @@ group "Elm_Config" struct {
   value "thumbscroll_border_friction" double: 0.5;
   value "scroll_smooth_amount" double: 1.0;
   value "scroll_smooth_history_weight" double: 0.3;
-  value "scroll_smooth_future_time" double: 0.033;
+  value "scroll_smooth_future_time" double: 0.0;
+  value "scroll_smooth_time_window" double: 0.15;
   value "scale" double: 1.0;
   value "bgpixmap" int: 0;
   value "compositing" int: 1;
index d87ce46..b9aa1e4 100644 (file)
@@ -14,7 +14,8 @@ group "Elm_Config" struct {
   value "thumbscroll_border_friction" double: 0.5;
   value "scroll_smooth_amount" double: 0.0;
   value "scroll_smooth_history_weight" double: 0.3;
-  value "scroll_smooth_future_time" double: 0.033;
+  value "scroll_smooth_future_time" double: 0.0;
+  value "scroll_smooth_time_window" double: 0.15;
   value "scale" double: 1.0;
   value "bgpixmap" int: 0;
   value "compositing" int: 1;
index 359f3f0..00405cb 100644 (file)
@@ -454,9 +454,6 @@ elm_main(int argc, char **argv)
    elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR);
    elm_app_compile_data_dir_set(PACKAGE_DATA_DIR);
 
-   printf("my prefix: %s\n", elm_app_prefix_dir_get());
-
-   printf("elm test data in %s\n", elm_app_data_dir_get());
    /* if called with a single argument try to autorun a test with
     * the same name as the given param
     * ex:  elementary_test "Box Vert 2" */
index 9465b9b..2838b90 100644 (file)
@@ -571,6 +571,7 @@ _desc_init(void)
    ELM_CONFIG_VAL(D, T, scroll_smooth_amount, T_DOUBLE);
    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, scale, T_DOUBLE);
    ELM_CONFIG_VAL(D, T, bgpixmap, T_INT);
    ELM_CONFIG_VAL(D, T, compositing, T_INT);
@@ -1124,6 +1125,7 @@ _config_load(void)
    _elm_config->scroll_smooth_amount = 1.0;
    _elm_config->scroll_smooth_history_weight = 0.3;
    _elm_config->scroll_smooth_future_time = 2.0 / 60.0;
+   _elm_config->scroll_smooth_time_window = 0.12;
    _elm_config->scale = 1.0;
    _elm_config->bgpixmap = 0;
    _elm_config->compositing = 1;
@@ -1481,6 +1483,8 @@ _env_get(void)
    if (s) _elm_config->scroll_smooth_history_weight = atof(s);
    s = getenv("ELM_SCROLL_SMOOTH_FUTURE_TIME");
    if (s) _elm_config->scroll_smooth_future_time = atof(s);
+   s = getenv("ELM_SCROLL_SMOOTH_TIME_WINDOW");
+   if (s) _elm_config->scroll_smooth_time_window = atof(s);
    s = getenv("ELM_THEME");
    if (s) eina_stringshare_replace(&_elm_config->theme, s);
 
index 4e02833..05d1503 100644 (file)
@@ -99,6 +99,7 @@ struct _Elm_Config
    double         scroll_smooth_amount;
    double         scroll_smooth_history_weight;
    double         scroll_smooth_future_time;
+   double         scroll_smooth_time_window;
    double         scale;
    int            bgpixmap;
    int            compositing;
index bf51363..c424a94 100644 (file)
@@ -1595,6 +1595,9 @@ _smart_event_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSE
           {
              sd->down.hist.est_timestamp_diff =
                 ecore_loop_time_get() - ((double)ev->timestamp / 1000.0);
+             sd->down.hist.tadd = 0.0;
+             sd->down.hist.dxsum = 0.0;
+             sd->down.hist.dysum = 0.0;
              sd->down.now = 1;
              sd->down.dragged = 0;
              sd->down.dir_x = 0;
@@ -1688,7 +1691,7 @@ _smart_hold_animator(void *data)
              // oldest point is sd->down.history[i]
              // newset is sd->down.history[0]
              dt = t - sd->down.history[i].timestamp;
-             if (dt > 0.1)
+             if (dt > _elm_config->scroll_smooth_time_window)
                {
                   i--;
                   break;
@@ -1732,7 +1735,7 @@ _smart_hold_animator(void *data)
              ysum /= (double)i;
              tadd = tnow - sd->down.history[0].timestamp + _elm_config->scroll_smooth_future_time;
              tadd = tadd - (maxdt / 2);
-#define WEIGHT(n, o, v) n = (o * (v - 1.0)) + (n * v)
+#define WEIGHT(n, o, v) n = (((double)o * (1.0 - v)) + ((double)n * v))
              WEIGHT(tadd, sd->down.hist.tadd, _elm_config->scroll_smooth_history_weight);
              WEIGHT(dxsum, sd->down.hist.dxsum, _elm_config->scroll_smooth_history_weight);
              WEIGHT(dysum, sd->down.hist.dysum, _elm_config->scroll_smooth_history_weight);
@@ -1741,8 +1744,8 @@ _smart_hold_animator(void *data)
              sd->down.hist.tadd = tadd;
              sd->down.hist.dxsum = dxsum;
              sd->down.hist.dysum = dysum;
-             fx = WEIGHT(fx, sd->down.hold_x, _elm_config->scroll_smooth_amount);
-             fy = WEIGHT(fy, sd->down.hold_y, _elm_config->scroll_smooth_amount);
+             WEIGHT(fx, sd->down.hold_x, _elm_config->scroll_smooth_amount);
+             WEIGHT(fy, sd->down.hold_y, _elm_config->scroll_smooth_amount);
           }
      }