okra pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=ae26e913caca459a0ee01f53548879786ec58d4e

commit ae26e913caca459a0ee01f53548879786ec58d4e
Author: Stephen 'Okra' Houston <[email protected]>
Date:   Tue Jul 11 21:41:05 2017 -0500

    Thermal config: Fix rounding and math issues when switching between units.
---
 src/modules/sysinfo/thermal/thermal_config.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/modules/sysinfo/thermal/thermal_config.c 
b/src/modules/sysinfo/thermal/thermal_config.c
index 737cd8ef4..afd2676e3 100644
--- a/src/modules/sysinfo/thermal/thermal_config.c
+++ b/src/modules/sysinfo/thermal/thermal_config.c
@@ -19,7 +19,7 @@ _update_high_temperature(void *data, Evas_Object *obj 
EINA_UNUSED, void *event_i
 {
    Thermal_Config *tc = data;
    Instance *inst = tc->inst;
-   int value = elm_slider_value_get(tc->high);
+   int value = (int)elm_slider_value_get(tc->high);
 
    inst->cfg->thermal.high = value;
    e_config_save_queue();
@@ -31,7 +31,7 @@ _update_low_temperature(void *data, Evas_Object *obj 
EINA_UNUSED, void *event_in
 {
    Thermal_Config *tc = data;
    Instance *inst = tc->inst;
-   int value = elm_slider_value_get(tc->low);
+   int value = (int)elm_slider_value_get(tc->low);
 
    inst->cfg->thermal.low = value;
    e_config_save_queue();
@@ -61,10 +61,10 @@ _units_changed(void *data, Evas_Object *obj, void 
*event_info EINA_UNUSED)
      {
         elm_slider_min_max_set(tc->low, 0, 200);
         elm_slider_min_max_set(tc->high, 0, 230);
-        val = elm_slider_value_get(tc->low);
-        elm_slider_value_set(tc->low, CEL_2_FAR(val));
-        val = elm_slider_value_get(tc->high);
-        elm_slider_value_set(tc->high, CEL_2_FAR(val));
+        val = (int)elm_slider_value_get(tc->low);
+        elm_slider_value_set(tc->low, ceil(CEL_2_FAR(val)));
+        val = (int)elm_slider_value_get(tc->high);
+        elm_slider_value_set(tc->high, ceil(CEL_2_FAR(val)));
         elm_slider_unit_format_set(tc->high, "%1.0f F");
         elm_slider_indicator_format_set(tc->high, "%1.0f F");
        elm_slider_unit_format_set(tc->low, "%1.0f F");
@@ -72,20 +72,20 @@ _units_changed(void *data, Evas_Object *obj, void 
*event_info EINA_UNUSED)
      }
    else
      {
-        elm_slider_min_max_set(tc->low, 0, 95);
-        elm_slider_min_max_set(tc->high, 0, 110);
-        val = elm_slider_value_get(tc->low);
-        elm_slider_value_set(tc->low, FAR_2_CEL(val));
-        val = elm_slider_value_get(tc->high);
-        elm_slider_value_set(tc->high, FAR_2_CEL(val));
+        val = (int)elm_slider_value_get(tc->low);
+        elm_slider_value_set(tc->low, ceil(FAR_2_CEL(val)));
+        val = (int)elm_slider_value_get(tc->high);
+        elm_slider_value_set(tc->high, ceil(FAR_2_CEL(val)));
         elm_slider_unit_format_set(tc->low, "%1.0f C");
         elm_slider_indicator_format_set(tc->low, "%1.0f C");
        elm_slider_unit_format_set(tc->high, "%1.0f C");
         elm_slider_indicator_format_set(tc->high, "%1.0f C");
+        elm_slider_min_max_set(tc->low, 0, 95);
+        elm_slider_min_max_set(tc->high, 0, 110);
      }
-   val = elm_slider_value_get(tc->high);
+   val = (int)elm_slider_value_get(tc->high);
    inst->cfg->thermal.high = val;
-   val = elm_slider_value_get(tc->low);
+   val = (int)elm_slider_value_get(tc->low);
    inst->cfg->thermal.low = val;
    e_config_save_queue();
    _thermal_config_updated(inst);

-- 


Reply via email to