diff --git a/src/examples/elementary/button_cxx_example_01.cc b/src/examples/elementary/button_cxx_example_01.cc index 4cad5d8ae7..433290d29b 100644 --- a/src/examples/elementary/button_cxx_example_01.cc +++ b/src/examples/elementary/button_cxx_example_01.cc @@ -156,7 +156,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) } cmid.hint_align_set(ax, ay); }, std::placeholders::_1); - efl::eolian::event_add(efl::ui::Clickable::repeated_event, up, btn_cursors_move); + efl::eolian::event_add(efl::ui::Autorepeat::repeated_event, up, btn_cursors_move); auto btn_cursors_release = std::bind( [wmid] () @@ -185,7 +185,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) left.hint_fill_set(false, true); left.hint_align_set(0.0, 0.5); box_inferior.pack_end(left); - efl::eolian::event_add(efl::ui::Clickable::repeated_event, left, btn_cursors_move); + efl::eolian::event_add(efl::ui::Autorepeat::repeated_event, left, btn_cursors_move); efl::eolian::event_add(efl::ui::Clickable::unpressed_event, left, btn_cursors_release); efl::ui::Image icon_left(instantiate, win); @@ -205,7 +205,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) right.hint_fill_set(false, true); right.hint_align_set(0.0, 0.5); box_inferior.pack_end(right); - efl::eolian::event_add(efl::ui::Clickable::repeated_event, right, btn_cursors_move); + efl::eolian::event_add(efl::ui::Autorepeat::repeated_event, right, btn_cursors_move); efl::eolian::event_add(efl::ui::Clickable::unpressed_event, right, btn_cursors_release); efl::ui::Image icon_right(instantiate, win); @@ -219,7 +219,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED) down.hint_fill_set(true, false); down.hint_align_set(0.5, 0.0); box.pack_end(down); - efl::eolian::event_add(efl::ui::Clickable::repeated_event, down, btn_cursors_move); + efl::eolian::event_add(efl::ui::Autorepeat::repeated_event, down, btn_cursors_move); efl::eolian::event_add(efl::ui::Clickable::unpressed_event, down, btn_cursors_release); efl::ui::Image icon_down(instantiate, win); diff --git a/src/lib/efl/interfaces/efl_ui_autorepeat.eo b/src/lib/efl/interfaces/efl_ui_autorepeat.eo index 48093b205d..92dcc3a88a 100644 --- a/src/lib/efl/interfaces/efl_ui_autorepeat.eo +++ b/src/lib/efl/interfaces/efl_ui_autorepeat.eo @@ -45,4 +45,7 @@ interface @beta Efl.Ui.Autorepeat { } } } + events { + repeated: void; [[Called when a repeated event is emitted]] + } } diff --git a/src/lib/efl/interfaces/efl_ui_clickable.eo b/src/lib/efl/interfaces/efl_ui_clickable.eo index 34da147875..97806e7501 100644 --- a/src/lib/efl/interfaces/efl_ui_clickable.eo +++ b/src/lib/efl/interfaces/efl_ui_clickable.eo @@ -14,6 +14,5 @@ interface @beta Efl.Ui.Clickable unpressed: Efl.Object; [[Called when the object is no longer pressed]] /* FIXME: Might be NULL */ longpressed: Efl.Object; [[Called when the object receives a long press]] - repeated: void; [[Called when the object receives repeated presses/clicks]] } } diff --git a/src/lib/elementary/efl_ui_button.c b/src/lib/elementary/efl_ui_button.c index 28bfc8680c..3139856aff 100644 --- a/src/lib/elementary/efl_ui_button.c +++ b/src/lib/elementary/efl_ui_button.c @@ -131,8 +131,11 @@ _autorepeat_send(void *data) { ELM_BUTTON_DATA_GET_OR_RETURN_VAL(data, sd, ECORE_CALLBACK_CANCEL); - efl_event_callback_legacy_call - (data, EFL_UI_EVENT_REPEATED, NULL); + if (elm_widget_is_legacy(data)) + evas_object_smart_callback_call(data, "repeated", NULL); + else + efl_event_callback_call(data, EFL_UI_AUTOREPEAT_EVENT_REPEATED, NULL); + if (!sd->repeating) { sd->timer = NULL; diff --git a/src/lib/elementary/efl_ui_calendar.c b/src/lib/elementary/efl_ui_calendar.c index eb3918d7ac..200566139b 100644 --- a/src/lib/elementary/efl_ui_calendar.c +++ b/src/lib/elementary/efl_ui_calendar.c @@ -462,7 +462,7 @@ _btn_create(Eo *obj, const char *style, char *part) efl_ui_autorepeat_gap_timeout_set(efl_added, INTERVAL), efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED, _inc_dec_btn_clicked_cb, obj), - efl_event_callback_add(efl_added, EFL_UI_EVENT_REPEATED, + efl_event_callback_add(efl_added, EFL_UI_AUTOREPEAT_EVENT_REPEATED, _inc_dec_btn_repeated_cb, obj), efl_content_set(efl_part(obj, part), efl_added)); } diff --git a/src/lib/elementary/elm_colorselector.c b/src/lib/elementary/elm_colorselector.c index a48ed8a49e..1a330b8d3a 100644 --- a/src/lib/elementary/elm_colorselector.c +++ b/src/lib/elementary/elm_colorselector.c @@ -1101,12 +1101,12 @@ _button_clicked_cb(void *data, const Efl_Event *event) } static void -_button_repeat_cb(void *data, const Efl_Event *event EINA_UNUSED) +_button_repeat_cb(void *data, Evas_Object *object, void *event_info EINA_UNUSED) { Color_Bar_Data *cb_data = data; double x, y, step; - if (event->object == cb_data->rbt) step = 1.0 / BASE_STEP; + if (object == cb_data->rbt) step = 1.0 / BASE_STEP; else step = -1.0 / BASE_STEP; edje_object_part_drag_value_get(cb_data->colorbar, "elm.arrow", &x, &y); @@ -1294,8 +1294,8 @@ _color_bars_add(Evas_Object *obj) (sd->cb_data[i]->lbt, _elm_config->longpress_timeout); elm_button_autorepeat_gap_timeout_set (sd->cb_data[i]->lbt, (1.0 / _elm_config->fps)); - efl_event_callback_add - (sd->cb_data[i]->lbt, EFL_UI_EVENT_REPEATED, _button_repeat_cb, sd->cb_data[i]); + evas_object_smart_callback_add + (sd->cb_data[i]->lbt, "repeated", _button_repeat_cb, sd->cb_data[i]); /* load right button */ if (!sd->cb_data[i]->rbt) sd->cb_data[i]->rbt = elm_button_add(sd->col_bars_area); @@ -1312,8 +1312,8 @@ _color_bars_add(Evas_Object *obj) (sd->cb_data[i]->rbt, _elm_config->longpress_timeout); elm_button_autorepeat_gap_timeout_set (sd->cb_data[i]->rbt, (1.0 / _elm_config->fps)); - efl_event_callback_add - (sd->cb_data[i]->rbt, EFL_UI_EVENT_REPEATED, _button_repeat_cb, sd->cb_data[i]); + evas_object_smart_callback_add + (sd->cb_data[i]->lbt, "repeated", _button_repeat_cb, sd->cb_data[i]); } }