value "bring_in_scroll_friction" double: 0.5;
value "zoom_friction" double: 0.5;
value "thumbscroll_border_friction" double: 0.5;
+ value "thumbscroll_sensitivity_friction" double: 0.25;
value "scale" double: 1.0;
value "bgpixmap" int: 0;
value "compositing" int: 1;
value "bring_in_scroll_friction" double: 0.5;
value "zoom_friction" double: 0.5;
value "thumbscroll_border_friction" double: 0.5;
+ value "thumbscroll_sensitivity_friction" double: 0.25;
value "scroll_smooth_time_interval" double: 0.008;
value "scroll_smooth_amount" double: 1.0;
value "scroll_smooth_history_weight" double: 0.3;
value "bring_in_scroll_friction" double: 0.5;
value "zoom_friction" double: 0.5;
value "thumbscroll_border_friction" double: 0.5;
+ value "thumbscroll_sensitivity_friction" double: 0.25;
value "scroll_smooth_amount" double: 0.0;
value "scroll_smooth_history_weight" double: 0.3;
value "scroll_smooth_future_time" double: 0.0;
}
static void
+tssf_round(void *data __UNUSED__,
+ Evas_Object *obj,
+ void *event_info __UNUSED__)
+{
+ double val = elm_slider_value_get(obj);
+ double v;
+
+ v = ((double)((int)(val * 20.0))) / 20.0;
+ if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+tssf_change(void *data __UNUSED__,
+ Evas_Object *obj,
+ void *event_info __UNUSED__)
+{
+ double tssf = elm_scroll_thumbscroll_sensitivity_friction_get();
+ double val = elm_slider_value_get(obj);
+
+ if (tssf == val) return;
+ elm_scroll_thumbscroll_sensitivity_friction_all_set(val);
+}
+
+static void
cf_enable(void *data,
Evas_Object *obj,
void *event_info __UNUSED__)
{
int flush_interval, font_c, image_c, edje_file_c, edje_col_c, ts_threshould;
double scale, s_bounce_friction, ts_momentum_threshold, ts_friction,
- ts_border_friction, page_friction, bring_in_friction, zoom_friction;
+ ts_border_friction, ts_sensitivity_friction, page_friction, bring_in_friction, zoom_friction;
const char *curr_theme, *curr_engine;
const Eina_List *l_items, *l;
Eina_Bool s_bounce, ts;
ts_momentum_threshold = elm_scroll_thumbscroll_momentum_threshold_get();
ts_friction = elm_scroll_thumbscroll_friction_get();
ts_border_friction = elm_scroll_thumbscroll_border_friction_get();
+ ts_sensitivity_friction = elm_scroll_thumbscroll_sensitivity_friction_get();
page_friction = elm_scroll_page_scroll_friction_get();
bring_in_friction = elm_scroll_bring_in_scroll_friction_get();
zoom_friction = elm_scroll_zoom_friction_get();
elm_scroll_thumbscroll_border_friction_all_set(ts_border_friction);
elm_slider_value_set(evas_object_data_get(win, "ts_border_friction_slider"),
ts_border_friction);
+ elm_scroll_thumbscroll_sensitivity_friction_all_set(ts_sensitivity_friction);
+ elm_slider_value_set(evas_object_data_get(win, "ts_sensitivity_friction_slider"),
+ ts_sensitivity_friction);
elm_scroll_page_scroll_friction_all_set(page_friction);
elm_slider_value_set(evas_object_data_get(win,
"page_scroll_friction_slider"),
evas_object_smart_callback_add(sl, "changed", tsbf_round, NULL);
evas_object_smart_callback_add(sl, "delay,changed", tsbf_change, NULL);
+ LABEL_FRAME_ADD("<hilight>Thumb scroll sensitivity friction</>");
+
+ sl = elm_slider_add(win);
+ elm_object_tooltip_text_set(sl, "This is the sensitivity amount which<br>"
+ "is be multiplied by the length of mouse<br>"
+ "dragging.");
+ evas_object_data_set(win, "ts_sensitivity_friction_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.2f");
+ elm_slider_indicator_format_set(sl, "%1.2f");
+ elm_slider_min_max_set(sl, 0.1, 1.0);
+ elm_slider_value_set(sl, elm_scroll_thumbscroll_sensitivity_friction_get());
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", tssf_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", tssf_change, NULL);
+
sp = elm_separator_add(win);
elm_separator_horizontal_set(sp, EINA_TRUE);
evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
EAPI void elm_scroll_thumbscroll_border_friction_set(double friction);
EAPI void elm_scroll_thumbscroll_border_friction_all_set(double friction);
+ /**
+ * Get the sensitivity amount which is be multiplied by the length of
+ * mouse dragging.
+ *
+ * @return the thumb scroll sensitivity friction
+ *
+ * @ingroup Scrolling
+ */
+ EAPI double elm_scroll_thumbscroll_sensitivity_friction_get(void);
+
+ /**
+ * Set the sensitivity amount which is be multiplied by the length of
+ * mouse dragging.
+ *
+ * @param friction the thumb scroll sensitivity friction. @c 0.1 for
+ * minimun sensitivity, @c 1.0 for maximum sensitivity. 0.25
+ * is proper.
+ *
+ * @see elm_thumbscroll_sensitivity_friction_get()
+ * @note parameter value will get bound to 0.1 - 1.0 interval, always
+ *
+ * @ingroup Scrolling
+ */
+ EAPI void elm_scroll_thumbscroll_sensitivity_friction_set(double friction);
+
+ /**
+ * Set the sensitivity amount which is be multiplied by the length of
+ * mouse dragging, for all Elementary application windows.
+ *
+ * @param friction the thumb scroll sensitivity friction. @c 0.1 for
+ * minimun sensitivity, @c 1.0 for maximum sensitivity. 0.25
+ * is proper.
+ *
+ * @see elm_thumbscroll_sensitivity_friction_get()
+ * @note parameter value will get bound to 0.1 - 1.0 interval, always
+ *
+ * @ingroup Scrolling
+ */
+ EAPI void elm_scroll_thumbscroll_sensitivity_friction_all_set(double friction);
+
+ /**
+ * @}
+ */
+
EAPI void elm_object_scroll_hold_push(Evas_Object *obj) EINA_ARG_NONNULL(1);
EAPI void elm_object_scroll_hold_pop(Evas_Object *obj) EINA_ARG_NONNULL(1);
EAPI void elm_object_scroll_freeze_push(Evas_Object *obj) EINA_ARG_NONNULL(1);
#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] =
"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",
#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_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__,
(double)val / 1000.0;
}
}
+ else if (event->atom == _atom[ATOM_E_THUMBSCROLL_SENSITIVITY_FRICTION])
+ {
+ unsigned int val = 1000;
+
+ if (ecore_x_window_prop_card32_get(event->win,
+ event->atom,
+ &val, 1) > 0)
+ {
+ _elm_config->thumbscroll_sensitivity_friction =
+ (double)val / 1000.0;
+ }
+ }
else if (event->atom == _atom[ATOM_E_THUMBSCROLL_PAGE_SCROLL_FRICTION])
{
unsigned int val = 1000;
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);
_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;
_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");
#endif
}
+EAPI double
+elm_scroll_thumbscroll_sensitivity_friction_get(void)
+{
+ return _elm_config->thumbscroll_sensitivity_friction;
+}
+
+EAPI void
+elm_scroll_thumbscroll_sensitivity_friction_set(double friction)
+{
+ if (friction < 0.1)
+ friction = 0.1;
+
+ if (friction > 1.0)
+ friction = 1.0;
+
+ _elm_config->thumbscroll_friction = friction;
+}
+
+EAPI void
+elm_scroll_thumbscroll_sensitivity_friction_all_set(double friction)
+{
+ if (friction < 0.1)
+ friction = 0.1;
+
+ if (friction > 1.0)
+ friction = 1.0;
+
+#ifdef HAVE_ELEMENTARY_X
+ static Ecore_X_Atom atom = 0;
+ unsigned int sensitivity_friction_i = (unsigned int)(friction * 1000.0);
+
+ if (!atom)
+ atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_SENSITIVITY_FRICTION");
+ ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
+ atom, &sensitivity_friction_i, 1);
+#endif
+}
+
/**
* @defgroup Scrollhints Scrollhints
* @ingroup Main
elm_object_item_signal_emit(Elm_Object_Item *it, const char *emission, const char *source)
{
elm_widget_item_signal_emit(it, emission, source);
-}
\ No newline at end of file
+}
double zoom_friction;
unsigned char thumbscroll_bounce_enable;
double thumbscroll_border_friction;
+ double thumbscroll_sensitivity_friction;
double scroll_smooth_time_interval;
double scroll_smooth_amount;
double scroll_smooth_history_weight;
ax /= (i + 1);
ay /= (i + 1);
at /= (i + 1);
- at *= 4.0; // magic number! just trial and error shows this makes it behave "nicer" and not run off at high speed all the time
+ at /= _elm_config->thumbscroll_sensitivity_friction;
dx = ev->canvas.x - ax;
dy = ev->canvas.y - ay;
if (at > 0)