From 5a5168f5c0aad240ff727cf7db33db082e26e8c6 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 29 May 2019 09:18:31 -0400 Subject: [PATCH] elm/slider: avoid emitting double events when range slider value changes Summary: in range mode, there are two slider endpoints, but only one event should be emitted if a change is detected during update @fix Depends on D8967 Reviewers: devilhorns Reviewed By: devilhorns Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8968 --- src/lib/elementary/elm_slider.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/elementary/elm_slider.c b/src/lib/elementary/elm_slider.c index 08de88f..483b68c 100644 --- a/src/lib/elementary/elm_slider.c +++ b/src/lib/elementary/elm_slider.c @@ -575,6 +575,7 @@ _elm_slider_val_fetch(Evas_Object *obj, Elm_Slider_Data *pd, Eina_Bool user_even double posx = 0.0, posy = 0.0, pos = 0.0, val; double posx2 = 0.0, posy2 = 0.0, pos2 = 0.0, val2; Eina_Bool inverted = EINA_FALSE; + Eina_Bool evented = EINA_FALSE; EFL_UI_SLIDER_DATA_GET(obj, sd); EFL_UI_SLIDER_INTERVAL_DATA_GET(obj, id); @@ -643,13 +644,15 @@ _elm_slider_val_fetch(Evas_Object *obj, Elm_Slider_Data *pd, Eina_Bool user_even efl_event_callback_legacy_call(obj, EFL_UI_SLIDER_EVENT_CHANGED, NULL); ecore_timer_del(pd->delay); pd->delay = ecore_timer_add(SLIDER_DELAY_CHANGED_INTERVAL, _delay_change, obj); + evented = EINA_TRUE; } } if (fabs(val2 - id->intvl_to) > DBL_EPSILON) { id->intvl_to = val2; - if (user_event) + /* avoid emitting two events and setting a timer twice */ + if (user_event && (!evented)) { efl_event_callback_legacy_call(obj, EFL_UI_SLIDER_EVENT_CHANGED, NULL); ecore_timer_del(pd->delay); -- 2.7.4