interface_scrollable: delete unnecessary smart callback call.
authorHosang Kim <hosang12.kim@samsung.com>
Tue, 3 Nov 2015 20:29:05 +0000 (12:29 -0800)
committerCedric BAIL <cedric@osg.samsung.com>
Thu, 5 Nov 2015 00:23:32 +0000 (16:23 -0800)
Summary:
When _elm_interface_scrollable_page_bring_in is called, page is not changed yet.
So "page,changed" smart callback is unnecessary.

Sometimes "page,changed" smart callback is called twice.
Because "drag,stop" and "anim,stop"is called it.
So I add updating current page code.

Test Plan:
elementary_test -> scroller

1. using wheel.
2. using "prev page" and "next page".
3. draging sceen

Reviewers: Hermet, singh.amitesh, cedric, raster, jaehwan, seoz

Differential Revision: https://phab.enlightenment.org/D3260

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
src/lib/elm_interface_scrollable.c

index 23d0ebb..ab2db63 100644 (file)
@@ -939,6 +939,8 @@ _elm_scroll_drag_stop(Elm_Scrollable_Smart_Interface_Data *sid)
         if (sid->cb_func.page_change &&
             ((x != sid->current_page.x) || (y != sid->current_page.y)))
           sid->cb_func.page_change(sid->obj, NULL);
+        sid->current_page.x = x;
+        sid->current_page.y = y;
      }
 
    if (sid->cb_func.drag_stop)
@@ -948,6 +950,9 @@ _elm_scroll_drag_stop(Elm_Scrollable_Smart_Interface_Data *sid)
 static void
 _elm_scroll_anim_start(Elm_Scrollable_Smart_Interface_Data *sid)
 {
+   sid->current_page.x = _elm_scroll_page_x_get(sid, 0, EINA_FALSE);
+   sid->current_page.y = _elm_scroll_page_y_get(sid, 0, EINA_FALSE);
+
    if (sid->cb_func.animate_start)
      sid->cb_func.animate_start(sid->obj, NULL);
 }
@@ -963,6 +968,8 @@ _elm_scroll_anim_stop(Elm_Scrollable_Smart_Interface_Data *sid)
         y = _elm_scroll_page_y_get(sid, 0, EINA_FALSE);
         if ((x != sid->current_page.x) || (y != sid->current_page.y))
            sid->cb_func.page_change(sid->obj, NULL);
+        sid->current_page.x = x;
+        sid->current_page.y = y;
      }
 
    if (sid->cb_func.animate_stop)
@@ -4395,9 +4402,6 @@ _elm_interface_scrollable_page_bring_in(Eo *obj, Elm_Scrollable_Smart_Interface_
    Evas_Coord x = 0;
    Evas_Coord y = 0;
 
-   sid->current_page.x = _elm_scroll_page_x_get(sid, 0, EINA_FALSE);
-   sid->current_page.y = _elm_scroll_page_y_get(sid, 0, EINA_FALSE);
-
    eo_do(sid->obj, elm_interface_scrollable_content_viewport_geometry_get
          (NULL, NULL, &w, &h));
    x = sid->pagesize_h * pagenumber_h;
@@ -4407,12 +4411,6 @@ _elm_interface_scrollable_page_bring_in(Eo *obj, Elm_Scrollable_Smart_Interface_
         _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);
      }
-
-   if ((sid->current_page.x != x) || (sid->current_page.y != y))
-     {
-        if (sid->cb_func.page_change)
-          sid->cb_func.page_change(sid->obj, NULL);
-     }
 }
 
 EOLIAN static void