From 4f26da0bd4666354b3374bd00d53c439d29b3fa6 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 29 May 2019 09:22:25 -0400 Subject: [PATCH] elm/slider: check for interval/range state before using that functionality Summary: the part elm.dragable2.slider only exists when the slider is set to range mode, so verify that this mode is active before attempting to use that part @fix Depends on D8968 Reviewers: cedric Reviewed By: cedric Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8969 --- src/lib/elementary/elm_slider.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/lib/elementary/elm_slider.c b/src/lib/elementary/elm_slider.c index 483b68c..626f5a6 100644 --- a/src/lib/elementary/elm_slider.c +++ b/src/lib/elementary/elm_slider.c @@ -586,15 +586,18 @@ _elm_slider_val_fetch(Evas_Object *obj, Elm_Slider_Data *pd, Eina_Bool user_even if (efl_ui_layout_orientation_is_horizontal(sd->dir, EINA_TRUE)) pos = posx; else pos = posy; - //TIZEN_ONLY(20190102): added check for existence of parts - //efl_ui_drag_value_get(efl_part(wd->resize_obj, "elm.dragable2.slider"), - // &posx2, &posy2); - if (edje_object_part_exists(elm_layout_edje_get(obj), "elm.dragable2.slider")) - efl_ui_drag_value_get(efl_part(wd->resize_obj, "elm.dragable2.slider"), - &posx2, &posy2); - // - if (efl_ui_layout_orientation_is_horizontal(sd->dir, EINA_TRUE)) pos2 = posx2; - else pos2 = posy2; + if (pd->intvl_enable) + { + //TIZEN_ONLY(20190102): added check for existence of parts + //efl_ui_drag_value_get(efl_part(wd->resize_obj, "elm.dragable2.slider"), + // &posx2, &posy2); + if (edje_object_part_exists(elm_layout_edje_get(obj), "elm.dragable2.slider")) + efl_ui_drag_value_get(efl_part(wd->resize_obj, "elm.dragable2.slider"), + &posx2, &posy2); + // + if (efl_ui_layout_orientation_is_horizontal(sd->dir, EINA_TRUE)) pos2 = posx2; + else pos2 = posy2; + } if (efl_ui_mirrored_get(obj) ^ efl_ui_layout_orientation_is_inverted(sd->dir)) { @@ -604,10 +607,10 @@ _elm_slider_val_fetch(Evas_Object *obj, Elm_Slider_Data *pd, Eina_Bool user_even } val = (pos * (sd->val_max - sd->val_min)) + sd->val_min; - val2 = (pos2 * (sd->val_max - sd->val_min)) + sd->val_min; if (pd->intvl_enable) { + val2 = (pos2 * (sd->val_max - sd->val_min)) + sd->val_min; if (!inverted) { if (val > id->intvl_to) @@ -648,7 +651,7 @@ _elm_slider_val_fetch(Evas_Object *obj, Elm_Slider_Data *pd, Eina_Bool user_even } } - if (fabs(val2 - id->intvl_to) > DBL_EPSILON) + if (pd->intvl_enable && fabs(val2 - id->intvl_to) > DBL_EPSILON) { id->intvl_to = val2; /* avoid emitting two events and setting a timer twice */ @@ -662,7 +665,7 @@ _elm_slider_val_fetch(Evas_Object *obj, Elm_Slider_Data *pd, Eina_Bool user_even } void -_elm_slider_val_set(Evas_Object *obj, Elm_Slider_Data *pd EINA_UNUSED) +_elm_slider_val_set(Evas_Object *obj, Elm_Slider_Data *pd) { double pos, pos2; @@ -701,8 +704,9 @@ _elm_slider_val_set(Evas_Object *obj, Elm_Slider_Data *pd EINA_UNUSED) //efl_ui_drag_value_set(efl_part(wd->resize_obj, "elm.dragable2.slider"), // pos2, pos2); if (edje_object_part_exists(elm_layout_edje_get(obj), "elm.dragable2.slider")) - efl_ui_drag_value_set(efl_part(wd->resize_obj, "elm.dragable2.slider"), - pos2, pos2); + if (pd->intvl_enable) + efl_ui_drag_value_set(efl_part(wd->resize_obj, "elm.dragable2.slider"), + pos2, pos2); // // emit accessibility event also if value was changed by API -- 2.7.4