[*][Scroller] merge from upstream revision 64051, but didn't accept data/theme/widget...
[framework/uifw/elementary.git] / src / lib / elm_config.c
index ca87a80..033c30e 100644 (file)
@@ -74,7 +74,7 @@ static size_t _elm_user_dir_snprintf(char       *dst,
 #ifdef HAVE_ELEMENTARY_X
 static Ecore_Event_Handler *_prop_change_handler = NULL;
 static Ecore_X_Window _root_1st = 0;
-#define ATOM_COUNT 22
+#define ATOM_COUNT 23
 static Ecore_X_Atom _atom[ATOM_COUNT];
 static Ecore_X_Atom _atom_config = 0;
 static const char *_atom_names[ATOM_COUNT] =
@@ -97,12 +97,10 @@ static const char *_atom_names[ATOM_COUNT] =
    "ENLIGHTENMENT_THUMBSCROLL_MOMENTUM_THRESHOLD",
    "ENLIGHTENMENT_THUMBSCROLL_FRICTION",
    "ENLIGHTENMENT_THUMBSCROLL_BORDER_FRICTION",
+   "ENLIGHTENMENT_THUMBSCROLL_SENSITIVITY_FRICTION",
    "ENLIGHTENMENT_THUMBSCROLL_PAGE_SCROLL_FRICTION",
    "ENLIGHTENMENT_THUMBSCROLL_BRING_IN_SCROLL_FRICTION",
    "ENLIGHTENMENT_THUMBSCROLL_ZOOM_FRICTION",
-   "ENLIGHTENMENT_INPUT_PANEL",
-   "ENLIGHTENMENT_AUTOCAPITAL_ALLOW",
-   "ENLIGHTENMENT_AUTOPERIOD_ALLOW",
    "ENLIGHTENMENT_CONFIG"
 };
 #define ATOM_E_SCALE                                0
@@ -123,13 +121,11 @@ static const char *_atom_names[ATOM_COUNT] =
 #define ATOM_E_THUMBSCROLL_MOMENTUM_THRESHOLD       15
 #define ATOM_E_THUMBSCROLL_FRICTION                 16
 #define ATOM_E_THUMBSCROLL_BORDER_FRICTION          17
-#define ATOM_E_THUMBSCROLL_PAGE_SCROLL_FRICTION     18
-#define ATOM_E_THUMBSCROLL_BRING_IN_SCROLL_FRICTION 19
-#define ATOM_E_THUMBSCROLL_ZOOM_FRICTION            20
-#define ATOM_E_CONFIG                               21
-#define ATOM_E_INPUT_PANEL                          22
-#define ATOM_E_AUTOCAPITAL_ALLOW                    23
-#define ATOM_E_AUTOPERIOD_ALLOW                     24
+#define ATOM_E_THUMBSCROLL_SENSITIVITY_FRICTION     18
+#define ATOM_E_THUMBSCROLL_PAGE_SCROLL_FRICTION     19
+#define ATOM_E_THUMBSCROLL_BRING_IN_SCROLL_FRICTION 20
+#define ATOM_E_THUMBSCROLL_ZOOM_FRICTION            21
+#define ATOM_E_CONFIG                               22
 
 static Eina_Bool _prop_config_get(void);
 static Eina_Bool _prop_change(void *data  __UNUSED__,
@@ -470,7 +466,7 @@ _prop_change(void *data  __UNUSED__,
                      (double)val / 1000.0;
                }
           }
-        else if (event->atom == _atom[ATOM_E_THUMBSCROLL_PAGE_SCROLL_FRICTION])
+        else if (event->atom == _atom[ATOM_E_THUMBSCROLL_SENSITIVITY_FRICTION])
           {
              unsigned int val = 1000;
 
@@ -478,12 +474,11 @@ _prop_change(void *data  __UNUSED__,
                                                 event->atom,
                                                 &val, 1) > 0)
                {
-                  _elm_config->page_scroll_friction =
+                  _elm_config->thumbscroll_sensitivity_friction =
                      (double)val / 1000.0;
                }
           }
