diff --git a/legacy/elementary/config/default/base.src b/legacy/elementary/config/default/base.src index ed11da8669..a0de3a2afa 100644 --- a/legacy/elementary/config/default/base.src +++ b/legacy/elementary/config/default/base.src @@ -12,6 +12,7 @@ group "Elm_Config" struct { 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; diff --git a/legacy/elementary/config/illume/base.src b/legacy/elementary/config/illume/base.src index c715675553..0af21d83dd 100644 --- a/legacy/elementary/config/illume/base.src +++ b/legacy/elementary/config/illume/base.src @@ -12,6 +12,7 @@ group "Elm_Config" struct { 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: 1.0; value "scroll_smooth_history_weight" double: 0.3; value "scroll_smooth_future_time" double: 0.0; diff --git a/legacy/elementary/config/standard/base.src b/legacy/elementary/config/standard/base.src index eaa84da474..78c7d75339 100644 --- a/legacy/elementary/config/standard/base.src +++ b/legacy/elementary/config/standard/base.src @@ -12,6 +12,7 @@ group "Elm_Config" struct { 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; diff --git a/legacy/elementary/data/themes/widgets/ctxpopup.edc b/legacy/elementary/data/themes/widgets/ctxpopup.edc index b97a7558e7..1fe11a021d 100644 --- a/legacy/elementary/data/themes/widgets/ctxpopup.edc +++ b/legacy/elementary/data/themes/widgets/ctxpopup.edc @@ -914,3 +914,149 @@ group { } } } +/////////////////////////////////////////////////////////////////////////////// +group { + name: "elm/ctxpopup/item_compress/default"; + images { + image: "hoversel_entry_bg.png" COMP; + } + parts { + part { name: "event"; + mouse_events: 1; + description { state: "default" 0.0; + } + } + part { name: "bg"; + mouse_events: 0; + description { state: "default" 0.0; + rel1.offset: 2 2; + rel2.offset: -3 -3; + image { normal:"hoversel_entry_bg.png"; + border: 0 0 2 2; + } + fill.smooth: 0; + color: 255 255 255 0; + } + description { state: "clicked" 0.0; + inherit: "default" 0.0; + color: 255 255 255 255; + } + } + part { name: "elm.swallow.icon"; + type: SWALLOW; + clip_to: "disclip"; + scale: 1; + description { state: "default" 0.0; + min: 25 25; + max: 25 25; + align: 0 0.5; + aspect: 1.0 1.0; + rel1 { offset: 10 10; } + rel2 { offset: 0 -10; } + } + } + part { name: "elm.text"; + type: TEXT; + mouse_events: 0; + clip_to: "disclip"; + scale: 1; + description { state: "default" 0.0; + min: 1 40; + fixed: 0 1; + align: 0.5 0.5; + rel1 { relative: 1.0 0.0; to: "elm.swallow.icon"; offset: 10 0; } + rel2 { relative: 1.0 1.0; } + color: 255 255 255 255; + text { + font: "Sans"; + size: 10; + min: 0 1; + align: 0.0 0.5; + } + } + description { state: "clicked" 0.0; + inherit: "default" 0.0; + color: 0 0 0 255; + } + } + part { name: "over1"; + mouse_events: 1; + repeat_events: 1; + ignore_flags: ON_HOLD; + description { state: "default" 0.0; + color: 255 255 255 0; + } + description { state: "clicked" 0.0; + inherit: "default" 0.0; + color: 255 255 255 255; + } + } + part { name: "over2"; + mouse_events: 1; + repeat_events: 1; + description { state: "default" 0.0; + color: 255 255 255 0; + } + description { state: "clicked" 0.0; + inherit: "default" 0.0; + color: 255 255 255 255; + } + } + part { name: "disclip"; + type: RECT; + description { state: "default" 0.0; + color: 255 255 255 255; + } + description { state: "enabled" 0.0; + color: 127 127 127 127; + } + } + part { name: "blocker"; + description { state: "default" 0.0; + visible: 0; + } + description { state: "enabled" 0.0; + visible: 1; + color: 0 0 0 0; + } + } + } + programs { + program { + name: "item_unclick"; + signal: "mouse,up,1"; + source: "over1"; + action: SIGNAL_EMIT "elm,action,click" ""; + } + program { name: "disable"; + signal: "elm,state,disabled"; + source: "elm"; + action: STATE_SET "enabled" 0.0; + target: "disclip"; + target: "blocker"; + } + program { name: "enable"; + signal: "elm,state,enabled"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "disclip"; + target: "blocker"; + } + program { name: "item_click2"; + signal: "mouse,down,1"; + source: "over2"; + script { + set_state(PART:"elm.text", "clicked", 0.0); + set_state(PART:"bg", "clicked", 0.0); + } + } + program { name: "item_unclick2"; + signal: "mouse,up,1"; + source: "over2"; + script { + set_state(PART:"elm.text", "default", 0.0); + set_state(PART:"bg", "default", 0.0); + } + } + } +} diff --git a/legacy/elementary/src/bin/config.c b/legacy/elementary/src/bin/config.c index 9f8520e687..449c1b7f48 100644 --- a/legacy/elementary/src/bin/config.c +++ b/legacy/elementary/src/bin/config.c @@ -361,6 +361,30 @@ tsbf_change(void *data __UNUSED__, elm_scroll_thumbscroll_border_friction_all_set(val); } +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, @@ -864,7 +888,7 @@ _profile_change_do(Evas_Object *win, { 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; @@ -889,6 +913,7 @@ _profile_change_do(Evas_Object *win, 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(); @@ -940,6 +965,9 @@ _profile_change_do(Evas_Object *win, 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"), @@ -2518,6 +2546,26 @@ _status_config_scrolling(Evas_Object *win, evas_object_smart_callback_add(sl, "changed", tsbf_round, NULL); evas_object_smart_callback_add(sl, "delay,changed", tsbf_change, NULL); + LABEL_FRAME_ADD("Thumb scroll sensitivity friction"); + + sl = elm_slider_add(win); + elm_object_tooltip_text_set(sl, "This is the sensitivity amount which
" + "is be multiplied by the length of mouse
" + "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); diff --git a/legacy/elementary/src/lib/Elementary.h.in b/legacy/elementary/src/lib/Elementary.h.in index b8f2a8ae17..39a87196ee 100644 --- a/legacy/elementary/src/lib/Elementary.h.in +++ b/legacy/elementary/src/lib/Elementary.h.in @@ -2830,6 +2830,46 @@ extern "C" { */ 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); + /** * @} */ diff --git a/legacy/elementary/src/lib/elm_config.c b/legacy/elementary/src/lib/elm_config.c index 59aec78a8e..345909f83d 100644 --- a/legacy/elementary/src/lib/elm_config.c +++ b/legacy/elementary/src/lib/elm_config.c @@ -76,7 +76,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] = @@ -99,6 +99,7 @@ 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", @@ -122,10 +123,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_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__, @@ -465,6 +467,18 @@ _prop_change(void *data __UNUSED__, _elm_config->thumbscroll_border_friction = (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]) { @@ -566,6 +580,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); @@ -1138,6 +1153,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_amount = 1.0; _elm_config->scroll_smooth_history_weight = 0.3; _elm_config->scroll_smooth_future_time = 0.0; @@ -1508,6 +1524,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_AMOUNT"); if (s) _elm_config->scroll_smooth_amount = atof(s); s = getenv("ELM_SCROLL_SMOOTH_HISTORY_WEIGHT"); diff --git a/legacy/elementary/src/lib/elm_main.c b/legacy/elementary/src/lib/elm_main.c index 76a0988e74..b16d9eeb8e 100644 --- a/legacy/elementary/src/lib/elm_main.c +++ b/legacy/elementary/src/lib/elm_main.c @@ -1887,6 +1887,44 @@ elm_scroll_thumbscroll_border_friction_all_set(double friction) #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 +} + EAPI void elm_object_scroll_hold_push(Evas_Object *obj) { diff --git a/legacy/elementary/src/lib/elm_priv.h b/legacy/elementary/src/lib/elm_priv.h index 1b17e4edcd..e720af1fb6 100644 --- a/legacy/elementary/src/lib/elm_priv.h +++ b/legacy/elementary/src/lib/elm_priv.h @@ -97,6 +97,7 @@ struct _Elm_Config double zoom_friction; unsigned char thumbscroll_bounce_enable; double thumbscroll_border_friction; + double thumbscroll_sensitivity_friction; double scroll_smooth_amount; double scroll_smooth_history_weight; double scroll_smooth_future_time; diff --git a/legacy/elementary/src/lib/els_scroller.c b/legacy/elementary/src/lib/els_scroller.c index eed8d203e5..935371f6a5 100644 --- a/legacy/elementary/src/lib/els_scroller.c +++ b/legacy/elementary/src/lib/els_scroller.c @@ -1969,7 +1969,7 @@ _smart_event_mouse_up(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *ev 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)