summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS1
-rw-r--r--src/lib/elm_authors.h1
-rw-r--r--src/lib/elm_spinner.c46
-rw-r--r--src/lib/elm_widget_spinner.h2
4 files changed, 38 insertions, 12 deletions
diff --git a/AUTHORS b/AUTHORS
index 59f64e3c3..c19025f1b 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -88,3 +88,4 @@ Sanghyeon Lee <sh10233.lee@samsung.com>
Anil Kumar Nahak <ak.nahak@samsung.com>
Michal Jagiello <m.jagiello@samsung.com>
Chinmaya Panigrahi <c.panigrahi@samsung.com>
+Mohammad Irfan <mohammad.i@samsung.com>
diff --git a/src/lib/elm_authors.h b/src/lib/elm_authors.h
index 7e9f0e564..5f4ce508c 100644
--- a/src/lib/elm_authors.h
+++ b/src/lib/elm_authors.h
@@ -90,6 +90,7 @@
* @author Anil Kumar Nahak <ak.nahak@@samsung.com>
* @author Michal Jagiello <m.jagiello@@samsung.com>
* @author Chinmaya Panigrahi <c.panigrahi@@samsung.com>
+ * @author Mohammad Irfan <mohammad.i@@samsung.com>
*
* Please contact <enlightenment-devel@lists.sourceforge.net> to get in
* contact with the developers and maintainers.
diff --git a/src/lib/elm_spinner.c b/src/lib/elm_spinner.c
index 9c059b6dc..ffeb975dd 100644
--- a/src/lib/elm_spinner.c
+++ b/src/lib/elm_spinner.c
@@ -323,16 +323,18 @@ _spin_value(void *data)
return ECORE_CALLBACK_RENEW;
}
-static void
-_val_inc_start(Evas_Object *obj)
+static Eina_Bool
+_val_inc_start(void *data)
{
- ELM_SPINNER_DATA_GET(obj, sd);
+ ELM_SPINNER_DATA_GET(data, sd);
sd->interval = sd->first_interval;
sd->spin_speed = sd->step;
+ sd->longpress_timer = NULL;
ecore_timer_del(sd->spin_timer);
- sd->spin_timer = ecore_timer_add(sd->interval, _spin_value, obj);
- _spin_value(obj);
+ sd->spin_timer = ecore_timer_add(sd->interval, _spin_value, data);
+ _spin_value(data);
+ return ECORE_CALLBACK_CANCEL;
}
static void
@@ -345,16 +347,18 @@ _val_inc_stop(Evas_Object *obj)
ELM_SAFE_FREE(sd->spin_timer, ecore_timer_del);
}
-static void
-_val_dec_start(Evas_Object *obj)
+static Eina_Bool
+_val_dec_start(void *data)
{
- ELM_SPINNER_DATA_GET(obj, sd);
+ ELM_SPINNER_DATA_GET(data, sd);
sd->interval = sd->first_interval;
sd->spin_speed = -sd->step;
+ sd->longpress_timer = NULL;
ecore_timer_del(sd->spin_timer);
- sd->spin_timer = ecore_timer_add(sd->interval, _spin_value, obj);
- _spin_value(obj);
+ sd->spin_timer = ecore_timer_add(sd->interval, _spin_value, data);
+ _spin_value(data);
+ return ECORE_CALLBACK_CANCEL;
}
static void
@@ -381,7 +385,9 @@ _button_inc_start_cb(void *data,
if ((sd->val_updated) && (sd->val == sd->val_min)) return;
return;
}
- _val_inc_start(data);
+ ecore_timer_del(sd->longpress_timer);
+ sd->longpress_timer = ecore_timer_add
+ (_elm_config->longpress_timeout, _val_inc_start, data);
}
static void
@@ -390,6 +396,13 @@ _button_inc_stop_cb(void *data,
const char *emission EINA_UNUSED,
const char *source EINA_UNUSED)
{
+ ELM_SPINNER_DATA_GET(data, sd);
+ if (sd->longpress_timer)
+ {
+ ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del);
+ sd->spin_speed = sd->step;
+ _spin_value(data);
+ }
_val_inc_stop(data);
}
@@ -406,7 +419,9 @@ _button_dec_start_cb(void *data,
_entry_value_apply(obj);
if ((sd->val_updated) && (sd->val == sd->val_max)) return;
}
- _val_dec_start(data);
+ ecore_timer_del(sd->longpress_timer);
+ sd->longpress_timer = ecore_timer_add
+ (_elm_config->longpress_timeout, _val_dec_start, data);
}
static void
@@ -415,6 +430,13 @@ _button_dec_stop_cb(void *data,
const char *emission EINA_UNUSED,
const char *source EINA_UNUSED)
{
+ ELM_SPINNER_DATA_GET(data, sd);
+ if (sd->longpress_timer)
+ {
+ ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del);
+ sd->spin_speed = -sd->step;
+ _spin_value(data);
+ }
_val_dec_stop(data);
}
diff --git a/src/lib/elm_widget_spinner.h b/src/lib/elm_widget_spinner.h
index b4225c2a9..0e9c30880 100644
--- a/src/lib/elm_widget_spinner.h
+++ b/src/lib/elm_widget_spinner.h
@@ -32,6 +32,8 @@ struct _Elm_Spinner_Smart_Data
int round;
Ecore_Timer *delay_change_timer; /*<< a timer for a delay,changed smart callback */
Ecore_Timer *spin_timer; /*<< a timer for a repeated spinner value change on mouse down */
+ Ecore_Timer *longpress_timer; /*<< a timer to detect long press. After lonpress timeout,
+ start continuous change of values until mouse up */
Eina_List *special_values;
Eina_Bool entry_visible : 1;