On Fri, Apr 21, 2017, at 03:09, Jean-Philippe André wrote: > Hi Daniel (q66), > > On 21 April 2017 at 01:26, Daniel Kolesa <dan...@octaforge.org> wrote: > > > q66 pushed a commit to branch master. > > > > http://git.enlightenment.org/core/efl.git/commit/?id= > > b780cf2af299ce17be260486bb7ab64badddbaec > > > > commit b780cf2af299ce17be260486bb7ab64badddbaec > > Author: Daniel Kolesa <d.kol...@osg.samsung.com> > > Date: Thu Apr 20 18:24:38 2017 +0200 > > > > eo: move unbindable event APIs to C > > > > In a few classes, this requires some manual expansion. This should > > not break anything but it's also fairly ugly; a better solution > > would be appreciated, for now we do this. > > > > Similar changes will be done to a few other Efl.Object APIs as > > well at later point. > > > > Is this kind of trick a solution for internal only APIs? > As you know I've marked a few APIs as beta and/or protected when really I > wanted them to be just internal functions (that can be overriden, so not > just C functions).
This is mostly to get rid of APIs that don't make sense in eo files because they need to be bound manually (to make things idiomatic)... they can't be written in eo files and marked internal because they use callback functions and void pointers, which will not be available in eo files later on. The macro system I added allows you to extend any Eo object generated from eo files with custom methods/properties defined in C, the usage is shown in the commit. I'm not quite decided if we'll get to keep this feature, as it's kind of ugly to me, so I'm constantly looking for better solutions, but this will do for the time being at least - it's easy to grep for so if we get another better solution later on it will be easy to migrate it. D5 > > If so, the alternative was to have either an @internal tag which > generates > apis in another header, or have separated eolian files that expand > existing > classes, etc... Quite ugly as well :) > > TIA, > > > > --- > > src/lib/elementary/elc_fileselector.c | 3 + > > src/lib/elementary/elm_fileselector.eo | 1 - > > src/lib/eo/Eo.h | 86 > > +++++++++++++++++++++++++++++ > > src/lib/eo/efl_object.eo | 78 > > -------------------------- > > src/lib/eo/eo_base_class.c | 37 +++++++++++++ > > src/lib/evas/canvas/efl_canvas_object.eo | 2 - > > src/lib/evas/canvas/evas_canvas3d_object.c | 4 ++ > > src/lib/evas/canvas/evas_canvas3d_object.eo | 2 - > > src/lib/evas/canvas/evas_object_main.c | 4 ++ > > 9 files changed, 134 insertions(+), 83 deletions(-) > > > > diff --git a/src/lib/elementary/elc_fileselector.c > > b/src/lib/elementary/elc_fileselector.c > > index bcafeb5..74e84a3 100644 > > --- a/src/lib/elementary/elc_fileselector.c > > +++ b/src/lib/elementary/elc_fileselector.c > > @@ -3188,4 +3188,7 @@ > > _elm_fileselector_elm_interface_atspi_widget_action_elm_actions_get(Eo > > *obj EINA > > return &atspi_actions[0]; > > } > > > > +#define ELM_FILESELECTOR_EXTRA_OPS \ > > + EFL_OBJECT_OP_FUNC(efl_event_callback_legacy_call, > > _elm_fileselector_efl_object_event_callback_legacy_call) > > + > > #include "elm_fileselector.eo.c" > > diff --git a/src/lib/elementary/elm_fileselector.eo > > b/src/lib/elementary/elm_fileselector.eo > > index 426c85d..befb014 100644 > > --- a/src/lib/elementary/elm_fileselector.eo > > +++ b/src/lib/elementary/elm_fileselector.eo > > @@ -35,7 +35,6 @@ class Elm.Fileselector (Elm.Layout, > > Elm.Interface.Fileselector, > > class.constructor; > > class.destructor; > > Efl.Object.constructor; > > - Efl.Object.event_callback_legacy_call; > > Efl.Canvas.Group.group_add; > > Efl.Canvas.Group.group_del; > > Elm.Widget.focus_next; > > diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h > > index 178308a..fe67aa0 100644 > > --- a/src/lib/eo/Eo.h > > +++ b/src/lib/eo/Eo.h > > @@ -234,6 +234,92 @@ struct _Efl_Event { > > }; > > > > /** > > + * @brief Add a callback for an event with a specific priority. > > + * > > + * callbacks of the same priority are called in reverse order of creation. > > + * > > + * A callback is only executed on events emitted after this call finished. > > + * > > + * @param[in] desc The description of the event to listen to > > + * @param[in] priority The priority of the callback > > + * @param[in] cb the callback to call > > + * @param[in] data additional data to pass to the callback > > + * > > + * @return Return @c true when the callback has been successfully added. > > + */ > > +EOAPI Eina_Bool efl_event_callback_priority_add(Eo *obj, const > > Efl_Event_Description *desc, Efl_Callback_Priority priority, Efl_Event_Cb > > cb, const void *data); > > + > > +/** > > + * @brief Delete a callback with a specific data associated to it for an > > event. > > + * > > + * The callback will never be emitted again after this call, even if a > > event > > + * emission is going on. > > + * > > + * @param[in] desc The description of the event to listen to > > + * @param[in] func The callback to delete > > + * @param[in] user_data The data to compare > > + * > > + * @return Return @c true when the callback has been successfully removed. > > + */ > > +EOAPI Eina_Bool efl_event_callback_del(Eo *obj, const > > Efl_Event_Description *desc, Efl_Event_Cb func, const void *user_data); > > + > > +/** > > + * @brief Add an array of callbacks created by @ref > > EFL_CALLBACKS_ARRAY_DEFINE > > + * for an event with a specific priority. The array need to be sorted > > with @ref > > + * efl_callbacks_cmp if you are not using the @ref > > EFL_CALLBACKS_ARRAY_DEFINE > > + * macro. > > + * > > + * callbacks of the same priority are called in reverse order of creation. > > + * > > + * A callback from the array is only executed on events emitted after > > this > > + * call finished. > > + * > > + * @param[in] array An #Efl_Callback_Array_Item of events to listen to > > + * @param[in] priority The priority of the callback > > + * @param[in] data Additional data to pass to the callback > > + * > > + * @return Return @c true when the callback has been successfully added. > > + */ > > +EOAPI Eina_Bool efl_event_callback_array_priority_add(Eo *obj, const > > Efl_Callback_Array_Item *array, Efl_Callback_Priority priority, const void > > *data); > > + > > +/** > > + * @brief Del a callback array with a specific data associated to it for > > an > > + * event. The callbacks from the array will never be emitted again after > > this > > + * call, even if a event emission is going on. > > + * > > + * @param[in] array An #Efl_Callback_Array_Item of events to listen to > > + * @param[in] user_data The data to compare > > + * > > + * @return Return @c true when the callback has been successfully removed. > > + */ > > +EOAPI Eina_Bool efl_event_callback_array_del(Eo *obj, const > > Efl_Callback_Array_Item *array, const void *user_data); > > + > > +/** > > + * @brief Call the callbacks for an event of an object. > > + * > > + * @param[in] desc The description of the event to call > > + * @param[in] event_info Extra event info to pass to the callbacks > > + * > > + * @return @c false if one of the callbacks aborted the call, @c true > > otherwise > > + */ > > +EOAPI Eina_Bool efl_event_callback_call(Eo *obj, const > > Efl_Event_Description *desc, void *event_info); > > + > > +/** > > + * @brief Call the callbacks for an event of an object. > > + * > > + * Like @ref efl_event_callback_call, but also call legacy smart > > callbacks that > > + * have the same name of the given event. > > + * > > + * @param[in] desc The description of the event to call > > + * @param[in] event_info Extra event info to pass to the callbacks > > + * > > + * @return @c false if one of the callbacks aborted the call, @c true > > otherwise > > + * > > + * @since 1.19 > > + */ > > +EOAPI Eina_Bool efl_event_callback_legacy_call(Eo *obj, const > > Efl_Event_Description *desc, void *event_info); > > + > > +/** > > * @addtogroup Eo_Debug_Information Eo's Debug information helper. > > * @{ > > */ > > diff --git a/src/lib/eo/efl_object.eo b/src/lib/eo/efl_object.eo > > index 1d47eba..c55ed76 100644 > > --- a/src/lib/eo/efl_object.eo > > +++ b/src/lib/eo/efl_object.eo > > @@ -309,84 +309,6 @@ abstract Efl.Object () > > Prevents event callbacks from being called for the object. > > ]] > > } > > - event_callback_priority_add { > > - [[Add a callback for an event with a specific priority. > > - > > - callbacks of the same priority are called in reverse order of > > - creation. > > - > > - A callback is only executed on events emitted after this call > > finished. > > - ]] > > - return: bool; [[Return $true when the callback has been > > successfully added.]] > > - params { > > - @in desc: ptr(const(Efl.Event.Description)); [[The > > description of the event to listen to]] > > - @in priority: Efl.Callback_Priority; [[The priority of the > > callback]] > > - @in cb: Efl.Event_Cb; [[the callback to call]] > > - @in data: const(void_ptr); [[additional data to pass to the > > callback]] > > - } > > - } > > - event_callback_del { > > - [[Delete a callback with a specific data associated to it for an > > event. > > - > > - The callback will never be emitted again after this call, even > > if a event emission is going on. > > - ]] > > - return: bool; [[Return $true when the callback has been > > successfully removed.]] > > - params { > > - @in desc: ptr(const(Efl.Event.Description)); [[The > > description of the event to listen to]] > > - @in func: Efl.Event_Cb; [[The callback to delete]] > > - @in user_data: const(void_ptr); [[The data to compare]] > > - } > > - } > > - event_callback_array_priority_add { > > - [[Add an array of callbacks created by \@ref > > EFL_CALLBACKS_ARRAY_DEFINE for an event > > - with a specific priority. The array need to be sorted with > > \@ref efl_callbacks_cmp > > - if you are not using the \@ref EFL_CALLBACKS_ARRAY_DEFINE macro. > > - > > - callbacks of the same priority are called in reverse order of > > - creation. > > - > > - A callback from the array is only executed on events emitted > > after this call finished. > > - ]] > > - return: bool; [[Return $true when the callback has been > > successfully added.]] > > - params { > > - @in array: ptr(const(Efl.Callback_Array_Item)); [[An > > #Efl_Callback_Array_Item of events to listen to]] > > - @in priority: Efl.Callback_Priority; [[The priority of the > > callback]] > > - @in data: const(void_ptr); [[Additional data to pass to the > > callback]] > > - } > > - } > > - event_callback_array_del { > > - [[Del a callback array with a specific data associated to it for > > an > > - event. > > - The callbacks from the array will never be emitted again after > > this call, even if a event emission is going on. > > - ]] > > - return: bool; [[Return $true when the callback has been > > successfully removed.]] > > - params { > > - @in array: ptr(const(Efl.Callback_Array_Item)); [[An > > #Efl_Callback_Array_Item of events to listen to]] > > - @in user_data: const(void_ptr); [[The data to compare]] > > - } > > - } > > - event_callback_call { > > - [[Call the callbacks for an event of an object.]] > > - params { > > - @in desc: ptr(const(Efl.Event.Description)); [[The > > description of the event to call]] > > - @in event_info: void_ptr; [[Extra event info to pass to the > > callbacks]] > > - } > > - return: bool; [[$false if one of the callbacks aborted the call, > > $true otherwise]] > > - } > > - event_callback_legacy_call { > > - [[Call the callbacks for an event of an object. > > - > > - Like @.event_callback_call, but also call legacy smart > > callbacks > > - that have the same name of the given event. > > - > > - @since 1.19 > > - ]] > > - params { > > - @in desc: ptr(const(Efl.Event.Description)); [[The > > description of the event to call]] > > - @in event_info: void_ptr; [[Extra event info to pass to the > > callbacks]] > > - } > > - return: bool; [[$false if one of the callbacks aborted the call, > > $true otherwise]] > > - } > > event_callback_stop { > > [[Stop the current callback call. > > > > diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c > > index f8a12c9..fe3dc28 100644 > > --- a/src/lib/eo/eo_base_class.c > > +++ b/src/lib/eo/eo_base_class.c > > @@ -1219,6 +1219,12 @@ err: > > return EINA_FALSE; > > } > > > > +EOAPI EFL_FUNC_BODYV(efl_event_callback_priority_add, > > + Eina_Bool, 0, EFL_FUNC_CALL(desc, priority, cb, > > data), > > + const Efl_Event_Description *desc, > > + Efl_Callback_Priority priority, > > + Efl_Event_Cb cb, const void *data); > > + > > static void > > _efl_object_event_callback_clean(Eo *obj, Efl_Object_Data *pd, > > const Efl_Callback_Array_Item *array, > > @@ -1262,6 +1268,11 @@ _efl_object_event_callback_del(Eo *obj, > > Efl_Object_Data *pd, > > return EINA_FALSE; > > } > > > > +EOAPI EFL_FUNC_BODYV(efl_event_callback_del, > > + Eina_Bool, 0, EFL_FUNC_CALL(desc, func, user_data), > > + const Efl_Event_Description *desc, > > + Efl_Event_Cb func, const void *user_data); > > + > > EOLIAN static Eina_Bool > > _efl_object_event_callback_array_priority_add(Eo *obj, Efl_Object_Data > > *pd, > > const > > Efl_Callback_Array_Item *array, > > @@ -1314,6 +1325,11 @@ err: > > return EINA_FALSE; > > } > > > > +EOAPI EFL_FUNC_BODYV(efl_event_callback_array_priority_add, > > + Eina_Bool, 0, EFL_FUNC_CALL(array, priority, data), > > + const Efl_Callback_Array_Item *array, > > + Efl_Callback_Priority priority, const void *data); > > + > > EOLIAN static Eina_Bool > > _efl_object_event_callback_array_del(Eo *obj, Efl_Object_Data *pd, > > const Efl_Callback_Array_Item *array, > > @@ -1339,6 +1355,11 @@ _efl_object_event_callback_array_del(Eo *obj, > > Efl_Object_Data *pd, > > return EINA_FALSE; > > } > > > > +EOAPI EFL_FUNC_BODYV(efl_event_callback_array_del, > > + Eina_Bool, 0, EFL_FUNC_CALL(array, user_data), > > + const Efl_Callback_Array_Item *array, > > + const void *user_data); > > + > > static Eina_Bool > > _cb_desc_match(const Efl_Event_Description *a, const > > Efl_Event_Description *b, Eina_Bool legacy_compare) > > { > > @@ -1506,6 +1527,10 @@ _efl_object_event_callback_call(Eo *obj_id, > > Efl_Object_Data *pd, > > return _event_callback_call(obj_id, pd, desc, event_info, EINA_FALSE); > > } > > > > +EOAPI EFL_FUNC_BODYV(efl_event_callback_call, > > + Eina_Bool, 0, EFL_FUNC_CALL(desc, event_info), > > + const Efl_Event_Description *desc, void *event_info); > > + > > EOLIAN static Eina_Bool > > _efl_object_event_callback_legacy_call(Eo *obj_id, Efl_Object_Data *pd, > > const Efl_Event_Description *desc, > > @@ -1514,6 +1539,10 @@ _efl_object_event_callback_legacy_call(Eo *obj_id, > > Efl_Object_Data *pd, > > return _event_callback_call(obj_id, pd, desc, event_info, EINA_TRUE); > > } > > > > +EOAPI EFL_FUNC_BODYV(efl_event_callback_legacy_call, > > + Eina_Bool, 0, EFL_FUNC_CALL(desc, event_info), > > + const Efl_Event_Description *desc, void *event_info); > > + > > EOLIAN static void > > _efl_object_event_callback_stop(Eo *obj EINA_UNUSED, Efl_Object_Data *pd) > > { > > @@ -1933,4 +1962,12 @@ _efl_object_future_link(Eo *obj EINA_UNUSED, > > Efl_Object_Data *pd, Efl_Future *li > > return !!efl_future_then(link, _efl_object_future_link_tracking_end, > > _efl_object_future_link_tracking_end, NULL, obj); > > } > > > > +#define EFL_OBJECT_EXTRA_OPS \ > > + EFL_OBJECT_OP_FUNC(efl_event_callback_priority_add, > > _efl_object_event_callback_priority_add), \ > > + EFL_OBJECT_OP_FUNC(efl_event_callback_del, > > _efl_object_event_callback_del), > > \ > > + EFL_OBJECT_OP_FUNC(efl_event_callback_array_priority_add, > > _efl_object_event_callback_array_priority_add), \ > > + EFL_OBJECT_OP_FUNC(efl_event_callback_array_del, > > _efl_object_event_callback_array_del), \ > > + EFL_OBJECT_OP_FUNC(efl_event_callback_call, > > _efl_object_event_callback_call), \ > > + EFL_OBJECT_OP_FUNC(efl_event_callback_legacy_call, > > _efl_object_event_callback_legacy_call) > > + > > #include "efl_object.eo.c" > > diff --git a/src/lib/evas/canvas/efl_canvas_object.eo > > b/src/lib/evas/canvas/efl_canvas_object.eo > > index b152657..85557a2 100644 > > --- a/src/lib/evas/canvas/efl_canvas_object.eo > > +++ b/src/lib/evas/canvas/efl_canvas_object.eo > > @@ -638,8 +638,6 @@ abstract Efl.Canvas.Object (Efl.Object, Efl.Gfx, > > Efl.Gfx.Stack, Efl.Animator, > > Efl.Object.constructor; > > Efl.Object.destructor; > > Efl.Object.dbg_info_get; > > - Efl.Object.event_callback_legacy_call; > > - Efl.Object.event_callback_call; > > Efl.Object.provider_find; > > Efl.Gfx.visible { get; set; } > > Efl.Gfx.color { get; set; } > > diff --git a/src/lib/evas/canvas/evas_canvas3d_object.c > > b/src/lib/evas/canvas/evas_canvas3d_object.c > > index 9dde9f8..2e36a9f 100644 > > --- a/src/lib/evas/canvas/evas_canvas3d_object.c > > +++ b/src/lib/evas/canvas/evas_canvas3d_object.c > > @@ -94,4 +94,8 @@ _evas_canvas3d_object_efl_object_event_callback_del(Eo > > *obj, Evas_Canvas3D_Objec > > return r; > > } > > > > +#define EVAS_CANVAS3D_OBJECT_EXTRA_OPS \ > > + EFL_OBJECT_OP_FUNC(efl_event_callback_priority_add, > > _evas_canvas3d_object_efl_object_event_callback_priority_add), \ > > + EFL_OBJECT_OP_FUNC(efl_event_callback_del, _evas_canvas3d_object_efl_ > > object_event_callback_del) > > + > > #include "canvas/evas_canvas3d_object.eo.c" > > diff --git a/src/lib/evas/canvas/evas_canvas3d_object.eo > > b/src/lib/evas/canvas/evas_canvas3d_object.eo > > index abec916..681e282 100644 > > --- a/src/lib/evas/canvas/evas_canvas3d_object.eo > > +++ b/src/lib/evas/canvas/evas_canvas3d_object.eo > > @@ -67,8 +67,6 @@ class Evas.Canvas3D.Object (Efl.Object) > > > > implements { > > Efl.Object.constructor; > > - Efl.Object.event_callback_priority_add; > > - Efl.Object.event_callback_del; > > Efl.Object.provider_find; > > } > > events { > > diff --git a/src/lib/evas/canvas/evas_object_main.c > > b/src/lib/evas/canvas/evas_object_main.c > > index 6ec47de..9501fb2 100644 > > --- a/src/lib/evas/canvas/evas_object_main.c > > +++ b/src/lib/evas/canvas/evas_object_main.c > > @@ -2565,4 +2565,8 @@ evas_object_size_hint_display_mode_get(const > > Evas_Object *obj) > > return efl_gfx_size_hint_display_mode_get(obj); > > } > > > > +#define EFL_CANVAS_OBJECT_EXTRA_OPS \ > > + EFL_OBJECT_OP_FUNC(efl_event_callback_legacy_call, > > _efl_canvas_object_efl_object_event_callback_legacy_call), \ > > + EFL_OBJECT_OP_FUNC(efl_event_callback_call, > > _efl_canvas_object_efl_object_event_callback_call) > > + > > #include "canvas/efl_canvas_object.eo.c" > > > > -- > > > > -- > > Jean-Philippe André > > > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > enlightenment-devel mailing list > enlightenment-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel