From 81db2b7921524934bce27aac3b384daf885c8464 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Sat, 28 Jul 2012 13:29:50 +0000 Subject: [PATCH] elementary: round up the spinning speed when the step is too small with a warning message. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Patch by Jean-Philippe André SVN revision: 74528 --- AUTHORS | 1 + src/lib/elm_spinner.c | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 1ea7e24..08ba166 100644 --- a/AUTHORS +++ b/AUTHORS @@ -61,3 +61,4 @@ Michal Pakula vel Rutka Thiep Ha Artem Popov Minseok Kim +Jean-Philippe André \ No newline at end of file diff --git a/src/lib/elm_spinner.c b/src/lib/elm_spinner.c index 3c276ab..7abbce3 100644 --- a/src/lib/elm_spinner.c +++ b/src/lib/elm_spinner.c @@ -325,8 +325,16 @@ static Eina_Bool _spin_value(void *data) { ELM_SPINNER_DATA_GET(data, sd); + double real_speed = sd->spin_speed; - if (_value_set(data, sd->val + sd->spin_speed)) _label_write(data); + /* Sanity check: our step size should be at least as large as our rounding value */ + if ((sd->spin_speed != 0.0) && (abs(sd->spin_speed) < sd->round)) + { + WRN("The spinning step is smaller than the rounding value, please check your code"); + real_speed = sd->spin_speed > 0 ? sd->round : -sd->round; + } + + if (_value_set(data, sd->val + real_speed)) _label_write(data); sd->interval = sd->interval / 1.05; ecore_timer_interval_set(sd->spin, sd->interval); -- 2.7.4