This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository efl.
View the commit online.
commit 99f9bec409e30edaf5059f749eb182d9f71fe6d7
Author: Cedric BAIL <[email protected]>
AuthorDate: Sun Nov 15 12:59:55 2026 -0600
elementary: Slider_Interval stores its pair ordered and in its limits
The interval_value setter stored the pair in the order given and only
the getter put them in order, so (60, 20) drew the thumbs swapped, made
range_value read 60 while interval_value's from was 20, and the next
drag recomputed the pair from the swapped thumbs. It clamped from to the
minimum and to to the maximum but not the other way round, so a pair
above the maximum read back with to past it. The setter now orders the
pair, clamps both ends and emits the range events as range_value does.
range_limits likewise left the pair outside new limits, so a slider
limited to 10..80 kept (0, 0). It now pulls both ends inside.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
src/lib/elementary/efl_ui_slider_interval.c | 21 +++++++-------
src/tests/elementary/efl_ui_test_slider.c | 45 +++++++++++++++++++++++++++++
2 files changed, 56 insertions(+), 10 deletions(-)
diff --git a/src/lib/elementary/efl_ui_slider_interval.c b/src/lib/elementary/efl_ui_slider_interval.c
index 9d43b2f3e7..093e3294d1 100644
--- a/src/lib/elementary/efl_ui_slider_interval.c
+++ b/src/lib/elementary/efl_ui_slider_interval.c
@@ -231,16 +231,16 @@ EOLIAN static void
_efl_ui_slider_interval_interval_value_set(Eo *obj, Efl_Ui_Slider_Interval_Data *pd, double from, double to)
{
EFL_UI_SLIDER_INTERVAL_DATA_GET(obj, sd);
- pd->intvl_from = from;
- sd->val = from;
- pd->intvl_to = to;
- if (pd->intvl_from < sd->val_min) {
- pd->intvl_from = sd->val_min;
- sd->val = sd->val_min;
- }
- if (pd->intvl_to > sd->val_max) pd->intvl_to = sd->val_max;
+ /* The thumbs are drawn from these and range_value is the first of them. */
+ pd->intvl_from = fmin(from, to);
+ pd->intvl_to = fmax(from, to);
+ pd->intvl_from = fmin(fmax(pd->intvl_from, sd->val_min), sd->val_max);
+ pd->intvl_to = fmin(fmax(pd->intvl_to, sd->val_min), sd->val_max);
+ sd->val = pd->intvl_from;
+
+ _emit_events(obj, pd);
_val_set(obj);
}
@@ -795,8 +795,9 @@ _efl_ui_slider_interval_efl_ui_range_display_range_limits_set(Eo *obj, Efl_Ui_Sl
if ((EINA_DBL_EQ(sd->val_min, min)) && (EINA_DBL_EQ(sd->val_max, max))) return;
sd->val_min = min;
sd->val_max = max;
- if (sd->val < sd->val_min) sd->val = sd->val_min;
- if (sd->val > sd->val_max) sd->val = sd->val_max;
+ sd->intvl_from = fmin(fmax(sd->intvl_from, min), max);
+ sd->intvl_to = fmin(fmax(sd->intvl_to, min), max);
+ sd->val = sd->intvl_from;
_val_set(obj);
}
diff --git a/src/tests/elementary/efl_ui_test_slider.c b/src/tests/elementary/efl_ui_test_slider.c
index a235e4ff0c..1015c3e3c9 100644
--- a/src/tests/elementary/efl_ui_test_slider.c
+++ b/src/tests/elementary/efl_ui_test_slider.c
@@ -133,9 +133,54 @@ EFL_START_TEST(efl_ui_test_slider_step_drag)
}
EFL_END_TEST
+/* The pair is stored ordered and within the limits, and range_value is the
+ * first of the two. */
+EFL_START_TEST(efl_ui_test_slider_interval_pair)
+{
+ Eo *win = win_add(NULL, "win", EFL_UI_WIN_TYPE_BASIC);
+ Eo *slider;
+ double from, to;
+
+ slider = efl_add(EFL_UI_SLIDER_INTERVAL_CLASS, win,
+ efl_ui_range_limits_set(efl_added, 0.0, 80.0));
+
+ /* given in the wrong order */
+ efl_ui_slider_interval_value_set(slider, 60.0, 20.0);
+ efl_ui_slider_interval_value_get(slider, &from, &to);
+ ck_assert(EINA_DBL_EQ(from, 20.0));
+ ck_assert(EINA_DBL_EQ(to, 60.0));
+ ck_assert(EINA_DBL_EQ(efl_ui_range_value_get(slider), 20.0));
+
+ /* outside the limits, both ends */
+ efl_ui_range_limits_set(slider, 10.0, 80.0);
+ efl_ui_slider_interval_value_set(slider, 95.0, 5.0);
+ efl_ui_slider_interval_value_get(slider, &from, &to);
+ ck_assert(EINA_DBL_EQ(from, 10.0));
+ ck_assert(EINA_DBL_EQ(to, 80.0));
+ ck_assert(EINA_DBL_EQ(efl_ui_range_value_get(slider), 10.0));
+}
+EFL_END_TEST
+
+/* Limits that leave out the pair pull it inside. */
+EFL_START_TEST(efl_ui_test_slider_interval_limits)
+{
+ Eo *win = win_add(NULL, "win", EFL_UI_WIN_TYPE_BASIC);
+ Eo *slider;
+ double from, to;
+
+ slider = efl_add(EFL_UI_SLIDER_INTERVAL_CLASS, win);
+ efl_ui_range_limits_set(slider, 10.0, 80.0);
+ efl_ui_slider_interval_value_get(slider, &from, &to);
+ ck_assert(EINA_DBL_EQ(from, 10.0));
+ ck_assert(EINA_DBL_EQ(to, 10.0));
+}
+EFL_END_TEST
+
void efl_ui_test_slider(TCase *tc)
{
tcase_add_test(tc, efl_ui_test_slider_events);
tcase_add_test(tc, efl_ui_test_slider_step);
tcase_add_test(tc, efl_ui_test_slider_step_drag);
+ tcase_add_test(tc, efl_ui_test_slider_interval_pair);
+ tcase_add_test(tc, efl_ui_test_slider_interval_limits);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.