interface_scrollable: Compensate scroller when scroller is not stable 15/124415/1
authorWonki Kim <wonki_.kim@samsung.com>
Mon, 27 Feb 2017 10:46:13 +0000 (19:46 +0900)
committerWonki Kim <wonki_.kim@samsung.com>
Tue, 11 Apr 2017 08:29:04 +0000 (17:29 +0900)
Scroller internal states could be invalid when scroller is being calculated.
However, user app code could call scroller apis in middle of calculating of the scroller,
which mean apis are excuted on the invalid states of the scroller.
In that case, scroller api couldn't make what they want to do at all.

This patch compensates the current "Scroller Logic" when getting a more
exact page infomation from scroller while the "Scroller" is calculated.

@tizen_fix

Change-Id: If14ec3dac225dcc95f0666af7e0639a2958c667c
Signed-off-by: Wonki Kim <wonki_.kim@samsung.com>
src/lib/elm_interface_scrollable.c
src/lib/elm_interface_scrollable.h

index f42f2d3..e394669 100644 (file)
@@ -4545,8 +4545,30 @@ _elm_scroll_pan_changed_cb(void *data,
         evas_object_size_hint_min_set
           (sid->edje_obj, sid->content_info.w, sid->content_info.h);
         sid->content_info.resized = EINA_TRUE;
-        //TIZEN_ONLY(20150825) : Use the specific wanted_region_set func only for gengrid.
-        eo_do(sid->obj, elm_interface_scrollable_wanted_region_set(sid->wx, sid->wy));
+
+        //FIXME FIXME FIXME: Would you please fix me ?
+        //TIZEN_ONLY(20170227): Compensate scroller when scroller is not stable.
+        int current_calc = 0;
+        Evas_Coord x = 0, y = 0;
+        current_calc = evas_smart_objects_calculate_count_get(evas_object_evas_get(obj));
+        if (sid->requested_page.loop_cnt == current_calc)
+          {
+             ELM_SAFE_FREE(sid->scrollto.x.animator, ecore_animator_del);
+             ELM_SAFE_FREE(sid->scrollto.y.animator, ecore_animator_del);
+
+             x = sid->pagesize_h * sid->requested_page.h;
+             x = (sid->is_mirrored ? _elm_scroll_x_mirrored_get(sid->obj, x) : x);
+             y = sid->pagesize_v * sid->requested_page.v;
+
+             _elm_scroll_wanted_coordinates_update(sid, x, y);
+             eo_do(sid->pan_obj, elm_obj_pan_pos_set(x, y));
+          }
+        else
+          {
+             //TIZEN_ONLY(20150825) : Use the specific wanted_region_set func only for gengrid.
+             eo_do(sid->obj, elm_interface_scrollable_wanted_region_set(sid->wx, sid->wy));
+             //END
+          }
         //END
      }
    //TIZEN_ONLY(20170210): update pan position once pan size is changed
@@ -5123,6 +5145,13 @@ _elm_interface_scrollable_page_show(Eo *obj, Elm_Scrollable_Smart_Interface_Data
    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);
 
+   //FIXME FIXME FIXME: Would you please fix me ?
+   //TIZEN_ONLY(20170227): Compensate scroller when scroller is not stable.
+   sid->requested_page.h = pagenumber_h;
+   sid->requested_page.v = pagenumber_v;
+   sid->requested_page.loop_cnt = evas_smart_objects_calculate_count_get(evas_object_evas_get(obj));
+   //END
+
    eo_do(sid->obj, elm_interface_scrollable_content_viewport_geometry_get
          (NULL, NULL, &w, &h));
    x = sid->pagesize_h * pagenumber_h;
@@ -5156,6 +5185,14 @@ _elm_interface_scrollable_page_bring_in(Eo *obj, Elm_Scrollable_Smart_Interface_
    x = sid->pagesize_h * pagenumber_h;
    x = (sid->is_mirrored ? _elm_scroll_x_mirrored_get(sid->obj, x) : x);
    y = sid->pagesize_v * pagenumber_v;
+
+   //FIXME FIXME FIXME: Would you please fix me ?
+   //TIZEN_ONLY(20170227): Compensate scroller when scroller is not stable.
+   sid->requested_page.h = pagenumber_h;
+   sid->requested_page.v = pagenumber_v;
+   sid->requested_page.loop_cnt = evas_smart_objects_calculate_count_get(evas_object_evas_get(obj));
+   //END
+
    if (_elm_scroll_content_region_show_internal(obj, &x, &y, w, h))
      {
         _elm_scroll_scroll_to_x(sid, _elm_config->bring_in_scroll_friction, x);
index 77a7770..b4ce897 100644 (file)
@@ -263,6 +263,15 @@ struct _Elm_Scrollable_Smart_Interface_Data
       Ecore_Job *bar_pos_adjust;
       Ecore_Job *page_adjust;
    } adjust_job;
+
+   //FIXME FIXME FIXME: Would you please fix me ?
+   //TIZEN_ONLY(20170227): Compensate scroller when scroller is not stable
+   struct
+   {
+      Evas_Coord h, v;
+      int loop_cnt;
+   } requested_page;
+   //END
 };
 
 #define ELM_SCROLLABLE_CHECK(obj, ...)                                       \