-        else if (event->atom ==
-                 _atom[ATOM_E_THUMBSCROLL_BRING_IN_SCROLL_FRICTION])
+        else if (event->atom == _atom[ATOM_E_THUMBSCROLL_PAGE_SCROLL_FRICTION])
           {
              unsigned int val = 1000;
 
@@ -491,12 +486,12 @@ _prop_change(void *data  __UNUSED__,
                                                 event->atom,
                                                 &val, 1) > 0)
                {
-                  _elm_config->bring_in_scroll_friction =
+                  _elm_config->page_scroll_friction =
                      (double)val / 1000.0;
                }
           }
         else if (event->atom ==
-                 _atom[ATOM_E_THUMBSCROLL_ZOOM_FRICTION])
+                 _atom[ATOM_E_THUMBSCROLL_BRING_IN_SCROLL_FRICTION])
           {
              unsigned int val = 1000;
 
@@ -504,61 +499,20 @@ _prop_change(void *data  __UNUSED__,
                                                 event->atom,
                                                 &val, 1) > 0)
                {
-                    _elm_config->zoom_friction = (double)val / 1000.0;
-               }
-          }
-        else if (event->atom == _atom[ATOM_E_INPUT_PANEL])
-          {
-             unsigned int val = 0;
-
-             if (ecore_x_window_prop_card32_get(event->win,
-                                                event->atom,
-                                                &val, 1) > 0)
-               {
-                   int input_panel_enable;
-
-                   input_panel_enable = _elm_config->input_panel_enable;
-                   _elm_config->input_panel_enable = val;
-                   if (input_panel_enable != _elm_config->input_panel_enable)
-                     {
-                        edje_input_panel_enabled_set(_elm_config->input_panel_enable);
-                     }
-               }
-          }
-        else if (event->atom == _atom[ATOM_E_AUTOCAPITAL_ALLOW])
-          {
-             unsigned int val = 0;
-
-             if (ecore_x_window_prop_card32_get(event->win,
-                                                event->atom,
-                                                &val, 1) > 0)
-               {
-                   int autocapital_allow;
-
-                   autocapital_allow = _elm_config->autocapital_allow;
-                   _elm_config->autocapital_allow = val;
-                   if (autocapital_allow != _elm_config->autocapital_allow)
-                     {
-                        edje_autocapitalization_allow_set(_elm_config->autocapital_allow);
-                     }
+                  _elm_config->bring_in_scroll_friction =
+                     (double)val / 1000.0;
                }
           }
-        else if (event->atom == _atom[ATOM_E_AUTOPERIOD_ALLOW])
+        else if (event->atom ==
+                 _atom[ATOM_E_THUMBSCROLL_ZOOM_FRICTION])
           {
-             unsigned int val = 0;
+             unsigned int val = 1000;
 
              if (ecore_x_window_prop_card32_get(event->win,
                                                 event->atom,
                                                 &val, 1) > 0)
                {
-                  int autoperiod_allow;
-
-                  autoperiod_allow = _elm_config->autoperiod_allow;
-                  _elm_config->autoperiod_allow = val;
-                  if (autoperiod_allow != _elm_config->autoperiod_allow)
-                    {
-                       edje_autoperiod_allow_set(_elm_config->autoperiod_allow);
-                    }
+                    _elm_config->zoom_friction = (double)val / 1000.0;
                }
           }
         else if (((_atom_config > 0) && (event->atom == _atom_config)) ||
@@ -624,6 +578,7 @@ _desc_init(void)
    ELM_CONFIG_VAL(D, T, thumbscroll_friction, T_DOUBLE);
    ELM_CONFIG_VAL(D, T, thumbscroll_bounce_friction, T_DOUBLE);
    ELM_CONFIG_VAL(D, T, thumbscroll_border_friction, T_DOUBLE);
+   ELM_CONFIG_VAL(D, T, thumbscroll_sensitivity_friction, T_DOUBLE);
    ELM_CONFIG_VAL(D, T, page_scroll_friction, T_DOUBLE);
    ELM_CONFIG_VAL(D, T, bring_in_scroll_friction, T_DOUBLE);
    ELM_CONFIG_VAL(D, T, zoom_friction, T_DOUBLE);
@@ -660,7 +615,6 @@ _desc_init(void)
    ELM_CONFIG_VAL(D, T, longpress_timeout, T_DOUBLE);
    ELM_CONFIG_VAL(D, T, effect_enable, T_UCHAR);
    ELM_CONFIG_VAL(D, T, desktop_entry, T_UCHAR);
-   ELM_CONFIG_VAL(D, T, input_panel_enable, T_INT);
    ELM_CONFIG_VAL(D, T, password_show_last, T_UCHAR);
    ELM_CONFIG_VAL(D, T, password_show_last_timeout, T_DOUBLE);
 #undef T
@@ -963,9 +917,8 @@ sys:
              continue;
           }
      }
