jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=59cf7c7ab756cda78dfca44305e24d8915cf61c0
commit 59cf7c7ab756cda78dfca44305e24d8915cf61c0 Author: Jean-Philippe Andre <[email protected]> Date: Wed Apr 12 14:17:09 2017 +0900 scroller: Fix CRI if scroll animation is disabled If the scroll animation is disabled, we ended up with an immediate call from inside a post-event callback to modify the canvas geometry which led to feeding events. Since 99d21f6d9c6e65 and 54e5841b2f638 it is basically forbidden to modify the canvas or feed events from the post-event cb. This is because feeding events from inside the post-event callback can break the logical order of operations between post-event cb and event cb. Note: This also implements no-animation scrolling for page scroll, in case scroll animation is disabled (unifying the code did that). Fixes T5289 (abort inside E) --- src/lib/elementary/elm_interface_scrollable.c | 66 ++++++++++++++++---------- src/lib/elementary/elm_interface_scrollable.eo | 3 +- 2 files changed, 43 insertions(+), 26 deletions(-) diff --git a/src/lib/elementary/elm_interface_scrollable.c b/src/lib/elementary/elm_interface_scrollable.c index 2b8d1cb..2335107 100644 --- a/src/lib/elementary/elm_interface_scrollable.c +++ b/src/lib/elementary/elm_interface_scrollable.c @@ -1884,6 +1884,30 @@ _elm_scroll_wanted_region_set(Evas_Object *obj) elm_interface_scrollable_content_region_set(obj, wx, sid->wy, ww, wh); } +static void +_scroll_wheel_post_event_job(void *data, const Efl_Event *ev EINA_UNUSED) +{ + Elm_Scrollable_Smart_Interface_Data *sid = data; + + elm_interface_scrollable_content_pos_set(sid->obj, sid->wx, sid->wy, EINA_TRUE); +} + +static inline void +_scroll_wheel_post_event_go(Elm_Scrollable_Smart_Interface_Data *sid, int x, int y) +{ + if (sid->hold || sid->freeze) return; + _elm_scroll_wanted_coordinates_update(sid, x, y); + if (_elm_config->scroll_animation_disable) + { + efl_future_then(efl_loop_job(efl_loop_get(sid->obj), NULL), + _scroll_wheel_post_event_job, NULL, NULL, sid); + } + else + { + _elm_scroll_scroll_to_x(sid, _elm_config->bring_in_scroll_friction, x); + _elm_scroll_scroll_to_y(sid, _elm_config->bring_in_scroll_friction, y); + } +} static Eina_Bool _scroll_wheel_post_event_cb(void *data, Evas *e EINA_UNUSED) @@ -1961,9 +1985,11 @@ _scroll_wheel_post_event_cb(void *data, Evas *e EINA_UNUSED) d *= mul; sid->last_wheel = ev->timestamp; sid->last_wheel_mul = mul; + if (!direction) { - if ((ch > vh) || (cw <= vw)) y += d * sid->step.y; + if ((ch > vh) || (cw <= vw)) + y += d * sid->step.y; else { x += d * sid->step.x; @@ -1972,50 +1998,40 @@ _scroll_wheel_post_event_cb(void *data, Evas *e EINA_UNUSED) } else { - if ((cw > vw) || (ch <= vh)) x += d * sid->step.x; + if ((cw > vw) || (ch <= vh)) + x += d * sid->step.x; else { y += d * sid->step.y; direction = 0; } } - - if ((!sid->hold) && (!sid->freeze)) - { - _elm_scroll_wanted_coordinates_update(sid, x, y); - if (_elm_config->scroll_animation_disable) - elm_interface_scrollable_content_pos_set(sid->obj, x, y, EINA_TRUE); - else - { - _elm_scroll_scroll_to_x(sid, _elm_config->bring_in_scroll_friction, x); - _elm_scroll_scroll_to_y(sid, _elm_config->bring_in_scroll_friction, y); - } - } + _scroll_wheel_post_event_go(sid, x, y); } else { elm_interface_scrollable_current_page_get(sid->obj, &pagenumber_h, &pagenumber_v); if (!direction) { - if (ch > vh || cw <= vw) + if ((ch > vh) || (cw <= vw)) y = (pagenumber_v + (1 * ev->z)) * sid->pagesize_v; else - x = (pagenumber_h + (1 * ev->z)) * sid->pagesize_h; + { + x = (pagenumber_h + (1 * ev->z)) * sid->pagesize_h; + direction = 1; + } } else { - if (cw > vw || ch <= vh) + if ((cw > vw) || (ch <= vh)) x = (pagenumber_h + (1 * ev->z)) * sid->pagesize_h; else - y = (pagenumber_v + (1 * ev->z)) * sid->pagesize_v; - } - - if ((!sid->hold) && (!sid->freeze)) - { - _elm_scroll_wanted_coordinates_update(sid, x, y); - _elm_scroll_scroll_to_x(sid, _elm_config->bring_in_scroll_friction, x); - _elm_scroll_scroll_to_y(sid, _elm_config->bring_in_scroll_friction, y); + { + y = (pagenumber_v + (1 * ev->z)) * sid->pagesize_v; + direction = 0; + } } + _scroll_wheel_post_event_go(sid, x, y); } if (direction) diff --git a/src/lib/elementary/elm_interface_scrollable.eo b/src/lib/elementary/elm_interface_scrollable.eo index 8ec1b52..2187c6f 100644 --- a/src/lib/elementary/elm_interface_scrollable.eo +++ b/src/lib/elementary/elm_interface_scrollable.eo @@ -597,7 +597,8 @@ mixin Elm.Interface_Scrollable(Efl.Ui.Scrollable, Efl.Canvas.Group) params { @in x: Evas.Coord; [[X coordinate]] @in y: Evas.Coord; [[Y coordinate]] - @in sig: bool; [[FIXME: what does sig stand for here?]] + @in sig: bool; [[Send signals to the theme corresponding to the + scroll direction, or if an edge was reached.]] } } content_pos_get { --
