summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-05-29 09:22:25 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-05-29 12:29:03 -0400
commit695dfb650aa997fd0789e680dd4197867621aee2 (patch)
treea6fa6c9aad2e558b3d647686a1b61f157db0f6d2
parent1051a1ca46891206fa68ede6160aefe87c666183 (diff)
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
-rw-r--r--src/lib/elementary/elm_slider.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/lib/elementary/elm_slider.c b/src/lib/elementary/elm_slider.c
index 66e5ce8491..fe148057c4 100644
--- a/src/lib/elementary/elm_slider.c
+++ b/src/lib/elementary/elm_slider.c
@@ -549,10 +549,13 @@ _elm_slider_val_fetch(Evas_Object *obj, Elm_Slider_Data *pd, Eina_Bool user_even
549 if (efl_ui_layout_orientation_is_horizontal(sd->dir, EINA_TRUE)) pos = posx; 549 if (efl_ui_layout_orientation_is_horizontal(sd->dir, EINA_TRUE)) pos = posx;
550 else pos = posy; 550 else pos = posy;
551 551
552 efl_ui_drag_value_get(efl_part(wd->resize_obj, "elm.dragable2.slider"), 552 if (pd->intvl_enable)
553 &posx2, &posy2); 553 {
554 if (efl_ui_layout_orientation_is_horizontal(sd->dir, EINA_TRUE)) pos2 = posx2; 554 efl_ui_drag_value_get(efl_part(wd->resize_obj, "elm.dragable2.slider"),
555 else pos2 = posy2; 555 &posx2, &posy2);
556 if (efl_ui_layout_orientation_is_horizontal(sd->dir, EINA_TRUE)) pos2 = posx2;
557 else pos2 = posy2;
558 }
556 559
557 if (efl_ui_mirrored_get(obj) ^ efl_ui_layout_orientation_is_inverted(sd->dir)) 560 if (efl_ui_mirrored_get(obj) ^ efl_ui_layout_orientation_is_inverted(sd->dir))
558 { 561 {
@@ -562,10 +565,10 @@ _elm_slider_val_fetch(Evas_Object *obj, Elm_Slider_Data *pd, Eina_Bool user_even
562 } 565 }
563 566
564 val = (pos * (sd->val_max - sd->val_min)) + sd->val_min; 567 val = (pos * (sd->val_max - sd->val_min)) + sd->val_min;
565 val2 = (pos2 * (sd->val_max - sd->val_min)) + sd->val_min;
566 568
567 if (pd->intvl_enable) 569 if (pd->intvl_enable)
568 { 570 {
571 val2 = (pos2 * (sd->val_max - sd->val_min)) + sd->val_min;
569 if (!inverted) 572 if (!inverted)
570 { 573 {
571 if (val > id->intvl_to) 574 if (val > id->intvl_to)
@@ -606,7 +609,7 @@ _elm_slider_val_fetch(Evas_Object *obj, Elm_Slider_Data *pd, Eina_Bool user_even
606 } 609 }
607 } 610 }
608 611
609 if (fabs(val2 - id->intvl_to) > DBL_EPSILON) 612 if (pd->intvl_enable && fabs(val2 - id->intvl_to) > DBL_EPSILON)
610 { 613 {
611 id->intvl_to = val2; 614 id->intvl_to = val2;
612 /* avoid emitting two events and setting a timer twice */ 615 /* avoid emitting two events and setting a timer twice */
@@ -620,7 +623,7 @@ _elm_slider_val_fetch(Evas_Object *obj, Elm_Slider_Data *pd, Eina_Bool user_even
620} 623}
621 624
622void 625void
623_elm_slider_val_set(Evas_Object *obj, Elm_Slider_Data *pd EINA_UNUSED) 626_elm_slider_val_set(Evas_Object *obj, Elm_Slider_Data *pd)
624{ 627{
625 double pos, pos2; 628 double pos, pos2;
626 629
@@ -655,8 +658,9 @@ _elm_slider_val_set(Evas_Object *obj, Elm_Slider_Data *pd EINA_UNUSED)
655 658
656 efl_ui_drag_value_set(efl_part(wd->resize_obj, "elm.dragable.slider"), 659 efl_ui_drag_value_set(efl_part(wd->resize_obj, "elm.dragable.slider"),
657 pos, pos); 660 pos, pos);
658 efl_ui_drag_value_set(efl_part(wd->resize_obj, "elm.dragable2.slider"), 661 if (pd->intvl_enable)
659 pos2, pos2); 662 efl_ui_drag_value_set(efl_part(wd->resize_obj, "elm.dragable2.slider"),
663 pos2, pos2);
660 664
661 // emit accessibility event also if value was changed by API 665 // emit accessibility event also if value was changed by API
662 if (_elm_config->atspi_mode) 666 if (_elm_config->atspi_mode)