widget: Remove all legacy event stuff in propagate

The EO API is now clean! Yay!

Ref T5363
This commit is contained in:
Jean-Philippe Andre 2017-08-17 18:14:52 +09:00
parent 66d241eadf
commit c4ac589455
10 changed files with 64 additions and 64 deletions

View File

@ -567,13 +567,13 @@ _wheel_indicator_timer_cb(void *data)
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, const Efl_Event *eo_event, 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)
{
Eo *ev = eo_event->info;
if (eo_event->desc == EFL_EVENT_KEY_DOWN)
{
_slider_elm_widget_widget_event(obj, sd, eo_event, src, type, event_info);
_slider_elm_widget_widget_event(obj, sd, eo_event, src);
}
else if (eo_event->desc == EFL_EVENT_KEY_UP)
{

View File

@ -1003,12 +1003,12 @@ _key_action_escape(Evas_Object *obj, const char *params EINA_UNUSED)
ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(hoversel, Elm_Hoversel_Data)
EOLIAN static Eina_Bool
_elm_hoversel_elm_widget_widget_event(Eo *obj, Elm_Hoversel_Data *sd, const Efl_Event *eo_event, Evas_Object *src, Evas_Callback_Type type, void *event_info)
_elm_hoversel_elm_widget_widget_event(Eo *obj, Elm_Hoversel_Data *sd, const Efl_Event *eo_event, Evas_Object *src)
{
if (elm_obj_widget_event(efl_super(obj, MY_CLASS), eo_event, src, type, event_info))
if (elm_obj_widget_event(efl_super(obj, MY_CLASS), eo_event, src))
return EINA_TRUE; // note: this was FALSE but likely wrong
return _hoversel_elm_widget_widget_event(obj, sd, eo_event, src, type, event_info);
return _hoversel_elm_widget_widget_event(obj, sd, eo_event, src);
}
static void

View File

@ -971,12 +971,8 @@ _item_new(Elm_Multibuttonentry_Data *sd,
//FIXME: having an empty event handling function and reacting on Evas
//events on specific objects is crazy, someone should fix that.
EOLIAN static Eina_Bool
_elm_multibuttonentry_elm_widget_widget_event(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd EINA_UNUSED, const Efl_Event *eo_event EINA_UNUSED, Evas_Object *src, Evas_Callback_Type type, void *ev)
_elm_multibuttonentry_elm_widget_widget_event(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd EINA_UNUSED, const Efl_Event *eo_event EINA_UNUSED, Evas_Object *src EINA_UNUSED)
{
(void)src;
(void)type;
(void)ev;
// ACCESS
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON) return EINA_FALSE;

View File

@ -8,6 +8,7 @@
*/
#define ELM_CONFIG_ICON_THEME_ELEMENTARY "_Elementary_Icon_Theme"
#define ELM_WIDGET_PROTECTED
#define EFL_CANVAS_OBJECT_PROTECTED
#define EFL_CANVAS_GROUP_PROTECTED
#define EFL_CANVAS_GROUP_BETA

View File

@ -1734,8 +1734,7 @@ _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,
Evas_Object *src EINA_UNUSED, Evas_Callback_Type type EINA_UNUSED, void *event_info EINA_UNUSED)
_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)
{
Eo *ev = eo_event->info;

View File

@ -761,10 +761,10 @@ _key_action_toggle(Evas_Object *obj, const char *params EINA_UNUSED)
ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(panel, Elm_Panel_Data)
EOLIAN static Eina_Bool
_elm_panel_elm_widget_widget_event(Eo *obj, Elm_Panel_Data *pd, const Efl_Event *eo_event, Evas_Object *src, Evas_Callback_Type type, void *event_info)
_elm_panel_elm_widget_widget_event(Eo *obj, Elm_Panel_Data *pd, const Efl_Event *eo_event, Evas_Object *src)
{
if (src != obj) return EINA_FALSE;
return _panel_elm_widget_widget_event(obj, pd, eo_event, src, type, event_info);
return _panel_elm_widget_widget_event(obj, pd, eo_event, src);
}
static Eina_Bool

View File

@ -643,7 +643,7 @@ const Elm_Layout_Part_Alias_Description *elm_layout_text_aliases_get(const Eo *o
#define ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(_pfx, _typ) \
EOLIAN static Eina_Bool \
_##_pfx##_elm_widget_widget_event(Eo *obj, _typ *_pd EINA_UNUSED, const Efl_Event *eo_event, Evas_Object *src EINA_UNUSED, Evas_Callback_Type type EINA_UNUSED, void *event_info EINA_UNUSED) \
_##_pfx##_elm_widget_widget_event(Eo *obj, _typ *_pd EINA_UNUSED, const Efl_Event *eo_event, Evas_Object *src EINA_UNUSED) \
{ \
Evas_Event_Key_Down *ev; \
if (eo_event->desc != EFL_EVENT_KEY_DOWN) return EINA_FALSE; \

View File

@ -727,7 +727,7 @@ _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, Evas_Object *src EINA_UNUSED, Evas_Callback_Type type EINA_UNUSED, void *event_info EINA_UNUSED)
_elm_spinner_elm_widget_widget_event(Eo *obj, Elm_Spinner_Data *sd EINA_UNUSED, const Efl_Event *eo_event, Evas_Object *src EINA_UNUSED)
{
Eo *ev = eo_event->info;

View File

@ -109,9 +109,7 @@ static void
_on_sub_obj_del(void *data, const Efl_Event *event);
static void
_on_sub_obj_hide(void *data, const Efl_Event *event);
static void
_propagate_event(void *data, const Efl_Event *event);
static Eina_Bool elm_widget_event_propagate(Evas_Object *obj, const Efl_Event *eo_event, Evas_Callback_Type type, void *event_info, Evas_Event_Flags *event_flags);
static void _propagate_event(void *data, const Efl_Event *eo_event);
EFL_CALLBACKS_ARRAY_DEFINE(elm_widget_subitems_callbacks,
{ EFL_EVENT_DEL, _on_sub_obj_del },
@ -984,11 +982,9 @@ _propagate_y_drag_lock(Evas_Object *obj,
}
}
static void
_propagate_event(void *data EINA_UNUSED, const Efl_Event *event)
static Eina_Bool
_propagate_event_legacy(Eo *parent, const Efl_Event *event, Eo *obj, Elm_Event_Cb_Data *ecd)
{
Eo *obj = event->object;
INTERNAL_ENTRY;
Evas_Callback_Type type;
Evas_Event_Flags *event_flags, prev_flags;
union {
@ -998,38 +994,40 @@ _propagate_event(void *data EINA_UNUSED, const Efl_Event *event)
void *any;
} event_info;
if ((evas_focus_get(evas_object_evas_get(obj)) != elm_widget_top_get(obj)) &&
efl_isa(obj, EFL_UI_WIN_CLASS))
return;
if (event->desc == EFL_EVENT_KEY_DOWN)
{
event_info.down = efl_input_legacy_info_get(event->info);
EINA_SAFETY_ON_NULL_RETURN(event_info.down);
EINA_SAFETY_ON_NULL_RETURN_VAL(event_info.down, EINA_FALSE);
type = EVAS_CALLBACK_KEY_DOWN;
event_flags = &event_info.down->event_flags;
}
else if (event->desc == EFL_EVENT_KEY_UP)
{
event_info.up = efl_input_legacy_info_get(event->info);
EINA_SAFETY_ON_NULL_RETURN(event_info.up);
EINA_SAFETY_ON_NULL_RETURN_VAL(event_info.up, EINA_FALSE);
type = EVAS_CALLBACK_KEY_UP;
event_flags = &event_info.up->event_flags;
}
else if (event->desc == EFL_EVENT_POINTER_WHEEL)
{
event_info.wheel = efl_input_legacy_info_get(event->info);
EINA_SAFETY_ON_NULL_RETURN(event_info.wheel);
EINA_SAFETY_ON_NULL_RETURN_VAL(event_info.wheel, EINA_FALSE);
type = EVAS_CALLBACK_MOUSE_WHEEL;
event_flags = &event_info.wheel->event_flags;
}
else
return;
return EINA_FALSE;
prev_flags = *event_flags;
elm_widget_event_propagate(obj, event, type, event_info.any, event_flags);
if (prev_flags != *event_flags)
efl_input_event_flags_set(event->info, *event_flags);
if (ecd->func((void *)ecd->data, parent, obj, type, event_info.any) ||
(event_flags && ((*event_flags) & EVAS_EVENT_FLAG_ON_HOLD)))
{
if (prev_flags != *event_flags)
efl_input_event_flags_set(event->info, *event_flags);
return EINA_TRUE;
}
return EINA_FALSE;
}
/**
@ -2002,22 +2000,22 @@ elm_widget_event_callback_del(Eo *obj, Elm_Event_Cb func, const void *data)
return NULL;
}
static Eina_Bool
elm_widget_event_propagate(Eo *obj, const Efl_Event *eo_event,
Evas_Callback_Type type, void *event_info,
Evas_Event_Flags *event_flags)
static void
_propagate_event(void *data EINA_UNUSED, const Efl_Event *eo_event)
{
Evas_Object *obj = eo_event->object;
Evas_Object *parent = obj;
Elm_Event_Cb_Data *ecd;
Eina_List *l, *l_prev;
while (parent &&
(!(event_flags && ((*event_flags) & EVAS_EVENT_FLAG_ON_HOLD))))
{
ELM_WIDGET_CHECK(parent) EINA_FALSE;
Elm_Widget_Smart_Data *sd = efl_data_scope_get(parent, MY_CLASS);
if ((evas_focus_get(evas_object_evas_get(obj)) != elm_widget_top_get(obj)) &&
efl_isa(obj, EFL_UI_WIN_CLASS))
return;
Eina_Bool int_ret = EINA_FALSE;
while (parent && !efl_input_processed_get(eo_event->info))
{
Elm_Widget_Smart_Data *sd = efl_data_scope_safe_get(parent, MY_CLASS);
if (!sd) return;
if (elm_widget_disabled_get(obj))
{
@ -2025,19 +2023,17 @@ elm_widget_event_propagate(Eo *obj, const Efl_Event *eo_event,
continue;
}
int_ret = elm_obj_widget_event(parent, eo_event, obj, type, event_info);
if (int_ret) return EINA_TRUE;
if (elm_obj_widget_event(parent, eo_event, obj))
return;
EINA_LIST_FOREACH_SAFE(sd->event_cb, l, l_prev, ecd)
{
if (ecd->func((void *)ecd->data, parent, obj, type, event_info) ||
(event_flags && ((*event_flags) & EVAS_EVENT_FLAG_ON_HOLD)))
return EINA_TRUE;
if (_propagate_event_legacy(parent, eo_event, obj, ecd))
return;
}
parent = sd->parent_obj;
}
return EINA_FALSE;
}
/**
@ -6210,7 +6206,7 @@ _elm_widget_disable(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *_pd EINA_UNUSED)
}
EOLIAN static Eina_Bool
_elm_widget_widget_event(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *_pd EINA_UNUSED, const Efl_Event *eo_event EINA_UNUSED, Evas_Object *source EINA_UNUSED, Evas_Callback_Type type EINA_UNUSED, void *event_info EINA_UNUSED)
_elm_widget_widget_event(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *_pd EINA_UNUSED, const Efl_Event *eo_event EINA_UNUSED, Evas_Object *source EINA_UNUSED)
{
return EINA_FALSE;
}

View File

@ -4,7 +4,6 @@ import efl_input_types;
/* FIXME: This shouldn't be here. */
type list_data_get_func_type: __undefined_type; [[Elementary list data get function type]]
type region_hook_func_type: __undefined_type; [[Elementary region hook function type]]
type @extern Evas.Callback_Type: __undefined_type; [[Evas event type]]
enum Elm.Activate
{
@ -82,6 +81,26 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible,
for the available style names, or to the themes in use.]]
}
}
widget_event @protected {
[[Virtual function handling input events on the widget.
This method should return $true if the event has been processed.
Only key down, key up and pointer wheel events will be propagated
through this function.
It is common for the event to be also marked as processed as in
@Efl.Input.Event.processed, if this operation was successful. This
makes sure other widgets will not also process this input event.
]]
params {
@in eo_event: const(ptr(Efl.Event));
[[EO event struct with an Efl.Input.Event as info.]]
@in source: Efl.Canvas.Object;
[[Source object where the event originated. Often same as this.]]
}
return: bool; [[$true on success, $false otherwise]]
legacy: null;
}
@property focus {
[[Focus property]]
@ -495,17 +514,6 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible,
return: bool; [[$true on success, $false otherwise]]
legacy: null;
}
widget_event {
[['Virtual' function handling input events on the widget.]]
params {
@in eo_event: const(ptr(Efl.Event)); [[EO event info with an Efl.Input.Event]]
@in source: Efl.Canvas.Object; [[Source object]]
@in type: Evas.Callback_Type; [[Callback type]]
@in event_info: void_ptr; [[Event info]]
}
return: bool; [[$true on success, $false otherwise]]
legacy: null;
}
access {
[['Virtual' function on the widget being set access.]]
params {