jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=df4e8653c7b6f30925ad3c852160bba9002ec4d2
commit df4e8653c7b6f30925ad3c852160bba9002ec4d2 Author: Jean-Philippe Andre <[email protected]> Date: Mon May 22 19:18:41 2017 +0900 edje: Remove message_handler_set from EO It is used to receive messages with a payload from embryo to C. This API has a function pointer, which means it would have to be manually bound, or transformed (eg. eo event). Also, prepare the change for message_send to use Eina_Value and no explicit type. This feature seems rarely used. But note that handler_set is in fact used in terminology, rage and luncher. So, if the need arises, it will have to be transformed in a proper EO way. --- src/lib/edje/Edje_Legacy.h | 39 +++++++++++++++++++++++++++++++++++++++ src/lib/edje/edje_message_queue.c | 39 +++++++++++++++++++++++++-------------- src/lib/edje/edje_object.eo | 23 ++--------------------- 3 files changed, 66 insertions(+), 35 deletions(-) diff --git a/src/lib/edje/Edje_Legacy.h b/src/lib/edje/Edje_Legacy.h index f2f21db..b0df94e 100644 --- a/src/lib/edje/Edje_Legacy.h +++ b/src/lib/edje/Edje_Legacy.h @@ -97,6 +97,45 @@ EAPI void *edje_object_signal_callback_del (Evas_Object *obj, const char */ EAPI void *edje_object_signal_callback_del_full(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data); +/** + * @brief Sets an Edje message handler function for a given Edje object. + * + * For scriptable programs on an Edje object's defining EDC file which send + * messages with the send_message() primitive, one can attach handler + * functions, to be called in the code which creates that object (see @ref + * edcref "the syntax" for EDC files). + * + * This function associates a message handler function and the attached data + * pointer to the object obj. + * + * See also @ref edje_object_message_send() + * + * @param[in] func The function to handle messages coming from obj + * @param[in] data Auxiliary data to be passed to func + */ +EAPI void edje_object_message_handler_set(Edje_Object *obj, Edje_Message_Handler_Cb func, void *data); + +/** + * @brief Sends an (Edje) message to a given Edje object + * + * This function sends an Edje message to obj and to all of its child objects, + * if it has any (swallowed objects are one kind of child object). type and msg + * must be matched accordingly, as documented in #Edje_Message_Type. + * + * The id argument as a form of code and theme defining a common interface on + * message communication. One should define the same IDs on both code and EDC + * declaration (see @ref edcref "the syntax" for EDC files), to individualize + * messages (binding them to a given context). + * + * The function to handle messages arriving from obj is set with + * edje_object_message_handler_set(). + * + * @param[in] type The type of message to send to obj + * @param[in] id A identification number for the message to be sent + * @param[in] msg The message's body, a struct depending on type + */ +EAPI void edje_object_message_send(Edje_Object *obj, Edje_Message_Type type, int id, void *msg); + /** * @deprecated use evas_object_size_hint_min_set() instead. * @brief Sets the object minimum size. diff --git a/src/lib/edje/edje_message_queue.c b/src/lib/edje/edje_message_queue.c index 0ebbcb7..75bde83 100644 --- a/src/lib/edje/edje_message_queue.c +++ b/src/lib/edje/edje_message_queue.c @@ -32,15 +32,9 @@ _edje_object_message_popornot_send(Evas_Object *obj, Edje_Message_Type type, int } EOLIAN void -_edje_object_message_send(Eo *obj, Edje *_pd EINA_UNUSED, Edje_Message_Type type, int id, void *msg) +_edje_object_message_send(Eo *obj, Edje *pd EINA_UNUSED, int id, const Eina_Value *val) { - _edje_object_message_popornot_send(obj, type, id, msg, EINA_FALSE); -} - -EOLIAN void -_edje_object_message_handler_set(Eo *obj EINA_UNUSED, Edje *ed, Edje_Message_Handler_Cb func, void *data) -{ - _edje_message_cb_set(ed, func, data); + /* TODO */ } EOLIAN void @@ -129,12 +123,6 @@ end: tmp_msgq_restart = 1; } -EAPI void -edje_message_signal_process(void) -{ - _edje_message_queue_process(); -} - static Eina_Bool _edje_dummy_timer(void *data EINA_UNUSED) { @@ -887,3 +875,26 @@ _edje_message_del(Edje *ed) } } +/* Legacy EAPI */ + +EAPI void +edje_object_message_send(Eo *obj, Edje_Message_Type type, int id, void *msg) +{ + _edje_object_message_popornot_send(obj, type, id, msg, EINA_FALSE); +} + +EAPI void +edje_message_signal_process(void) +{ + _edje_message_queue_process(); +} + +EAPI void +edje_object_message_handler_set(Eo *obj, Edje_Message_Handler_Cb func, void *data) +{ + Edje *ed; + + ed = _edje_fetch(obj); + if (!ed) return; + _edje_message_cb_set(ed, func, data); +} diff --git a/src/lib/edje/edje_object.eo b/src/lib/edje/edje_object.eo index 18e2dcf..c0870df 100644 --- a/src/lib/edje/edje_object.eo +++ b/src/lib/edje/edje_object.eo @@ -461,25 +461,6 @@ class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part, key: string; [[The data field's key string]] } } - @property message_handler { - set { - [[Sets an Edje message handler function for a given Edje object. - - For scriptable programs on an Edje object's defining EDC file which - send messages with the send_message() primitive, one can attach - handler functions, to be called in the code which creates - that object (see \@ref edcref "the syntax" for EDC files). - - This function associates a message handler function and the - attached data pointer to the object obj. - - See also @.message_send()]] - } - values { - func: Edje.Message_Handler_Cb; [[The function to handle messages coming from obj]] - data: void_ptr; [[Auxiliary data to be passed to func]] - } - } message_send { [[Sends an (Edje) message to a given Edje object @@ -498,10 +479,10 @@ class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part, edje_object_message_handler_set().]] params { - @in type: Edje.Message_Type; [[The type of message to send to obj]] @in id: int; [[A identification number for the message to be sent]] - @in msg: void_ptr; [[The message's body, a struct depending on type]] + @in msg: const(generic_value); [[The message's payload]] } + legacy: null; } signal_callback_add { [[Adds a callback for an arriving Edje signal, emitted by --