-   return flist;
-
    eina_iterator_free(file_it);
+   return flist;
 
 list_free:
    EINA_LIST_FREE(flist, dir)
@@ -1068,10 +1021,6 @@ _config_sub_apply(void)
    edje_password_show_last_set(_elm_config->password_show_last);
    edje_password_show_last_timeout_set(_elm_config->password_show_last_timeout);
    if (_elm_config->modules) _elm_module_parse(_elm_config->modules);
-   edje_input_panel_enabled_set(_elm_config->input_panel_enable);
-   edje_autocapitalization_allow_set(_elm_config->autocapital_allow);
-   edje_autoperiod_allow_set(_elm_config->autoperiod_allow);
-   if (_elm_config->modules) _elm_module_parse(_elm_config->modules);
 }
 
 static Eina_Bool
@@ -1192,6 +1141,7 @@ _config_load(void)
    _elm_config->bring_in_scroll_friction = 0.5;
    _elm_config->zoom_friction = 0.5;
    _elm_config->thumbscroll_border_friction = 0.5;
+   _elm_config->thumbscroll_sensitivity_friction = 0.25; // magic number! just trial and error shows this makes it behave "nicer" and not run off at high speed all the time
    _elm_config->scroll_smooth_time_interval = 0.008;
    _elm_config->scroll_smooth_amount = 1.0;
    _elm_config->scroll_smooth_history_weight = 0.3;
@@ -1549,6 +1499,18 @@ _env_get(void)
 
         _elm_config->thumbscroll_border_friction = friction;
      }
+   s = getenv("ELM_THUMBSCROLL_SENSITIVITY_FRICTION");
+   if (s)
+     {
+        friction = atof(s);
+        if (friction < 0.1)
+          friction = 0.1;
+
+        if (friction > 1.0)
+          friction = 1.0;
+
+        _elm_config->thumbscroll_sensitivity_friction = friction;
+     }
    s = getenv("ELM_SCROLL_SMOOTH_TIME_INTERVAL");
    if (s) _elm_config->scroll_smooth_time_interval = atof(s);
    s = getenv("ELM_SCROLL_SMOOTH_AMOUNT");
@@ -1676,9 +1638,6 @@ _env_get(void)
    s = getenv("ELM_ICON_SIZE");
    if (s) _elm_config->icon_size = atoi(s);
 
-   s = getenv("ELM_INPUT_PANEL");
-   if (s) _elm_config->input_panel_enable = atoi(s);
-
    s = getenv("ELM_LONGPRESS_TIMEOUT");
    if (s) _elm_config->longpress_timeout = atof(s);
    if (_elm_config->longpress_timeout < 0.0)
@@ -1825,39 +1784,6 @@ _elm_config_sub_init(void)
                   if (changed) _prop_config_get();
               }
          }
-        if (!getenv("ELM_INPUT_PANEL"))
-          {
-             if (ecore_x_window_prop_card32_get(_root_1st,
-                                                _atom[ATOM_E_INPUT_PANEL],
-                                                &val, 1) > 0)
-               {
-                  if (val > 0)
-                    {
-                       _elm_config->input_panel_enable = val;
-                       edje_input_panel_enabled_set(_elm_config->input_panel_enable);
-                    }
-               }
-          }
-        if (ecore_x_window_prop_card32_get(_root_1st,
-                                           _atom[ATOM_E_AUTOCAPITAL_ALLOW],
-                                           &val, 1) > 0)
-          {
-             if (val > 0)
-               {
-                  _elm_config->autocapital_allow = val;
-                  edje_autocapitalization_allow_set(_elm_config->autocapital_allow);
-               }
-          }
-        if (ecore_x_window_prop_card32_get(_root_1st,
-                                           _atom[ATOM_E_AUTOPERIOD_ALLOW],
-                                           &val, 1) > 0)
-          {
-             if (val > 0)
-               {
-                  _elm_config->autoperiod_allow = val;
-                  edje_autoperiod_allow_set(_elm_config->autoperiod_allow);
-               }
-          }
 #endif
      }
    _config_sub_apply();