From a82cbdef2ce9394d8b9c656dfc9c97d8f08731ef Mon Sep 17 00:00:00 2001 From: Jaehwan Kim Date: Tue, 18 Jun 2013 16:33:28 +0900 Subject: [PATCH] In case of scroll in scroll, the child scroller have to bounce if parents don't have a bounce. Change-Id: Ia101c9bb22888bb96a092b302337a161acaca7d8 --- src/lib/elm_interface_scrollable.c | 6 ++++-- src/lib/elm_widget.c | 28 ++++++++++++++++++++++++++++ src/lib/elm_widget.h | 1 + 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/lib/elm_interface_scrollable.c b/src/lib/elm_interface_scrollable.c index 540be30..e931fc3 100644 --- a/src/lib/elm_interface_scrollable.c +++ b/src/lib/elm_interface_scrollable.c @@ -2548,19 +2548,21 @@ _elm_scroll_post_event_move(void *data, Evas *e __UNUSED__) { Elm_Scrollable_Smart_Interface_Data *sid = data; + Eina_Bool horiz, vert; if (sid->down.want_dragged) { int start = 0; + elm_widget_parents_bounce_get(sid->obj, &horiz, &vert); if (sid->down.hold_parent) { - if ((sid->down.dir_x) && + if ((sid->down.dir_x) && horiz && !_elm_scroll_can_scroll(sid, sid->down.hdir)) { sid->down.dir_x = EINA_FALSE; } - if ((sid->down.dir_y) && + if ((sid->down.dir_y) && vert && !_elm_scroll_can_scroll(sid, sid->down.vdir)) { sid->down.dir_y = EINA_FALSE; diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c index e52174f..dbc2dd7 100644 --- a/src/lib/elm_widget.c +++ b/src/lib/elm_widget.c @@ -3071,6 +3071,34 @@ elm_widget_focus_region_get(const Evas_Object *obj, return EINA_TRUE; } +EAPI void +elm_widget_parents_bounce_get(Evas_Object *obj, + Eina_Bool *horiz, Eina_Bool *vert) +{ + ELM_WIDGET_CHECK_OR_RETURN(obj); + + Evas_Object *parent_obj = obj; + Eina_Bool h, v; + + *horiz = EINA_FALSE; + *vert = EINA_FALSE; + + do + { + parent_obj = elm_widget_parent_get(parent_obj); + if ((!parent_obj) || (!_elm_widget_is(parent_obj))) break; + + if (_elm_scrollable_is(parent_obj)) + { + ELM_SCROLLABLE_IFACE_GET(parent_obj, s_iface); + s_iface->bounce_allow_get(parent_obj, &h, &v); + if (h) *horiz = EINA_TRUE; + if (v) *vert = EINA_TRUE; + } + } + while (parent_obj); +} + EAPI Eina_List * elm_widget_scrollable_children_get(Evas_Object *obj) { diff --git a/src/lib/elm_widget.h b/src/lib/elm_widget.h index 5fc512e..deb64e8 100644 --- a/src/lib/elm_widget.h +++ b/src/lib/elm_widget.h @@ -768,6 +768,7 @@ EAPI Eina_Bool elm_widget_disabled_get(const Evas_Object *obj); EAPI void elm_widget_show_region_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h, Eina_Bool forceshow); EAPI void elm_widget_show_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); EAPI Eina_Bool elm_widget_focus_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); +EAPI void elm_widget_parents_bounce_get(Evas_Object *obj, Eina_Bool *horiz, Eina_Bool *vert); EAPI void elm_widget_scroll_hold_push(Evas_Object *obj); EAPI void elm_widget_scroll_hold_pop(Evas_Object *obj); EAPI int elm_widget_scroll_hold_get(const Evas_Object *obj); -- 2.7.4