aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2018-12-12 14:07:52 -0800
committerCedric BAIL <cedric.bail@free.fr>2019-01-02 13:39:14 -0800
commitdfd09ec7e4b92a0b54ea306b1d5eab547bc1a893 (patch)
treed2949ab30dc46d21a87a507c8e5238fa213408cb /src/lib
parenteo: test that event cancel before emitting does propagate event. (diff)
downloadefl-dfd09ec7e4b92a0b54ea306b1d5eab547bc1a893.tar.gz
eo: enable priority with event forwarder.
Note: Their isn't any ability to do something like a static array of events at the moment. It might lead to large memory being used when it wouldn't be necessary. If that was the case, we could fix it, but it would require a lot of dynamic hash operation I think. Reviewed-by: Marcel Hollerbach <marcel-hollerbach@t-online.de> Differential Revision: https://phab.enlightenment.org/D7482
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/eo/Eo.h13
-rw-r--r--src/lib/eo/efl_object.eo7
-rw-r--r--src/lib/eo/eo_base_class.c22
3 files changed, 28 insertions, 14 deletions
diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h
index ca133dfb4c..eac6bfe271 100644
--- a/src/lib/eo/Eo.h
+++ b/src/lib/eo/Eo.h
@@ -2063,6 +2063,19 @@ EAPI int efl_callbacks_cmp(const Efl_Callback_Array_Item *a, const Efl_Callback_
efl_event_callback_array_priority_add(obj, array, \
EFL_CALLBACK_PRIORITY_DEFAULT, data)
+
+/**
+ * @def efl_event_callback_forwarder_add(obj, desc, new_obj)
+ * @brief Add an event callback forwarder for an event and an object.
+ *
+ * @param[in] obj The object.
+ * @param[in] desc The description of the event to listen to
+ * @param[in] new_obj The object to emit events from
+ *
+ * @ingroup Efl_Object
+ */
+#define efl_event_callback_forwarder_add(obj, desc, new_obj) efl_event_callback_forwarder_priority_add(obj, desc, EFL_CALLBACK_PRIORITY_DEFAULT, new_obj)
+
/**
* @def Replace the previous Eo pointer with new content.
*
diff --git a/src/lib/eo/efl_object.eo b/src/lib/eo/efl_object.eo
index 7507e016a6..4bc643de4b 100644
--- a/src/lib/eo/efl_object.eo
+++ b/src/lib/eo/efl_object.eo
@@ -229,18 +229,19 @@ abstract Efl.Object
under certain conditions to block a certain event.
]]
}
- event_callback_forwarder_add {
+ event_callback_forwarder_priority_add {
[[Add an event callback forwarder for an event and an object.]]
params {
@cref desc: Efl.Event_Description; [[The description of the event to listen to]]
- @in new_obj: Efl.Object; [[The object to emit events from]]
+ @in priority: short; [[The priority at which to insert the callback handler.]]
+ @in new_obj: Efl.Object @nonull; [[The object to emit events from]]
}
}
event_callback_forwarder_del {
[[Remove an event callback forwarder for an event and an object.]]
params {
@cref desc: Efl.Event_Description; [[The description of the event to listen to]]
- @in new_obj: Efl.Object; [[The object to emit events from]]
+ @in new_obj: Efl.Object @nonull; [[The object to emit events from]]
}
}
children_iterator_new {
diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c
index 7f57332369..ef3a1ba9a8 100644
--- a/src/lib/eo/eo_base_class.c
+++ b/src/lib/eo/eo_base_class.c
@@ -1806,25 +1806,25 @@ _efl_event_forwarder_callback(void *data, const Efl_Event *event)
}
}
-/* FIXME: Change default priority? Maybe call later? */
EOLIAN static void
-_efl_object_event_callback_forwarder_add(Eo *obj, Efl_Object_Data *pd EINA_UNUSED,
- const Efl_Event_Description *desc,
- Eo *new_obj)
+_efl_object_event_callback_forwarder_priority_add(Eo *obj, Efl_Object_Data *pd EINA_UNUSED,
+ const Efl_Event_Description *desc,
+ short priority,
+ Eo *new_obj)
{
+ EO_OBJ_POINTER_RETURN(new_obj, new_data);
+ EO_OBJ_DONE(new_obj);
- /* FIXME: Add it EO_MAGIC_RETURN(new_obj, EO_EINA_MAGIC); */
-
- efl_event_callback_add(obj, desc, _efl_event_forwarder_callback, new_obj);
+ efl_event_callback_priority_add(obj, desc, priority, _efl_event_forwarder_callback, new_obj);
}
EOLIAN static void
_efl_object_event_callback_forwarder_del(Eo *obj, Efl_Object_Data *pd EINA_UNUSED,
- const Efl_Event_Description *desc,
- Eo *new_obj)
+ const Efl_Event_Description *desc,
+ Eo *new_obj)
{
-
- /* FIXME: Add it EO_MAGIC_RETURN(new_obj, EO_EINA_MAGIC); */
+ EO_OBJ_POINTER_RETURN(new_obj, new_data);
+ EO_OBJ_DONE(new_obj);
efl_event_callback_del(obj, desc, _efl_event_forwarder_callback, new_obj);
}