From 200f58fe98fb055ee74754d4af6a06a3098626fe Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Mon, 22 Jul 2019 13:09:03 +0200 Subject: [PATCH] efl_ui_*: add the new events to the widgets previous commit introduced new events to range_display. This commit ensures correct emittation of those events. ref T7895 Differential Revision: https://phab.enlightenment.org/D9372 --- src/lib/elementary/efl_ui_progressbar.c | 13 +++++++++++-- src/lib/elementary/efl_ui_slider.c | 13 ++++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/lib/elementary/efl_ui_progressbar.c b/src/lib/elementary/efl_ui_progressbar.c index a924e66..4e16431 100644 --- a/src/lib/elementary/efl_ui_progressbar.c +++ b/src/lib/elementary/efl_ui_progressbar.c @@ -570,8 +570,17 @@ _progressbar_part_value_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, const char *pa _val_set(obj); _units_set(obj); - efl_event_callback_legacy_call - (obj, EFL_UI_RANGE_EVENT_CHANGED, NULL); + if (elm_widget_is_legacy(obj)) + efl_event_callback_legacy_call + (obj, EFL_UI_RANGE_EVENT_CHANGED, NULL); + else + { + efl_event_callback_call(obj, EFL_UI_RANGE_EVENT_CHANGED, NULL); + if (sd->val == min) + efl_event_callback_call(obj, EFL_UI_RANGE_EVENT_MIN_REACHED, NULL); + if (sd->val == max) + efl_event_callback_call(obj, EFL_UI_RANGE_EVENT_MAX_REACHED, NULL); + } } static double diff --git a/src/lib/elementary/efl_ui_slider.c b/src/lib/elementary/efl_ui_slider.c index 66524c1..5e8c787 100644 --- a/src/lib/elementary/efl_ui_slider.c +++ b/src/lib/elementary/efl_ui_slider.c @@ -49,6 +49,16 @@ _is_horizontal(Efl_Ui_Layout_Orientation dir) } static void +_emit_events(Eo *obj, Efl_Ui_Slider_Data *sd) +{ + efl_event_callback_call(obj, EFL_UI_RANGE_EVENT_CHANGED, NULL); + if (sd->val == sd->val_min) + efl_event_callback_call(obj, EFL_UI_RANGE_EVENT_MIN_REACHED, NULL); + if (sd->val == sd->val_max) + efl_event_callback_call(obj, EFL_UI_RANGE_EVENT_MAX_REACHED, NULL); +} + +static void _efl_ui_slider_val_fetch(Evas_Object *obj, Efl_Ui_Slider_Data *sd, Eina_Bool user_event) { double posx = 0.0, posy = 0.0, pos = 0.0, val; @@ -76,7 +86,7 @@ _efl_ui_slider_val_fetch(Evas_Object *obj, Efl_Ui_Slider_Data *sd, Eina_Bool us sd->val = val; if (user_event) { - efl_event_callback_call(obj, EFL_UI_RANGE_EVENT_CHANGED, NULL); + _emit_events(obj, sd); efl_event_callback_legacy_call(obj, EFL_UI_RANGE_EVENT_CHANGED, NULL); ecore_timer_del(sd->delay); sd->delay = ecore_timer_add(SLIDER_DELAY_CHANGED_INTERVAL, _delay_change, obj); @@ -787,6 +797,7 @@ _efl_ui_slider_efl_ui_range_display_range_value_set(Eo *obj, Efl_Ui_Slider_Data if (sd->val < sd->val_min) sd->val = sd->val_min; if (sd->val > sd->val_max) sd->val = sd->val_max; + _emit_events(obj, sd); efl_ui_slider_val_set(obj); } -- 2.7.4