From 66d241eadf6c86900f0f5c349b973b958e2ec747 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Thu, 17 Aug 2017 18:05:23 +0900 Subject: [PATCH] elm: Process all input events with EO This removes all uses of type & event_info in the method widget_event. Ref T5363 --- src/lib/elementary/efl_ui_slider.c | 35 +++++++++++++++-------------------- src/lib/elementary/elm_code_widget.c | 14 ++++++++------ src/lib/elementary/elm_spinner.c | 21 ++++++++------------- 3 files changed, 31 insertions(+), 39 deletions(-) diff --git a/src/lib/elementary/efl_ui_slider.c b/src/lib/elementary/efl_ui_slider.c index d6e7814..4edf565 100644 --- a/src/lib/elementary/efl_ui_slider.c +++ b/src/lib/elementary/efl_ui_slider.c @@ -563,38 +563,33 @@ _wheel_indicator_timer_cb(void *data) return ECORE_CALLBACK_CANCEL; } +// _slider_elm_widget_widget_event +ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(slider, Efl_Ui_Slider_Data) + EOLIAN static Eina_Bool -_efl_ui_slider_elm_widget_widget_event(Eo *obj, Efl_Ui_Slider_Data *sd EINA_UNUSED, const Efl_Event *eo_event EINA_UNUSED, Evas_Object *src, Evas_Callback_Type type, void *event_info) +_efl_ui_slider_elm_widget_widget_event(Eo *obj, Efl_Ui_Slider_Data *sd, const Efl_Event *eo_event, Evas_Object *src, Evas_Callback_Type type, void *event_info) { - (void) src; + Eo *ev = eo_event->info; - if (type == EVAS_CALLBACK_KEY_DOWN) + if (eo_event->desc == EFL_EVENT_KEY_DOWN) { - Evas_Event_Key_Down *ev = event_info; - if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; - - if (!_elm_config_key_binding_call(obj, MY_CLASS_NAME, ev, key_actions)) - return EINA_FALSE; - ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + _slider_elm_widget_widget_event(obj, sd, eo_event, src, type, event_info); } - else if (type == EVAS_CALLBACK_KEY_UP) + else if (eo_event->desc == EFL_EVENT_KEY_UP) { - _popup_hide(obj, NULL, NULL, NULL); + _popup_hide(obj, NULL, NULL, NULL); return EINA_FALSE; } - else if (type == EVAS_CALLBACK_MOUSE_WHEEL) + else if (eo_event->desc == EFL_EVENT_POINTER_WHEEL) { - Evas_Event_Mouse_Wheel *mev = event_info; - if (mev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; - - if (mev->z < 0) _drag_up(obj, NULL, NULL, NULL); + if (efl_input_processed_get(ev)) return EINA_FALSE; + if (efl_input_pointer_wheel_delta_get(ev) < 0) + _drag_up(obj, NULL, NULL, NULL); else _drag_down(obj, NULL, NULL, NULL); - mev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; - _popup_show(obj, NULL, NULL, NULL); - _slider_update(obj, EINA_TRUE); + efl_input_processed_set(ev, EINA_TRUE); + ELM_SAFE_FREE(sd->wheel_indicator_timer, ecore_timer_del); sd->wheel_indicator_timer = ecore_timer_add(0.5, _wheel_indicator_timer_cb, obj); - return EINA_TRUE; } else return EINA_FALSE; diff --git a/src/lib/elementary/elm_code_widget.c b/src/lib/elementary/elm_code_widget.c index a2b4b4c..fc92348 100644 --- a/src/lib/elementary/elm_code_widget.c +++ b/src/lib/elementary/elm_code_widget.c @@ -1734,16 +1734,18 @@ _elm_code_widget_scroll_event_cb(void *data, Evas_Object *obj EINA_UNUSED, } EOLIAN static Eina_Bool -_elm_code_widget_elm_widget_widget_event(Eo *obj EINA_UNUSED, Elm_Code_Widget_Data *pd EINA_UNUSED, const Efl_Event *eo_event EINA_UNUSED, - Evas_Object *src EINA_UNUSED, Evas_Callback_Type type, void *event_info) +_elm_code_widget_elm_widget_widget_event(Eo *obj EINA_UNUSED, Elm_Code_Widget_Data *pd EINA_UNUSED, const Efl_Event *eo_event, + Evas_Object *src EINA_UNUSED, Evas_Callback_Type type EINA_UNUSED, void *event_info EINA_UNUSED) { - Evas_Event_Key_Down *ev = event_info; + Eo *ev = eo_event->info; - if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE; + if (efl_input_processed_get(ev)) return EINA_FALSE; + if (eo_event->desc != EFL_EVENT_KEY_DOWN) return EINA_FALSE; - if (!strcmp(ev->key, "BackSpace")) + // FIXME: This should use key bindings and the standard implementation! + if (eina_streq(efl_input_key_get(ev), "BackSpace")) { - ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + efl_input_processed_set(ev, EINA_TRUE); return EINA_TRUE; } diff --git a/src/lib/elementary/elm_spinner.c b/src/lib/elementary/elm_spinner.c index 6b817e3..0db1088 100644 --- a/src/lib/elementary/elm_spinner.c +++ b/src/lib/elementary/elm_spinner.c @@ -727,30 +727,25 @@ _key_action_toggle(Evas_Object *obj, const char *params EINA_UNUSED) } EOLIAN static Eina_Bool -_elm_spinner_elm_widget_widget_event(Eo *obj, Elm_Spinner_Data *sd EINA_UNUSED, const Efl_Event *eo_event EINA_UNUSED, Evas_Object *src EINA_UNUSED, Evas_Callback_Type type, void *event_info) +_elm_spinner_elm_widget_widget_event(Eo *obj, Elm_Spinner_Data *sd EINA_UNUSED, const Efl_Event *eo_event, Evas_Object *src EINA_UNUSED, Evas_Callback_Type type EINA_UNUSED, void *event_info EINA_UNUSED) { - Evas_Event_Key_Down *ev = event_info; - Evas_Event_Mouse_Wheel *mev = event_info; + Eo *ev = eo_event->info; - if (type == EVAS_CALLBACK_KEY_DOWN) + if (efl_input_processed_get(ev)) return EINA_FALSE; + if (eo_event->desc == EFL_EVENT_KEY_DOWN) { - if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; if (sd->spin_timer) _spin_stop(obj); else return EINA_FALSE; - ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; } - else if (type == EVAS_CALLBACK_KEY_UP) + else if (eo_event->desc == EFL_EVENT_KEY_UP) { - if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; if (sd->spin_timer) _spin_stop(obj); else return EINA_FALSE; - ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; } - else if (type == EVAS_CALLBACK_MOUSE_WHEEL) + else if (eo_event->desc == EFL_EVENT_POINTER_WHEEL) { - if (mev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; sd->interval = sd->first_interval; - if (mev->z < 0) + if (efl_input_pointer_wheel_delta_get(ev) < 0) { sd->spin_speed = sd->step; elm_layout_signal_emit(obj, "elm,right,anim,activate", "elm"); @@ -761,10 +756,10 @@ _elm_spinner_elm_widget_widget_event(Eo *obj, Elm_Spinner_Data *sd EINA_UNUSED, elm_layout_signal_emit(obj, "elm,left,anim,activate", "elm"); } _spin_value(obj); - mev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; } else return EINA_FALSE; + efl_input_processed_set(ev, EINA_TRUE); return EINA_TRUE; } -- 2.7.4