summaryrefslogtreecommitdiff
path: root/src/lib/elementary/efl_ui_spin_button.c
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-08 16:17:38 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-08 19:56:33 +0200
commit5efb4b374e6052fc401b109d6a98db7fe2ef3222 (patch)
tree180f10703a92e60c08c7963f761669ec762e5996 /src/lib/elementary/efl_ui_spin_button.c
parent1e73201169473a92c26c233377b9e5747b3e0776 (diff)
efl_ui_*: get range users onto the same semantics
this commits introduces unified behaviour for the users of the range interfaces. This includes: - The same errors for limit_set errors - The same errors for value setting outside the range Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D9241
Diffstat (limited to 'src/lib/elementary/efl_ui_spin_button.c')
-rw-r--r--src/lib/elementary/efl_ui_spin_button.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/elementary/efl_ui_spin_button.c b/src/lib/elementary/efl_ui_spin_button.c
index c356686..a975df1 100644
--- a/src/lib/elementary/efl_ui_spin_button.c
+++ b/src/lib/elementary/efl_ui_spin_button.c
@@ -168,7 +168,7 @@ static void
168_entry_value_apply(Evas_Object *obj) 168_entry_value_apply(Evas_Object *obj)
169{ 169{
170 const char *str; 170 const char *str;
171 double val; 171 double val, val_min, val_max;
172 char *end; 172 char *end;
173 173
174 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(obj, MY_CLASS); 174 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(obj, MY_CLASS);
@@ -184,6 +184,8 @@ _entry_value_apply(Evas_Object *obj)
184 184
185 val = strtod(str, &end); 185 val = strtod(str, &end);
186 if (((*end != '\0') && (!isspace(*end))) || (fabs(val - pd->val) < DBL_EPSILON)) return; 186 if (((*end != '\0') && (!isspace(*end))) || (fabs(val - pd->val) < DBL_EPSILON)) return;
187 efl_ui_range_limits_get(obj, &val_min, &val_max);
188 val = MIN(val_max, MAX(val_min, val));
187 efl_ui_range_value_set(obj, val); 189 efl_ui_range_value_set(obj, val);
188 190
189 efl_event_callback_call(obj, EFL_UI_SPIN_EVENT_CHANGED, NULL); 191 efl_event_callback_call(obj, EFL_UI_SPIN_EVENT_CHANGED, NULL);
@@ -406,7 +408,9 @@ _spin_value(void *data)
406 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(data, MY_CLASS); 408 Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(data, MY_CLASS);
407 Efl_Ui_Spin_Data *pd = efl_data_scope_get(data, EFL_UI_SPIN_CLASS); 409 Efl_Ui_Spin_Data *pd = efl_data_scope_get(data, EFL_UI_SPIN_CLASS);
408 410
409 if (_value_set(data, pd->val + (sd->inc_val ? pd->step : -pd->step))) 411 int absolut_value = pd->val + (sd->inc_val ? pd->step : -pd->step);
412
413 if (_value_set(data, MIN(MAX(absolut_value, pd->val_min), pd->val_max)))
410 _label_write(data); 414 _label_write(data);
411 415
412 return ECORE_CALLBACK_RENEW; 416 return ECORE_CALLBACK_RENEW;