summaryrefslogtreecommitdiff
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
parente9a434df9b2609f67546e0c99444d7ab17e715da (diff)
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
-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_
2063 efl_event_callback_array_priority_add(obj, array, \ 2063 efl_event_callback_array_priority_add(obj, array, \
2064 EFL_CALLBACK_PRIORITY_DEFAULT, data) 2064 EFL_CALLBACK_PRIORITY_DEFAULT, data)
2065 2065
2066
2067/**
2068 * @def efl_event_callback_forwarder_add(obj, desc, new_obj)
2069 * @brief Add an event callback forwarder for an event and an object.
2070 *
2071 * @param[in] obj The object.
2072 * @param[in] desc The description of the event to listen to
2073 * @param[in] new_obj The object to emit events from
2074 *
2075 * @ingroup Efl_Object
2076 */
2077#define efl_event_callback_forwarder_add(obj, desc, new_obj) efl_event_callback_forwarder_priority_add(obj, desc, EFL_CALLBACK_PRIORITY_DEFAULT, new_obj)
2078
2066/** 2079/**
2067 * @def Replace the previous Eo pointer with new content. 2080 * @def Replace the previous Eo pointer with new content.
2068 * 2081 *
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
229 under certain conditions to block a certain event. 229 under certain conditions to block a certain event.
230 ]] 230 ]]
231 } 231 }
232 event_callback_forwarder_add { 232 event_callback_forwarder_priority_add {
233 [[Add an event callback forwarder for an event and an object.]] 233 [[Add an event callback forwarder for an event and an object.]]
234 params { 234 params {
235 @cref desc: Efl.Event_Description; [[The description of the event to listen to]] 235 @cref desc: Efl.Event_Description; [[The description of the event to listen to]]
236 @in new_obj: Efl.Object; [[The object to emit events from]] 236 @in priority: short; [[The priority at which to insert the callback handler.]]
237 @in new_obj: Efl.Object @nonull; [[The object to emit events from]]
237 } 238 }
238 } 239 }
239 event_callback_forwarder_del { 240 event_callback_forwarder_del {
240 [[Remove an event callback forwarder for an event and an object.]] 241 [[Remove an event callback forwarder for an event and an object.]]
241 params { 242 params {
242 @cref desc: Efl.Event_Description; [[The description of the event to listen to]] 243 @cref desc: Efl.Event_Description; [[The description of the event to listen to]]
243 @in new_obj: Efl.Object; [[The object to emit events from]] 244 @in new_obj: Efl.Object @nonull; [[The object to emit events from]]
244 } 245 }
245 } 246 }
246 children_iterator_new { 247 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)
1806 } 1806 }
1807} 1807}
1808 1808
1809/* FIXME: Change default priority? Maybe call later? */
1810EOLIAN static void 1809EOLIAN static void
1811_efl_object_event_callback_forwarder_add(Eo *obj, Efl_Object_Data *pd EINA_UNUSED, 1810_efl_object_event_callback_forwarder_priority_add(Eo *obj, Efl_Object_Data *pd EINA_UNUSED,
1812 const Efl_Event_Description *desc, 1811 const Efl_Event_Description *desc,
1813 Eo *new_obj) 1812 short priority,
1813 Eo *new_obj)
1814{ 1814{
1815 EO_OBJ_POINTER_RETURN(new_obj, new_data);
1816 EO_OBJ_DONE(new_obj);
1815 1817
1816 /* FIXME: Add it EO_MAGIC_RETURN(new_obj, EO_EINA_MAGIC); */ 1818 efl_event_callback_priority_add(obj, desc, priority, _efl_event_forwarder_callback, new_obj);
1817
1818 efl_event_callback_add(obj, desc, _efl_event_forwarder_callback, new_obj);
1819} 1819}
1820 1820
1821EOLIAN static void 1821EOLIAN static void
1822_efl_object_event_callback_forwarder_del(Eo *obj, Efl_Object_Data *pd EINA_UNUSED, 1822_efl_object_event_callback_forwarder_del(Eo *obj, Efl_Object_Data *pd EINA_UNUSED,
1823 const Efl_Event_Description *desc, 1823 const Efl_Event_Description *desc,
1824 Eo *new_obj) 1824 Eo *new_obj)
1825{ 1825{
1826 1826 EO_OBJ_POINTER_RETURN(new_obj, new_data);
1827 /* FIXME: Add it EO_MAGIC_RETURN(new_obj, EO_EINA_MAGIC); */ 1827 EO_OBJ_DONE(new_obj);
1828 1828
1829 efl_event_callback_del(obj, desc, _efl_event_forwarder_callback, new_obj); 1829 efl_event_callback_del(obj, desc, _efl_event_forwarder_callback, new_obj);
1830} 1830}