summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-01-26 15:51:49 -0800
committerCedric BAIL <cedric@osg.samsung.com>2016-02-01 14:21:27 -0800
commitff1dd7be08fcbcf518018d8fab5ccff81e7801a0 (patch)
tree5bfe3003f534ae1dd9eb79ed733f99504d082d68
parentf007f2927e10ea30b3a698fbc2eae4067bee9a4e (diff)
interface_scrollable: drop use of ecore_animator in favor of canvas animator.
-rw-r--r--src/lib/elm_interface_scrollable.c192
-rw-r--r--src/lib/elm_interface_scrollable.h13
2 files changed, 111 insertions, 94 deletions
diff --git a/src/lib/elm_interface_scrollable.c b/src/lib/elm_interface_scrollable.c
index ab2db6329..9c86527e4 100644
--- a/src/lib/elm_interface_scrollable.c
+++ b/src/lib/elm_interface_scrollable.c
@@ -30,6 +30,17 @@
30 return val; \ 30 return val; \
31 } 31 }
32 32
33#define ELM_ANIMATOR_CONNECT(Obj, Bool, Callback, Data) \
34 eo_do(evas_object_evas_get(Obj), \
35 eo_event_callback_del(EVAS_CANVAS_EVENT_ANIMATOR_TICK, Callback, Data), \
36 eo_event_callback_add(EVAS_CANVAS_EVENT_ANIMATOR_TICK, Callback, Data)); \
37 Bool = 1;
38
39#define ELM_ANIMATOR_DISCONNECT(Obj, Bool, Callback, Data) \
40 eo_do(evas_object_evas_get(Obj), \
41 eo_event_callback_del(EVAS_CANVAS_EVENT_ANIMATOR_TICK, Callback, Data)); \
42 Bool = 0;
43
33static const char SIG_CHANGED[] = "changed"; 44static const char SIG_CHANGED[] = "changed";
34static const Evas_Smart_Cb_Description _smart_callbacks[] = { 45static const Evas_Smart_Cb_Description _smart_callbacks[] = {
35 {SIG_CHANGED, ""}, 46 {SIG_CHANGED, ""},
@@ -49,6 +60,15 @@ static void
49_elm_scroll_wanted_coordinates_update(Elm_Scrollable_Smart_Interface_Data *sid, 60_elm_scroll_wanted_coordinates_update(Elm_Scrollable_Smart_Interface_Data *sid,
50 Evas_Coord x, 61 Evas_Coord x,
51 Evas_Coord y); 62 Evas_Coord y);
63
64static Eina_Bool _elm_scroll_hold_animator(void *data, Eo *o, const Eo_Event_Description *desc, void *event_info);
65static Eina_Bool _elm_scroll_on_hold_animator(void *data, Eo *o, const Eo_Event_Description *desc, void *event_info);
66static Eina_Bool _elm_scroll_scroll_to_y_animator(void *data, Eo *o, const Eo_Event_Description *desc, void *event_info);
67static Eina_Bool _elm_scroll_scroll_to_x_animator(void *data, Eo *o, const Eo_Event_Description *desc, void *event_info);
68static Eina_Bool _elm_scroll_bounce_y_animator(void *data, Eo *o, const Eo_Event_Description *desc, void *event_info);
69static Eina_Bool _elm_scroll_bounce_x_animator(void *data, Eo *o, const Eo_Event_Description *desc, void *event_info);
70static Eina_Bool _elm_scroll_momentum_animator(void *data, Eo *o, const Eo_Event_Description *desc, void *event_info);
71
52static double 72static double
53_round(double value, int pos) 73_round(double value, int pos)
54{ 74{
@@ -1269,7 +1289,7 @@ _elm_scroll_momentum_end(Elm_Scrollable_Smart_Interface_Data *sid)
1269 eo_do(sid->obj, elm_interface_scrollable_content_pos_get(&px, &py)); 1289 eo_do(sid->obj, elm_interface_scrollable_content_pos_get(&px, &py));
1270 _elm_scroll_wanted_coordinates_update(sid, px, py); 1290 _elm_scroll_wanted_coordinates_update(sid, px, py);
1271 1291
1272 ELM_SAFE_FREE(sid->down.momentum_animator, ecore_animator_del); 1292 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->down.momentum_animator, _elm_scroll_momentum_animator, sid);
1273 sid->down.bounce_x_hold = EINA_FALSE; 1293 sid->down.bounce_x_hold = EINA_FALSE;
1274 sid->down.bounce_y_hold = EINA_FALSE; 1294 sid->down.bounce_y_hold = EINA_FALSE;
1275 sid->down.ax = 0; 1295 sid->down.ax = 0;
@@ -1284,7 +1304,7 @@ _elm_scroll_momentum_end(Elm_Scrollable_Smart_Interface_Data *sid)
1284} 1304}
1285 1305
1286static Eina_Bool 1306static Eina_Bool
1287_elm_scroll_bounce_x_animator(void *data) 1307_elm_scroll_bounce_x_animator(void *data, Eo *o EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
1288{ 1308{
1289 ELM_SCROLL_IFACE_DATA_GET_OR_RETURN_VAL(data, sid, EINA_FALSE); 1309 ELM_SCROLL_IFACE_DATA_GET_OR_RETURN_VAL(data, sid, EINA_FALSE);
1290 Evas_Coord x, y, dx, w, odx, ed, md; 1310 Evas_Coord x, y, dx, w, odx, ed, md;
@@ -1327,20 +1347,19 @@ _elm_scroll_bounce_x_animator(void *data)
1327 if ((!sid->down.bounce_y_animator) && 1347 if ((!sid->down.bounce_y_animator) &&
1328 (!sid->scrollto.y.animator)) 1348 (!sid->scrollto.y.animator))
1329 _elm_scroll_anim_stop(sid); 1349 _elm_scroll_anim_stop(sid);
1330 sid->down.bounce_x_animator = NULL;
1331 sid->down.pdx = 0; 1350 sid->down.pdx = 0;
1332 sid->bouncemex = EINA_FALSE; 1351 sid->bouncemex = EINA_FALSE;
1333 _elm_scroll_momentum_end(sid); 1352 _elm_scroll_momentum_end(sid);
1334 if (sid->content_info.resized) 1353 if (sid->content_info.resized)
1335 _elm_scroll_wanted_region_set(sid->obj); 1354 _elm_scroll_wanted_region_set(sid->obj);
1336 return ECORE_CALLBACK_CANCEL; 1355 ELM_ANIMATOR_CONNECT(sid->obj, sid->down.bounce_x_animator, _elm_scroll_bounce_x_animator, sid->obj);
1337 } 1356 }
1338 } 1357 }
1339 return ECORE_CALLBACK_RENEW; 1358 return EO_CALLBACK_CONTINUE;
1340} 1359}
1341 1360
1342static Eina_Bool 1361static Eina_Bool
1343_elm_scroll_bounce_y_animator(void *data) 1362_elm_scroll_bounce_y_animator(void *data, Eo *o EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
1344{ 1363{
1345 ELM_SCROLL_IFACE_DATA_GET_OR_RETURN_VAL(data, sid, EINA_FALSE); 1364 ELM_SCROLL_IFACE_DATA_GET_OR_RETURN_VAL(data, sid, EINA_FALSE);
1346 Evas_Coord x, y, dy, h, ody, ed, md; 1365 Evas_Coord x, y, dy, h, ody, ed, md;
@@ -1383,17 +1402,16 @@ _elm_scroll_bounce_y_animator(void *data)
1383 if ((!sid->down.bounce_x_animator) && 1402 if ((!sid->down.bounce_x_animator) &&
1384 (!sid->scrollto.y.animator)) 1403 (!sid->scrollto.y.animator))
1385 _elm_scroll_anim_stop(sid); 1404 _elm_scroll_anim_stop(sid);
1386 sid->down.bounce_y_animator = NULL;
1387 sid->down.pdy = 0; 1405 sid->down.pdy = 0;
1388 sid->bouncemey = EINA_FALSE; 1406 sid->bouncemey = EINA_FALSE;
1389 _elm_scroll_momentum_end(sid); 1407 _elm_scroll_momentum_end(sid);
1390 if (sid->content_info.resized) 1408 if (sid->content_info.resized)
1391 _elm_scroll_wanted_region_set(sid->obj); 1409 _elm_scroll_wanted_region_set(sid->obj);
1392 return ECORE_CALLBACK_CANCEL; 1410 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->down.bounce_y_animator, _elm_scroll_bounce_y_animator, sid->obj);
1393 } 1411 }
1394 } 1412 }
1395 1413
1396 return ECORE_CALLBACK_RENEW; 1414 return EO_CALLBACK_CONTINUE;
1397} 1415}
1398 1416
1399static void 1417static void
@@ -1408,13 +1426,13 @@ _elm_scroll_bounce_eval(Elm_Scrollable_Smart_Interface_Data *sid)
1408 if (sid->down.now) return; // down bounce while still held down 1426 if (sid->down.now) return; // down bounce while still held down
1409 if (sid->down.onhold_animator) 1427 if (sid->down.onhold_animator)
1410 { 1428 {
1411 ELM_SAFE_FREE(sid->down.onhold_animator, ecore_animator_del); 1429 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->down.onhold_animator, _elm_scroll_on_hold_animator, sid);
1412 if (sid->content_info.resized) 1430 if (sid->content_info.resized)
1413 _elm_scroll_wanted_region_set(sid->obj); 1431 _elm_scroll_wanted_region_set(sid->obj);
1414 } 1432 }
1415 if (sid->down.hold_animator) 1433 if (sid->down.hold_animator)
1416 { 1434 {
1417 ELM_SAFE_FREE(sid->down.hold_animator, ecore_animator_del); 1435 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->down.hold_animator, _elm_scroll_hold_animator, sid);
1418 if (sid->content_info.resized) 1436 if (sid->content_info.resized)
1419 _elm_scroll_wanted_region_set(sid->obj); 1437 _elm_scroll_wanted_region_set(sid->obj);
1420 } 1438 }
@@ -1438,9 +1456,8 @@ _elm_scroll_bounce_eval(Elm_Scrollable_Smart_Interface_Data *sid)
1438 { 1456 {
1439 if (sid->bouncemex) 1457 if (sid->bouncemex)
1440 { 1458 {
1441 ELM_SAFE_FREE(sid->scrollto.x.animator, ecore_animator_del); 1459 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->scrollto.x.animator, _elm_scroll_scroll_to_x_animator, sid);
1442 sid->down.bounce_x_animator = 1460 ELM_ANIMATOR_CONNECT(sid->obj, sid->down.bounce_x_animator, _elm_scroll_bounce_x_animator, sid->obj);
1443 ecore_animator_add(_elm_scroll_bounce_x_animator, sid->obj);
1444 sid->down.anim_start2 = ecore_loop_time_get(); 1461 sid->down.anim_start2 = ecore_loop_time_get();
1445 sid->down.bx = bx; 1462 sid->down.bx = bx;
1446 sid->down.bx0 = bx; 1463 sid->down.bx0 = bx;
@@ -1458,9 +1475,8 @@ _elm_scroll_bounce_eval(Elm_Scrollable_Smart_Interface_Data *sid)
1458 { 1475 {
1459 if (sid->bouncemey) 1476 if (sid->bouncemey)
1460 { 1477 {
1461 ELM_SAFE_FREE(sid->scrollto.y.animator, ecore_animator_del); 1478 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->scrollto.y.animator, _elm_scroll_scroll_to_y_animator, sid);
1462 sid->down.bounce_y_animator = 1479 ELM_ANIMATOR_CONNECT(sid->obj, sid->down.bounce_y_animator, _elm_scroll_bounce_y_animator, sid->obj);
1463 ecore_animator_add(_elm_scroll_bounce_y_animator, sid->obj);
1464 sid->down.anim_start3 = ecore_loop_time_get(); 1480 sid->down.anim_start3 = ecore_loop_time_get();
1465 sid->down.by = by; 1481 sid->down.by = by;
1466 sid->down.by0 = by; 1482 sid->down.by0 = by;
@@ -1720,18 +1736,18 @@ _elm_scroll_content_region_show_internal(Evas_Object *obj,
1720 if ((sid->down.bounce_x_animator) || (sid->down.bounce_y_animator) || 1736 if ((sid->down.bounce_x_animator) || (sid->down.bounce_y_animator) ||
1721 (sid->scrollto.x.animator) || (sid->scrollto.y.animator)) 1737 (sid->scrollto.x.animator) || (sid->scrollto.y.animator))
1722 { 1738 {
1723 ELM_SAFE_FREE(sid->scrollto.x.animator, ecore_animator_del); 1739 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->scrollto.x.animator, _elm_scroll_scroll_to_x_animator, sid);
1724 ELM_SAFE_FREE(sid->scrollto.y.animator, ecore_animator_del); 1740 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->scrollto.y.animator, _elm_scroll_scroll_to_y_animator, sid);
1725 if (sid->down.bounce_x_animator) 1741 if (sid->down.bounce_x_animator)
1726 { 1742 {
1727 ELM_SAFE_FREE(sid->down.bounce_x_animator, ecore_animator_del); 1743 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->down.bounce_x_animator, _elm_scroll_bounce_x_animator, sid->obj);
1728 sid->bouncemex = EINA_FALSE; 1744 sid->bouncemex = EINA_FALSE;
1729 if (sid->content_info.resized) 1745 if (sid->content_info.resized)
1730 _elm_scroll_wanted_region_set(sid->obj); 1746 _elm_scroll_wanted_region_set(sid->obj);
1731 } 1747 }
1732 if (sid->down.bounce_y_animator) 1748 if (sid->down.bounce_y_animator)
1733 { 1749 {
1734 ELM_SAFE_FREE(sid->down.bounce_y_animator, ecore_animator_del); 1750 ELM_ANIMATOR_CONNECT(sid->obj, sid->down.bounce_y_animator, _elm_scroll_bounce_y_animator, sid->obj);
1735 sid->bouncemey = EINA_FALSE; 1751 sid->bouncemey = EINA_FALSE;
1736 if (sid->content_info.resized) 1752 if (sid->content_info.resized)
1737 _elm_scroll_wanted_region_set(sid->obj); 1753 _elm_scroll_wanted_region_set(sid->obj);
@@ -1741,7 +1757,7 @@ _elm_scroll_content_region_show_internal(Evas_Object *obj,
1741 } 1757 }
1742 if (sid->down.hold_animator) 1758 if (sid->down.hold_animator)
1743 { 1759 {
1744 ELM_SAFE_FREE(sid->down.hold_animator, ecore_animator_del); 1760 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->down.hold_animator, _elm_scroll_hold_animator, sid);
1745 _elm_scroll_drag_stop(sid); 1761 _elm_scroll_drag_stop(sid);
1746 if (sid->content_info.resized) 1762 if (sid->content_info.resized)
1747 _elm_scroll_wanted_region_set(sid->obj); 1763 _elm_scroll_wanted_region_set(sid->obj);
@@ -1749,7 +1765,7 @@ _elm_scroll_content_region_show_internal(Evas_Object *obj,
1749 ELM_SAFE_FREE(sid->down.hold_enterer, ecore_idle_enterer_del); 1765 ELM_SAFE_FREE(sid->down.hold_enterer, ecore_idle_enterer_del);
1750 if (sid->down.momentum_animator) 1766 if (sid->down.momentum_animator)
1751 { 1767 {
1752 ELM_SAFE_FREE(sid->down.momentum_animator, ecore_animator_del); 1768 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->down.momentum_animator, _elm_scroll_momentum_animator, sid);
1753 sid->down.bounce_x_hold = EINA_FALSE; 1769 sid->down.bounce_x_hold = EINA_FALSE;
1754 sid->down.bounce_y_hold = EINA_FALSE; 1770 sid->down.bounce_y_hold = EINA_FALSE;
1755 sid->down.ax = 0; 1771 sid->down.ax = 0;
@@ -1905,18 +1921,18 @@ _scroll_wheel_post_event_cb(void *data, Evas *e EINA_UNUSED)
1905 { 1921 {
1906 _elm_scroll_anim_stop(sid); 1922 _elm_scroll_anim_stop(sid);
1907 } 1923 }
1908 ELM_SAFE_FREE(sid->scrollto.x.animator, ecore_animator_del); 1924 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->scrollto.x.animator, _elm_scroll_scroll_to_x_animator, sid);
1909 ELM_SAFE_FREE(sid->scrollto.y.animator, ecore_animator_del); 1925 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->scrollto.y.animator, _elm_scroll_scroll_to_y_animator, sid);
1910 if (sid->down.bounce_x_animator) 1926 if (sid->down.bounce_x_animator)
1911 { 1927 {
1912 ELM_SAFE_FREE(sid->down.bounce_x_animator, ecore_animator_del); 1928 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->down.bounce_x_animator, _elm_scroll_bounce_x_animator, sid->obj);
1913 sid->bouncemex = EINA_FALSE; 1929 sid->bouncemex = EINA_FALSE;
1914 if (sid->content_info.resized) 1930 if (sid->content_info.resized)
1915 _elm_scroll_wanted_region_set(sid->obj); 1931 _elm_scroll_wanted_region_set(sid->obj);
1916 } 1932 }
1917 if (sid->down.bounce_y_animator) 1933 if (sid->down.bounce_y_animator)
1918 { 1934 {
1919 ELM_SAFE_FREE(sid->down.bounce_y_animator, ecore_animator_del); 1935 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->down.bounce_y_animator, _elm_scroll_bounce_y_animator, sid->obj);
1920 sid->bouncemey = EINA_FALSE; 1936 sid->bouncemey = EINA_FALSE;
1921 if (sid->content_info.resized) 1937 if (sid->content_info.resized)
1922 _elm_scroll_wanted_region_set(sid->obj); 1938 _elm_scroll_wanted_region_set(sid->obj);
@@ -2067,7 +2083,7 @@ _paging_is_enabled(Elm_Scrollable_Smart_Interface_Data *sid)
2067} 2083}
2068 2084
2069static Eina_Bool 2085static Eina_Bool
2070_elm_scroll_momentum_animator(void *data) 2086_elm_scroll_momentum_animator(void *data, Eo *o EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
2071{ 2087{
2072 double t, at, dt, p, r; 2088 double t, at, dt, p, r;
2073 Elm_Scrollable_Smart_Interface_Data *sid = data; 2089 Elm_Scrollable_Smart_Interface_Data *sid = data;
@@ -2076,8 +2092,8 @@ _elm_scroll_momentum_animator(void *data)
2076 2092
2077 if (!sid->pan_obj) 2093 if (!sid->pan_obj)
2078 { 2094 {
2079 sid->down.momentum_animator = NULL; 2095 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->down.momentum_animator, _elm_scroll_momentum_animator, sid);
2080 return ECORE_CALLBACK_CANCEL; 2096 return EO_CALLBACK_CONTINUE;
2081 } 2097 }
2082 2098
2083 t = ecore_loop_time_get(); 2099 t = ecore_loop_time_get();
@@ -2136,7 +2152,7 @@ _elm_scroll_momentum_animator(void *data)
2136 { 2152 {
2137 _elm_scroll_anim_stop(sid); 2153 _elm_scroll_anim_stop(sid);
2138 2154
2139 sid->down.momentum_animator = NULL; 2155 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->down.momentum_animator, _elm_scroll_momentum_animator, sid);
2140 sid->down.bounce_x_hold = EINA_FALSE; 2156 sid->down.bounce_x_hold = EINA_FALSE;
2141 sid->down.bounce_y_hold = EINA_FALSE; 2157 sid->down.bounce_y_hold = EINA_FALSE;
2142 sid->down.ax = 0; 2158 sid->down.ax = 0;
@@ -2145,12 +2161,10 @@ _elm_scroll_momentum_animator(void *data)
2145 sid->down.pdy = 0; 2161 sid->down.pdy = 0;
2146 if (sid->content_info.resized) 2162 if (sid->content_info.resized)
2147 _elm_scroll_wanted_region_set(sid->obj); 2163 _elm_scroll_wanted_region_set(sid->obj);
2148
2149 return ECORE_CALLBACK_CANCEL;
2150 } 2164 }
2151 } 2165 }
2152 2166
2153 return ECORE_CALLBACK_RENEW; 2167 return EO_CALLBACK_CONTINUE;
2154} 2168}
2155 2169
2156static Evas_Coord 2170static Evas_Coord
@@ -2248,17 +2262,13 @@ _elm_scroll_page_y_get(Elm_Scrollable_Smart_Interface_Data *sid,
2248} 2262}
2249 2263
2250static Eina_Bool 2264static Eina_Bool
2251_elm_scroll_scroll_to_x_animator(void *data) 2265_elm_scroll_scroll_to_x_animator(void *data, Eo *o EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
2252{ 2266{
2253 Elm_Scrollable_Smart_Interface_Data *sid = data; 2267 Elm_Scrollable_Smart_Interface_Data *sid = data;
2254 Evas_Coord px, py; 2268 Evas_Coord px, py;
2255 double t, tt; 2269 double t, tt;
2256 2270
2257 if (!sid->pan_obj) 2271 if (!sid->pan_obj) goto on_end;
2258 {
2259 sid->scrollto.x.animator = NULL;
2260 return ECORE_CALLBACK_CANCEL;
2261 }
2262 2272
2263 t = ecore_loop_time_get(); 2273 t = ecore_loop_time_get();
2264 tt = (t - sid->scrollto.x.t_start) / 2274 tt = (t - sid->scrollto.x.t_start) /
@@ -2276,24 +2286,27 @@ _elm_scroll_scroll_to_x_animator(void *data)
2276 sid->down.x = sid->down.history[0].x; 2286 sid->down.x = sid->down.history[0].x;
2277 sid->down.pdx = 0; 2287 sid->down.pdx = 0;
2278 _elm_scroll_wanted_coordinates_update(sid, px, py); 2288 _elm_scroll_wanted_coordinates_update(sid, px, py);
2279 sid->scrollto.x.animator = NULL;
2280 if ((!sid->scrollto.y.animator) && (!sid->down.bounce_y_animator)) 2289 if ((!sid->scrollto.y.animator) && (!sid->down.bounce_y_animator))
2281 _elm_scroll_anim_stop(sid); 2290 _elm_scroll_anim_stop(sid);
2282 return ECORE_CALLBACK_CANCEL; 2291 goto on_end;
2283 } 2292 }
2284 eo_do(sid->obj, elm_interface_scrollable_content_pos_set(px, py, EINA_TRUE)); 2293 eo_do(sid->obj, elm_interface_scrollable_content_pos_set(px, py, EINA_TRUE));
2285 _elm_scroll_wanted_coordinates_update(sid, px, py); 2294 _elm_scroll_wanted_coordinates_update(sid, px, py);
2286 return ECORE_CALLBACK_RENEW; 2295 return EO_CALLBACK_CONTINUE;
2296
2297 on_end:
2298 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->scrollto.x.animator, _elm_scroll_scroll_to_x_animator, sid);
2299 return EO_CALLBACK_CONTINUE;
2287} 2300}
2288 2301
2289static Eina_Bool 2302static Eina_Bool
2290_elm_scroll_scroll_to_y_animator(void *data) 2303_elm_scroll_scroll_to_y_animator(void *data, Eo *o EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
2291{ 2304{
2292 Elm_Scrollable_Smart_Interface_Data *sid = data; 2305 Elm_Scrollable_Smart_Interface_Data *sid = data;
2293 Evas_Coord px, py; 2306 Evas_Coord px, py;
2294 double t, tt; 2307 double t, tt;
2295 2308
2296 if (!sid->pan_obj) return EINA_FALSE; 2309 if (!sid->pan_obj) goto on_end;
2297 2310
2298 t = ecore_loop_time_get(); 2311 t = ecore_loop_time_get();
2299 tt = (t - sid->scrollto.y.t_start) / 2312 tt = (t - sid->scrollto.y.t_start) /
@@ -2311,15 +2324,18 @@ _elm_scroll_scroll_to_y_animator(void *data)
2311 sid->down.y = sid->down.history[0].y; 2324 sid->down.y = sid->down.history[0].y;
2312 sid->down.pdy = 0; 2325 sid->down.pdy = 0;
2313 _elm_scroll_wanted_coordinates_update(sid, px, py); 2326 _elm_scroll_wanted_coordinates_update(sid, px, py);
2314 sid->scrollto.y.animator = NULL;
2315 if ((!sid->scrollto.x.animator) && (!sid->down.bounce_x_animator)) 2327 if ((!sid->scrollto.x.animator) && (!sid->down.bounce_x_animator))
2316 _elm_scroll_anim_stop(sid); 2328 _elm_scroll_anim_stop(sid);
2317 return ECORE_CALLBACK_CANCEL; 2329 goto on_end;
2318 } 2330 }
2319 eo_do(sid->obj, elm_interface_scrollable_content_pos_set(px, py, EINA_TRUE)); 2331 eo_do(sid->obj, elm_interface_scrollable_content_pos_set(px, py, EINA_TRUE));
2320 _elm_scroll_wanted_coordinates_update(sid, px, py); 2332 _elm_scroll_wanted_coordinates_update(sid, px, py);
2321 2333
2322 return ECORE_CALLBACK_RENEW; 2334 return EO_CALLBACK_CONTINUE;
2335
2336 on_end:
2337 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->scrollto.y.animator, _elm_scroll_scroll_to_y_animator, sid);
2338 return EO_CALLBACK_CONTINUE;
2323} 2339}
2324 2340
2325static void 2341static void
@@ -2350,14 +2366,13 @@ _elm_scroll_scroll_to_y(Elm_Scrollable_Smart_Interface_Data *sid,
2350 sid->scrollto.y.t_end = t + t_in; 2366 sid->scrollto.y.t_end = t + t_in;
2351 if (!sid->scrollto.y.animator) 2367 if (!sid->scrollto.y.animator)
2352 { 2368 {
2353 sid->scrollto.y.animator = 2369 ELM_ANIMATOR_CONNECT(sid->obj, sid->scrollto.y.animator, _elm_scroll_scroll_to_y_animator, sid);
2354 ecore_animator_add(_elm_scroll_scroll_to_y_animator, sid);
2355 if (!sid->scrollto.x.animator) 2370 if (!sid->scrollto.x.animator)
2356 _elm_scroll_anim_start(sid); 2371 _elm_scroll_anim_start(sid);
2357 } 2372 }
2358 if (sid->down.bounce_y_animator) 2373 if (sid->down.bounce_y_animator)
2359 { 2374 {
2360 ELM_SAFE_FREE(sid->down.bounce_y_animator, ecore_animator_del); 2375 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->down.bounce_y_animator, _elm_scroll_bounce_y_animator, sid->obj);
2361 _elm_scroll_momentum_end(sid); 2376 _elm_scroll_momentum_end(sid);
2362 if (sid->content_info.resized) 2377 if (sid->content_info.resized)
2363 _elm_scroll_wanted_region_set(sid->obj); 2378 _elm_scroll_wanted_region_set(sid->obj);
@@ -2394,14 +2409,13 @@ _elm_scroll_scroll_to_x(Elm_Scrollable_Smart_Interface_Data *sid,
2394 sid->scrollto.x.t_end = t + t_in; 2409 sid->scrollto.x.t_end = t + t_in;
2395 if (!sid->scrollto.x.animator) 2410 if (!sid->scrollto.x.animator)
2396 { 2411 {
2397 sid->scrollto.x.animator = 2412 ELM_ANIMATOR_CONNECT(sid->obj, sid->scrollto.x.animator, _elm_scroll_scroll_to_x_animator, sid);
2398 ecore_animator_add(_elm_scroll_scroll_to_x_animator, sid);
2399 if (!sid->scrollto.y.animator) 2413 if (!sid->scrollto.y.animator)
2400 _elm_scroll_anim_start(sid); 2414 _elm_scroll_anim_start(sid);
2401 } 2415 }
2402 if (sid->down.bounce_x_animator) 2416 if (sid->down.bounce_x_animator)
2403 { 2417 {
2404 ELM_SAFE_FREE(sid->down.bounce_x_animator, ecore_animator_del); 2418 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->down.bounce_x_animator, _elm_scroll_bounce_x_animator, sid->obj);
2405 _elm_scroll_momentum_end(sid); 2419 _elm_scroll_momentum_end(sid);
2406 if (sid->content_info.resized) 2420 if (sid->content_info.resized)
2407 _elm_scroll_wanted_region_set(sid->obj); 2421 _elm_scroll_wanted_region_set(sid->obj);
@@ -2442,7 +2456,7 @@ _elm_scroll_mouse_up_event_cb(void *data,
2442 { 2456 {
2443 if (sid->down.onhold_animator) 2457 if (sid->down.onhold_animator)
2444 { 2458 {
2445 ELM_SAFE_FREE(sid->down.onhold_animator, ecore_animator_del); 2459 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->down.onhold_animator, _elm_scroll_on_hold_animator, sid);
2446 if (sid->content_info.resized) 2460 if (sid->content_info.resized)
2447 _elm_scroll_wanted_region_set(sid->obj); 2461 _elm_scroll_wanted_region_set(sid->obj);
2448 } 2462 }
@@ -2573,9 +2587,7 @@ _elm_scroll_mouse_up_event_cb(void *data,
2573 (!elm_widget_drag_child_locked_y_get 2587 (!elm_widget_drag_child_locked_y_get
2574 (sid->obj))) 2588 (sid->obj)))
2575 { 2589 {
2576 sid->down.momentum_animator = 2590 ELM_ANIMATOR_CONNECT(sid->obj, sid->down.momentum_animator, _elm_scroll_momentum_animator, sid);
2577 ecore_animator_add
2578 (_elm_scroll_momentum_animator, sid);
2579 ev->event_flags |= 2591 ev->event_flags |=
2580 EVAS_EVENT_FLAG_ON_SCROLL; 2592 EVAS_EVENT_FLAG_ON_SCROLL;
2581 _elm_scroll_anim_start(sid); 2593 _elm_scroll_anim_start(sid);
@@ -2665,7 +2677,7 @@ _elm_scroll_mouse_up_event_cb(void *data,
2665 } 2677 }
2666 if (sid->down.hold_animator) 2678 if (sid->down.hold_animator)
2667 { 2679 {
2668 ELM_SAFE_FREE(sid->down.hold_animator, ecore_animator_del); 2680 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->down.hold_animator, _elm_scroll_hold_animator, sid);
2669 if (sid->content_info.resized) 2681 if (sid->content_info.resized)
2670 _elm_scroll_wanted_region_set(sid->obj); 2682 _elm_scroll_wanted_region_set(sid->obj);
2671 } 2683 }
@@ -2733,25 +2745,25 @@ _elm_scroll_mouse_down_event_cb(void *data,
2733 sid->down.hold = EINA_TRUE; 2745 sid->down.hold = EINA_TRUE;
2734 _elm_scroll_anim_stop(sid); 2746 _elm_scroll_anim_stop(sid);
2735 } 2747 }
2736 ELM_SAFE_FREE(sid->scrollto.x.animator, ecore_animator_del); 2748 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->scrollto.x.animator, _elm_scroll_scroll_to_x_animator, sid);
2737 ELM_SAFE_FREE(sid->scrollto.y.animator, ecore_animator_del); 2749 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->scrollto.y.animator, _elm_scroll_scroll_to_y_animator, sid);
2738 if (sid->down.bounce_x_animator) 2750 if (sid->down.bounce_x_animator)
2739 { 2751 {
2740 ELM_SAFE_FREE(sid->down.bounce_x_animator, ecore_animator_del); 2752 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->down.bounce_x_animator, _elm_scroll_bounce_x_animator, sid->obj);
2741 sid->bouncemex = EINA_FALSE; 2753 sid->bouncemex = EINA_FALSE;
2742 if (sid->content_info.resized) 2754 if (sid->content_info.resized)
2743 _elm_scroll_wanted_region_set(sid->obj); 2755 _elm_scroll_wanted_region_set(sid->obj);
2744 } 2756 }
2745 if (sid->down.bounce_y_animator) 2757 if (sid->down.bounce_y_animator)
2746 { 2758 {
2747 ELM_SAFE_FREE(sid->down.bounce_y_animator, ecore_animator_del); 2759 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->down.bounce_y_animator, _elm_scroll_bounce_y_animator, sid->obj);
2748 sid->bouncemey = EINA_FALSE; 2760 sid->bouncemey = EINA_FALSE;
2749 if (sid->content_info.resized) 2761 if (sid->content_info.resized)
2750 _elm_scroll_wanted_region_set(sid->obj); 2762 _elm_scroll_wanted_region_set(sid->obj);
2751 } 2763 }
2752 if (sid->down.hold_animator) 2764 if (sid->down.hold_animator)
2753 { 2765 {
2754 ELM_SAFE_FREE(sid->down.hold_animator, ecore_animator_del); 2766 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->down.hold_animator, _elm_scroll_hold_animator, sid);
2755 _elm_scroll_drag_stop(sid); 2767 _elm_scroll_drag_stop(sid);
2756 if (sid->content_info.resized) 2768 if (sid->content_info.resized)
2757 _elm_scroll_wanted_region_set(sid->obj); 2769 _elm_scroll_wanted_region_set(sid->obj);
@@ -2759,7 +2771,7 @@ _elm_scroll_mouse_down_event_cb(void *data,
2759 ELM_SAFE_FREE(sid->down.hold_enterer, ecore_idle_enterer_del); 2771 ELM_SAFE_FREE(sid->down.hold_enterer, ecore_idle_enterer_del);
2760 if (sid->down.momentum_animator) 2772 if (sid->down.momentum_animator)
2761 { 2773 {
2762 ELM_SAFE_FREE(sid->down.momentum_animator, ecore_animator_del); 2774 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->down.momentum_animator, _elm_scroll_momentum_animator, sid);
2763 sid->down.bounce_x_hold = EINA_FALSE; 2775 sid->down.bounce_x_hold = EINA_FALSE;
2764 sid->down.bounce_y_hold = EINA_FALSE; 2776 sid->down.bounce_y_hold = EINA_FALSE;
2765 sid->down.ax = 0; 2777 sid->down.ax = 0;
@@ -3084,18 +3096,24 @@ _elm_scroll_hold_enterer(void *data)
3084} 3096}
3085 3097
3086static Eina_Bool 3098static Eina_Bool
3087_elm_scroll_hold_animator(void *data) 3099_elm_scroll_hold_animator(void *data,
3100 Eo *o EINA_UNUSED,
3101 const Eo_Event_Description *desc EINA_UNUSED,
3102 void *event_info EINA_UNUSED)
3088{ 3103{
3089 Elm_Scrollable_Smart_Interface_Data *sid = data; 3104 Elm_Scrollable_Smart_Interface_Data *sid = data;
3090 3105
3091 ecore_idle_enterer_del(sid->down.hold_enterer); 3106 ecore_idle_enterer_del(sid->down.hold_enterer);
3092 sid->down.hold_enterer = 3107 sid->down.hold_enterer =
3093 ecore_idle_enterer_before_add(_elm_scroll_hold_enterer, sid); 3108 ecore_idle_enterer_before_add(_elm_scroll_hold_enterer, sid);
3094 return ECORE_CALLBACK_RENEW; 3109 return EO_CALLBACK_CONTINUE;
3095} 3110}
3096 3111
3097static Eina_Bool 3112static Eina_Bool
3098_elm_scroll_on_hold_animator(void *data) 3113_elm_scroll_on_hold_animator(void *data,
3114 Eo *o EINA_UNUSED,
3115 const Eo_Event_Description *desc EINA_UNUSED,
3116 void *event_info EINA_UNUSED)
3099{ 3117{
3100 double t, td; 3118 double t, td;
3101 double vx, vy; 3119 double vx, vy;
@@ -3141,7 +3159,7 @@ _elm_scroll_on_hold_animator(void *data)
3141 } 3159 }
3142 sid->down.onhold_tlast = t; 3160 sid->down.onhold_tlast = t;
3143 3161
3144 return ECORE_CALLBACK_RENEW; 3162 return EO_CALLBACK_CONTINUE;
3145} 3163}
3146 3164
3147static void 3165static void
@@ -3175,7 +3193,7 @@ _elm_scroll_mouse_move_event_cb(void *data,
3175 !(sid->block & ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL)) 3193 !(sid->block & ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL))
3176 { 3194 {
3177 Evas_Coord px = 0; 3195 Evas_Coord px = 0;
3178 ELM_SAFE_FREE(sid->scrollto.x.animator, ecore_animator_del); 3196 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->scrollto.x.animator, _elm_scroll_scroll_to_x_animator, sid);
3179 eo_do(sid->pan_obj, elm_obj_pan_pos_get(&px, NULL)); 3197 eo_do(sid->pan_obj, elm_obj_pan_pos_get(&px, NULL));
3180 sid->down.sx = px; 3198 sid->down.sx = px;
3181 sid->down.x = sid->down.history[0].x; 3199 sid->down.x = sid->down.history[0].x;
@@ -3185,7 +3203,7 @@ _elm_scroll_mouse_move_event_cb(void *data,
3185 !(sid->block & ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL)) 3203 !(sid->block & ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL))
3186 { 3204 {
3187 Evas_Coord py = 0; 3205 Evas_Coord py = 0;
3188 ELM_SAFE_FREE(sid->scrollto.y.animator, ecore_animator_del); 3206 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->scrollto.y.animator, _elm_scroll_scroll_to_y_animator, sid);
3189 eo_do(sid->pan_obj, elm_obj_pan_pos_get(NULL, &py)); 3207 eo_do(sid->pan_obj, elm_obj_pan_pos_get(NULL, &py));
3190 sid->down.sy = py; 3208 sid->down.sy = py;
3191 sid->down.y = sid->down.history[0].y; 3209 sid->down.y = sid->down.history[0].y;
@@ -3394,9 +3412,7 @@ _elm_scroll_mouse_move_event_cb(void *data,
3394 3412
3395 sid->down.hold_x = x; 3413 sid->down.hold_x = x;
3396 sid->down.hold_y = y; 3414 sid->down.hold_y = y;
3397 if (!sid->down.hold_animator) 3415 ELM_ANIMATOR_CONNECT(sid->obj, sid->down.hold_animator, _elm_scroll_hold_animator, sid);
3398 sid->down.hold_animator =
3399 ecore_animator_add(_elm_scroll_hold_animator, sid);
3400 } 3416 }
3401 else 3417 else
3402 { 3418 {
@@ -3465,15 +3481,15 @@ _elm_scroll_mouse_move_event_cb(void *data,
3465 sid->down.onhold_vxe = 0.0; 3481 sid->down.onhold_vxe = 0.0;
3466 sid->down.onhold_vye = 0.0; 3482 sid->down.onhold_vye = 0.0;
3467 sid->down.onhold_tlast = 0.0; 3483 sid->down.onhold_tlast = 0.0;
3468 sid->down.onhold_animator = ecore_animator_add 3484
3469 (_elm_scroll_on_hold_animator, sid); 3485 ELM_ANIMATOR_CONNECT(sid->obj, sid->down.onhold_animator, _elm_scroll_on_hold_animator, sid);
3470 } 3486 }
3471 } 3487 }
3472 else 3488 else
3473 { 3489 {
3474 if (sid->down.onhold_animator) 3490 if (sid->down.onhold_animator)
3475 { 3491 {
3476 ELM_SAFE_FREE(sid->down.onhold_animator, ecore_animator_del); 3492 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->down.onhold_animator, _elm_scroll_on_hold_animator, sid);
3477 if (sid->content_info.resized) 3493 if (sid->content_info.resized)
3478 _elm_scroll_wanted_region_set(sid->obj); 3494 _elm_scroll_wanted_region_set(sid->obj);
3479 } 3495 }
@@ -4080,7 +4096,7 @@ _elm_interface_scrollable_momentum_animator_disabled_set(Eo *obj EINA_UNUSED, El
4080 { 4096 {
4081 if (sid->down.momentum_animator) 4097 if (sid->down.momentum_animator)
4082 { 4098 {
4083 ELM_SAFE_FREE(sid->down.momentum_animator, ecore_animator_del); 4099 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->down.momentum_animator, _elm_scroll_momentum_animator, sid);
4084 if (sid->content_info.resized) 4100 if (sid->content_info.resized)
4085 _elm_scroll_wanted_region_set(sid->obj); 4101 _elm_scroll_wanted_region_set(sid->obj);
4086 } 4102 }
@@ -4099,8 +4115,8 @@ _elm_interface_scrollable_bounce_animator_disabled_set(Eo *obj EINA_UNUSED, Elm_
4099 sid->bounce_animator_disabled = disabled; 4115 sid->bounce_animator_disabled = disabled;
4100 if (sid->bounce_animator_disabled) 4116 if (sid->bounce_animator_disabled)
4101 { 4117 {
4102 ELM_SAFE_FREE(sid->scrollto.x.animator, ecore_animator_del); 4118 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->scrollto.x.animator, _elm_scroll_scroll_to_x_animator, sid);
4103 ELM_SAFE_FREE(sid->scrollto.y.animator, ecore_animator_del); 4119 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->scrollto.y.animator, _elm_scroll_scroll_to_y_animator, sid);
4104 } 4120 }
4105} 4121}
4106 4122
@@ -4224,7 +4240,7 @@ _elm_interface_scrollable_freeze_set(Eo *obj EINA_UNUSED, Elm_Scrollable_Smart_I
4224 { 4240 {
4225 if (sid->down.onhold_animator) 4241 if (sid->down.onhold_animator)
4226 { 4242 {
4227 ELM_SAFE_FREE(sid->down.onhold_animator, ecore_animator_del); 4243 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->down.onhold_animator, _elm_scroll_on_hold_animator, sid);
4228 if (sid->content_info.resized) 4244 if (sid->content_info.resized)
4229 _elm_scroll_wanted_region_set(sid->obj); 4245 _elm_scroll_wanted_region_set(sid->obj);
4230 } 4246 }
@@ -4524,13 +4540,13 @@ _elm_interface_scrollable_evas_object_smart_del(Eo *obj, Elm_Scrollable_Smart_In
4524 if (!sid->extern_pan) evas_object_del(sid->pan_obj); 4540 if (!sid->extern_pan) evas_object_del(sid->pan_obj);
4525 4541
4526 ecore_idle_enterer_del(sid->down.hold_enterer); 4542 ecore_idle_enterer_del(sid->down.hold_enterer);
4527 ecore_animator_del(sid->down.hold_animator); 4543 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->down.hold_animator, _elm_scroll_hold_animator, sid);
4528 ecore_animator_del(sid->down.onhold_animator); 4544 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->down.onhold_animator, _elm_scroll_on_hold_animator, sid);
4529 ecore_animator_del(sid->down.momentum_animator); 4545 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->down.momentum_animator, _elm_scroll_momentum_animator, sid);
4530 ecore_animator_del(sid->down.bounce_x_animator); 4546 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->down.bounce_x_animator, _elm_scroll_bounce_x_animator, sid->obj);
4531 ecore_animator_del(sid->down.bounce_y_animator); 4547 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->down.bounce_y_animator, _elm_scroll_bounce_y_animator, sid->obj);
4532 ecore_animator_del(sid->scrollto.x.animator); 4548 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->scrollto.x.animator, _elm_scroll_scroll_to_x_animator, sid);
4533 ecore_animator_del(sid->scrollto.y.animator); 4549 ELM_ANIMATOR_DISCONNECT(sid->obj, sid->scrollto.y.animator, _elm_scroll_scroll_to_y_animator, sid);
4534} 4550}
4535 4551
4536EOLIAN static void 4552EOLIAN static void
diff --git a/src/lib/elm_interface_scrollable.h b/src/lib/elm_interface_scrollable.h
index 4038eb94e..d5a38c32d 100644
--- a/src/lib/elm_interface_scrollable.h
+++ b/src/lib/elm_interface_scrollable.h
@@ -112,11 +112,12 @@ struct _Elm_Scrollable_Smart_Interface_Data
112 int hdir, vdir; 112 int hdir, vdir;
113 113
114 Ecore_Idle_Enterer *hold_enterer; 114 Ecore_Idle_Enterer *hold_enterer;
115 Ecore_Animator *hold_animator; 115
116 Ecore_Animator *onhold_animator; 116 Eina_Bool hold_animator : 1;
117 Ecore_Animator *momentum_animator; /**< an animator which is called whenever a scroller is moving due to a flick action(mouse down, move, up) */ 117 Eina_Bool onhold_animator : 1;
118 Ecore_Animator *bounce_x_animator; /**< an animator to express the bouncing animation on x axis. */ 118 Eina_Bool momentum_animator : 1; /**< an animator which is called whenever a scroller is moving due to a flick action(mouse down, move, up) */
119 Ecore_Animator *bounce_y_animator; /**< an animator to express the bouncing animation on y axis. */ 119 Eina_Bool bounce_x_animator : 1; /**< an animator to express the bouncing animation on x axis. */
120 Eina_Bool bounce_y_animator : 1; /**< an animator to express the bouncing animation on y axis. */
120 121
121 Eina_Bool last_hold_x_wheel : 1; 122 Eina_Bool last_hold_x_wheel : 1;
122 Eina_Bool last_hold_y_wheel : 1; 123 Eina_Bool last_hold_y_wheel : 1;
@@ -180,7 +181,7 @@ struct _Elm_Scrollable_Smart_Interface_Data
180 { 181 {
181 Evas_Coord start, end; 182 Evas_Coord start, end;
182 double t_start, t_end; 183 double t_start, t_end;
183 Ecore_Animator *animator; 184 Eina_Bool animator;
184 } x, y; 185 } x, y;
185 } scrollto; 186 } scrollto;
186 187