summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2018-06-21 18:51:43 -0400
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2018-06-25 11:30:52 +0200
commit6f6b365c8431a88b178772cd735659e680f9aa02 (patch)
treeba793b98c46fe50328ff96f3fddac911f52d1364
parent679ea2d31144169b910631c33e156505448d27dc (diff)
elm_scroll: Avoid calls to non-existing part
In case of Bryce's style, there are no scroll bars. this avoids errors for non-existent objects ref T7030 Signed-off-by: Mike Blumenkrantz <zmike@samsung.com> Differential Revision: https://phab.enlightenment.org/D6317
-rw-r--r--src/lib/elementary/elm_interface_scrollable.c75
1 files changed, 58 insertions, 17 deletions
diff --git a/src/lib/elementary/elm_interface_scrollable.c b/src/lib/elementary/elm_interface_scrollable.c
index b7ffad275c..dfdfefc122 100644
--- a/src/lib/elementary/elm_interface_scrollable.c
+++ b/src/lib/elementary/elm_interface_scrollable.c
@@ -788,6 +788,25 @@ _elm_scroll_scroll_bar_visibility_adjust(
788 _elm_scroll_scroll_bar_auto_visibility_adjust(sid); 788 _elm_scroll_scroll_bar_auto_visibility_adjust(sid);
789} 789}
790 790
791static inline EINA_PURE Eina_Bool
792_elm_scroll_has_bars(const Elm_Scrollable_Smart_Interface_Data *sid)
793{
794 const char *iface_scr_dragable_hbar = NULL;
795 const char *iface_scr_dragable_vbar = NULL;
796 if (elm_widget_is_legacy(sid->obj))
797 {
798 iface_scr_dragable_hbar = iface_scr_legacy_dragable_hbar;
799 iface_scr_dragable_vbar = iface_scr_legacy_dragable_vbar;
800 }
801 else
802 {
803 iface_scr_dragable_hbar = iface_scr_efl_ui_dragable_hbar;
804 iface_scr_dragable_vbar = iface_scr_efl_ui_dragable_vbar;
805 }
806 return edje_object_part_exists(sid->edje_obj, iface_scr_dragable_hbar) ||
807 edje_object_part_exists(sid->edje_obj, iface_scr_dragable_vbar);
808}
809
791static void 810static void
792_elm_scroll_scroll_bar_size_adjust(Elm_Scrollable_Smart_Interface_Data *sid) 811_elm_scroll_scroll_bar_size_adjust(Elm_Scrollable_Smart_Interface_Data *sid)
793{ 812{
@@ -832,6 +851,10 @@ _elm_scroll_scroll_bar_size_adjust(Elm_Scrollable_Smart_Interface_Data *sid)
832 edje_object_part_geometry_get 851 edje_object_part_geometry_get
833 (sid->edje_obj, "efl.content", NULL, NULL, &vw, &vh); 852 (sid->edje_obj, "efl.content", NULL, NULL, &vw, &vh);
834 } 853 }
854
855 if (!_elm_scroll_has_bars(sid))
856 goto skip_bars;
857
835 w = sid->content_info.w; 858 w = sid->content_info.w;
836 if (w < 1) w = 1; 859 if (w < 1) w = 1;
837 size = (double)vw / (double)w; 860 size = (double)vw / (double)w;
@@ -918,16 +941,21 @@ _elm_scroll_scroll_bar_size_adjust(Elm_Scrollable_Smart_Interface_Data *sid)
918 { 941 {
919 Evas_Coord px = 0, py = 0, minx = 0, miny = 0; 942 Evas_Coord px = 0, py = 0, minx = 0, miny = 0;
920 943
921 edje_object_part_drag_size_set 944 if (_elm_scroll_has_bars(sid))
922 (sid->edje_obj, iface_scr_dragable_vbar, 1.0, 1.0); 945 {
923 edje_object_part_drag_size_set 946 edje_object_part_drag_size_set
924 (sid->edje_obj, iface_scr_dragable_hbar, 1.0, 1.0); 947 (sid->edje_obj, iface_scr_dragable_vbar, 1.0, 1.0);
948 edje_object_part_drag_size_set
949 (sid->edje_obj, iface_scr_dragable_hbar, 1.0, 1.0);
950 }
925 elm_obj_pan_pos_min_get(sid->pan_obj, &minx, &miny); 951 elm_obj_pan_pos_min_get(sid->pan_obj, &minx, &miny);
926 elm_obj_pan_pos_get(sid->pan_obj, &px, &py); 952 elm_obj_pan_pos_get(sid->pan_obj, &px, &py);
927 elm_obj_pan_pos_set(sid->pan_obj, minx, miny); 953 elm_obj_pan_pos_set(sid->pan_obj, minx, miny);
928 if ((px != minx) || (py != miny)) 954 if ((px != minx) || (py != miny))
929 edje_object_signal_emit(sid->edje_obj, "elm,action,scroll", "elm"); 955 edje_object_signal_emit(sid->edje_obj, "elm,action,scroll", "elm");
930 } 956 }
957
958skip_bars:
931 _elm_scroll_scroll_bar_visibility_adjust(sid); 959 _elm_scroll_scroll_bar_visibility_adjust(sid);
932 sid->size_adjust_recurse--; 960 sid->size_adjust_recurse--;
933 if (sid->size_adjust_recurse <= 0) 961 if (sid->size_adjust_recurse <= 0)
@@ -950,6 +978,7 @@ _elm_scroll_scroll_bar_read_and_update(
950 || (sid->down.bounce_y_animator) || (sid->down.momentum_animator) 978 || (sid->down.bounce_y_animator) || (sid->down.momentum_animator)
951 || (sid->scrollto.x.animator) || (sid->scrollto.y.animator)) 979 || (sid->scrollto.x.animator) || (sid->scrollto.y.animator))
952 return; 980 return;
981 if (!_elm_scroll_has_bars(sid)) return;
953 982
954 const char *iface_scr_dragable_hbar = NULL; 983 const char *iface_scr_dragable_hbar = NULL;
955 const char *iface_scr_dragable_vbar = NULL; 984 const char *iface_scr_dragable_vbar = NULL;
@@ -1634,10 +1663,13 @@ _elm_interface_scrollable_content_pos_set(Eo *obj, Elm_Scrollable_Smart_Interfac
1634 iface_scr_dragable_vbar = iface_scr_efl_ui_dragable_vbar; 1663 iface_scr_dragable_vbar = iface_scr_efl_ui_dragable_vbar;
1635 } 1664 }
1636 1665
1637 edje_object_part_drag_value_set 1666 if (_elm_scroll_has_bars(sid))
1638 (sid->edje_obj, iface_scr_dragable_vbar, 0.0, vy); 1667 {
1639 edje_object_part_drag_value_set 1668 edje_object_part_drag_value_set
1640 (sid->edje_obj, iface_scr_dragable_hbar, vx, 0.0); 1669 (sid->edje_obj, iface_scr_dragable_vbar, 0.0, vy);
1670 edje_object_part_drag_value_set
1671 (sid->edje_obj, iface_scr_dragable_hbar, vx, 0.0);
1672 }
1641 1673
1642 if (!sid->loop_h && !sid->down.bounce_x_animator) 1674 if (!sid->loop_h && !sid->down.bounce_x_animator)
1643 { 1675 {
@@ -3739,6 +3771,9 @@ _scroll_edje_object_attach(Evas_Object *obj)
3739 edje_object_signal_callback_add 3771 edje_object_signal_callback_add
3740 (sid->edje_obj, "reload", "elm", _elm_scroll_reload_cb, sid); 3772 (sid->edje_obj, "reload", "elm", _elm_scroll_reload_cb, sid);
3741 3773
3774 if (!_elm_scroll_has_bars(sid))
3775 return;
3776
3742 const char *iface_scr_dragable_vbar = NULL; 3777 const char *iface_scr_dragable_vbar = NULL;
3743 if (elm_widget_is_legacy(sid->obj)) 3778 if (elm_widget_is_legacy(sid->obj))
3744 iface_scr_dragable_vbar = iface_scr_legacy_dragable_vbar; 3779 iface_scr_dragable_vbar = iface_scr_legacy_dragable_vbar;
@@ -3831,6 +3866,9 @@ _scroll_edje_object_detach(Evas_Object *obj)
3831 evas_object_event_callback_del_full 3866 evas_object_event_callback_del_full
3832 (sid->edje_obj, EVAS_CALLBACK_MOVE, _on_edje_move, sid); 3867 (sid->edje_obj, EVAS_CALLBACK_MOVE, _on_edje_move, sid);
3833 3868
3869 if (!_elm_scroll_has_bars(sid))
3870 return;
3871
3834 const char *iface_scr_dragable_vbar = NULL; 3872 const char *iface_scr_dragable_vbar = NULL;
3835 if (elm_widget_is_legacy(sid->obj)) 3873 if (elm_widget_is_legacy(sid->obj))
3836 iface_scr_dragable_vbar = iface_scr_legacy_dragable_vbar; 3874 iface_scr_dragable_vbar = iface_scr_legacy_dragable_vbar;
@@ -4001,16 +4039,19 @@ _elm_scroll_scroll_bar_reset(Elm_Scrollable_Smart_Interface_Data *sid)
4001 iface_scr_dragable_vbar = iface_scr_efl_ui_dragable_vbar; 4039 iface_scr_dragable_vbar = iface_scr_efl_ui_dragable_vbar;
4002 } 4040 }
4003 4041
4004 edje_object_part_drag_value_set 4042 if (_elm_scroll_has_bars(sid))
4005 (sid->edje_obj, iface_scr_dragable_vbar, 0.0, 0.0);
4006 edje_object_part_drag_value_set
4007 (sid->edje_obj, iface_scr_dragable_hbar, 0.0, 0.0);
4008 if ((!sid->content) && (!sid->extern_pan))
4009 { 4043 {
4010 edje_object_part_drag_size_set 4044 edje_object_part_drag_value_set
4011 (sid->edje_obj, iface_scr_dragable_vbar, 1.0, 1.0); 4045 (sid->edje_obj, iface_scr_dragable_vbar, 0.0, 0.0);
4012 edje_object_part_drag_size_set 4046 edje_object_part_drag_value_set
4013 (sid->edje_obj, iface_scr_dragable_hbar, 1.0, 1.0); 4047 (sid->edje_obj, iface_scr_dragable_hbar, 0.0, 0.0);
4048 if ((!sid->content) && (!sid->extern_pan))
4049 {
4050 edje_object_part_drag_size_set
4051 (sid->edje_obj, iface_scr_dragable_vbar, 1.0, 1.0);
4052 edje_object_part_drag_size_set
4053 (sid->edje_obj, iface_scr_dragable_hbar, 1.0, 1.0);
4054 }
4014 } 4055 }
4015 if (sid->pan_obj) 4056 if (sid->pan_obj)
4016 { 4057 {