summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2018-01-15 21:00:51 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2018-01-15 21:01:43 +0900
commitb04aeb41e74a6979bfe66ef859e4d9144b3468b1 (patch)
tree2bcf6d25e8d4e1f0970210c6aaa6ca64dae27e8f
parente926eb316e68bab49bb10171fa1865ba3f5d8c17 (diff)
elm_scroll: Avoid calls to non-existing part
In case of Bryce's style, there are no scroll bars.
-rw-r--r--src/lib/elementary/elm_interface_scrollable.c64
1 files changed, 47 insertions, 17 deletions
diff --git a/src/lib/elementary/elm_interface_scrollable.c b/src/lib/elementary/elm_interface_scrollable.c
index 63d1405664..1d654632a2 100644
--- a/src/lib/elementary/elm_interface_scrollable.c
+++ b/src/lib/elementary/elm_interface_scrollable.c
@@ -780,6 +780,13 @@ _elm_scroll_scroll_bar_visibility_adjust(
780 _elm_scroll_scroll_bar_auto_visibility_adjust(sid); 780 _elm_scroll_scroll_bar_auto_visibility_adjust(sid);
781} 781}
782 782
783static inline Eina_Bool
784_elm_scroll_has_bars(Elm_Scrollable_Smart_Interface_Data *sid)
785{
786 return edje_object_part_exists(sid->edje_obj, "elm.dragable.hbar") ||
787 edje_object_part_exists(sid->edje_obj, "elm.dragable.vbar");
788}
789
783static void 790static void
784_elm_scroll_scroll_bar_size_adjust(Elm_Scrollable_Smart_Interface_Data *sid) 791_elm_scroll_scroll_bar_size_adjust(Elm_Scrollable_Smart_Interface_Data *sid)
785{ 792{
@@ -801,6 +808,10 @@ _elm_scroll_scroll_bar_size_adjust(Elm_Scrollable_Smart_Interface_Data *sid)
801 edje_object_calc_force(sid->edje_obj); 808 edje_object_calc_force(sid->edje_obj);
802 edje_object_part_geometry_get 809 edje_object_part_geometry_get
803 (sid->edje_obj, "elm.swallow.content", NULL, NULL, &vw, &vh); 810 (sid->edje_obj, "elm.swallow.content", NULL, NULL, &vw, &vh);
811
812 if (!_elm_scroll_has_bars(sid))
813 goto skip_bars;
814
804 w = sid->content_info.w; 815 w = sid->content_info.w;
805 if (w < 1) w = 1; 816 if (w < 1) w = 1;
806 size = (double)vw / (double)w; 817 size = (double)vw / (double)w;
@@ -887,16 +898,21 @@ _elm_scroll_scroll_bar_size_adjust(Elm_Scrollable_Smart_Interface_Data *sid)
887 { 898 {
888 Evas_Coord px = 0, py = 0, minx = 0, miny = 0; 899 Evas_Coord px = 0, py = 0, minx = 0, miny = 0;
889 900
890 edje_object_part_drag_size_set 901 if (_elm_scroll_has_bars(sid))
891 (sid->edje_obj, "elm.dragable.vbar", 1.0, 1.0); 902 {
892 edje_object_part_drag_size_set 903 edje_object_part_drag_size_set
893 (sid->edje_obj, "elm.dragable.hbar", 1.0, 1.0); 904 (sid->edje_obj, "elm.dragable.vbar", 1.0, 1.0);
905 edje_object_part_drag_size_set
906 (sid->edje_obj, "elm.dragable.hbar", 1.0, 1.0);
907 }
894 elm_obj_pan_pos_min_get(sid->pan_obj, &minx, &miny); 908 elm_obj_pan_pos_min_get(sid->pan_obj, &minx, &miny);
895 elm_obj_pan_pos_get(sid->pan_obj, &px, &py); 909 elm_obj_pan_pos_get(sid->pan_obj, &px, &py);
896 elm_obj_pan_pos_set(sid->pan_obj, minx, miny); 910 elm_obj_pan_pos_set(sid->pan_obj, minx, miny);
897 if ((px != minx) || (py != miny)) 911 if ((px != minx) || (py != miny))
898 edje_object_signal_emit(sid->edje_obj, "elm,action,scroll", "elm"); 912 edje_object_signal_emit(sid->edje_obj, "elm,action,scroll", "elm");
899 } 913 }
914
915skip_bars:
900 _elm_scroll_scroll_bar_visibility_adjust(sid); 916 _elm_scroll_scroll_bar_visibility_adjust(sid);
901 sid->size_adjust_recurse--; 917 sid->size_adjust_recurse--;
902 if (sid->size_adjust_recurse <= 0) 918 if (sid->size_adjust_recurse <= 0)
@@ -919,6 +935,7 @@ _elm_scroll_scroll_bar_read_and_update(
919 || (sid->down.bounce_y_animator) || (sid->down.momentum_animator) 935 || (sid->down.bounce_y_animator) || (sid->down.momentum_animator)
920 || (sid->scrollto.x.animator) || (sid->scrollto.y.animator)) 936 || (sid->scrollto.x.animator) || (sid->scrollto.y.animator))
921 return; 937 return;
938 if (!_elm_scroll_has_bars(sid)) return;
922 edje_object_part_drag_value_get 939 edje_object_part_drag_value_get
923 (sid->edje_obj, "elm.dragable.vbar", NULL, &vy); 940 (sid->edje_obj, "elm.dragable.vbar", NULL, &vy);
924 edje_object_part_drag_value_get 941 edje_object_part_drag_value_get
@@ -1576,10 +1593,13 @@ _elm_interface_scrollable_content_pos_set(Eo *obj, Elm_Scrollable_Smart_Interfac
1576 else if (vy > 1.0) 1593 else if (vy > 1.0)
1577 vy = 1.0; 1594 vy = 1.0;
1578 1595
1579 edje_object_part_drag_value_set 1596 if (_elm_scroll_has_bars(sid))
1580 (sid->edje_obj, "elm.dragable.vbar", 0.0, vy); 1597 {
1581 edje_object_part_drag_value_set 1598 edje_object_part_drag_value_set
1582 (sid->edje_obj, "elm.dragable.hbar", vx, 0.0); 1599 (sid->edje_obj, "elm.dragable.vbar", 0.0, vy);
1600 edje_object_part_drag_value_set
1601 (sid->edje_obj, "elm.dragable.hbar", vx, 0.0);
1602 }
1583 1603
1584 if (!sid->loop_h && !sid->down.bounce_x_animator) 1604 if (!sid->loop_h && !sid->down.bounce_x_animator)
1585 { 1605 {
@@ -3680,6 +3700,10 @@ _scroll_edje_object_attach(Evas_Object *obj)
3680 3700
3681 edje_object_signal_callback_add 3701 edje_object_signal_callback_add
3682 (sid->edje_obj, "reload", "elm", _elm_scroll_reload_cb, sid); 3702 (sid->edje_obj, "reload", "elm", _elm_scroll_reload_cb, sid);
3703
3704 if (!_elm_scroll_has_bars(sid))
3705 return;
3706
3683 edje_object_signal_callback_add 3707 edje_object_signal_callback_add
3684 (sid->edje_obj, "drag", "elm.dragable.vbar", _elm_scroll_vbar_drag_cb, 3708 (sid->edje_obj, "drag", "elm.dragable.vbar", _elm_scroll_vbar_drag_cb,
3685 sid); 3709 sid);
@@ -3759,6 +3783,9 @@ _scroll_edje_object_detach(Evas_Object *obj)
3759 evas_object_event_callback_del_full 3783 evas_object_event_callback_del_full
3760 (sid->edje_obj, EVAS_CALLBACK_MOVE, _on_edje_move, sid); 3784 (sid->edje_obj, EVAS_CALLBACK_MOVE, _on_edje_move, sid);
3761 3785
3786 if (!_elm_scroll_has_bars(sid))
3787 return;
3788
3762 edje_object_signal_callback_del_full 3789 edje_object_signal_callback_del_full
3763 (sid->edje_obj, "drag", "elm.dragable.vbar", _elm_scroll_vbar_drag_cb, 3790 (sid->edje_obj, "drag", "elm.dragable.vbar", _elm_scroll_vbar_drag_cb,
3764 sid); 3791 sid);
@@ -3879,16 +3906,19 @@ _elm_scroll_scroll_bar_reset(Elm_Scrollable_Smart_Interface_Data *sid)
3879 3906
3880 if (!sid->edje_obj) return; 3907 if (!sid->edje_obj) return;
3881 3908
3882 edje_object_part_drag_value_set 3909 if (_elm_scroll_has_bars(sid))
3883 (sid->edje_obj, "elm.dragable.vbar", 0.0, 0.0);
3884 edje_object_part_drag_value_set
3885 (sid->edje_obj, "elm.dragable.hbar", 0.0, 0.0);
3886 if ((!sid->content) && (!sid->extern_pan))
3887 { 3910 {
3888 edje_object_part_drag_size_set 3911 edje_object_part_drag_value_set
3889 (sid->edje_obj, "elm.dragable.vbar", 1.0, 1.0); 3912 (sid->edje_obj, "elm.dragable.vbar", 0.0, 0.0);
3890 edje_object_part_drag_size_set 3913 edje_object_part_drag_value_set
3891 (sid->edje_obj, "elm.dragable.hbar", 1.0, 1.0); 3914 (sid->edje_obj, "elm.dragable.hbar", 0.0, 0.0);
3915 if ((!sid->content) && (!sid->extern_pan))
3916 {
3917 edje_object_part_drag_size_set
3918 (sid->edje_obj, "elm.dragable.vbar", 1.0, 1.0);
3919 edje_object_part_drag_size_set
3920 (sid->edje_obj, "elm.dragable.hbar", 1.0, 1.0);
3921 }
3892 } 3922 }
3893 if (sid->pan_obj) 3923 if (sid->pan_obj)
3894 { 3924 {