From b04f584346eb7415d7df6e9abfe6abc6477bebaf Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Fri, 7 Apr 2017 14:05:16 -0700 Subject: [PATCH] evas: engine_info set/get should never show up in Eo API. Eo API are for something we want to expose to third party application and bindings. engine_info is exactly what we don't want to expose. --- src/lib/evas/Evas_Legacy.h | 36 ++++++++++++++++++++++++++++++ src/lib/evas/canvas/evas_canvas.eo | 31 ------------------------- src/lib/evas/canvas/evas_main.c | 11 +++++---- 3 files changed, 43 insertions(+), 35 deletions(-) diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h index 3ed05abfb8..586f3b7747 100644 --- a/src/lib/evas/Evas_Legacy.h +++ b/src/lib/evas/Evas_Legacy.h @@ -44,6 +44,42 @@ EAPI Evas *evas_new(void) EINA_WARN_UNUSED_RESULT EINA_MALLOC; */ EAPI void evas_free(Evas *e) EINA_ARG_NONNULL(1); +/** + * @brief Applies the engine settings for the given evas from the given + * @c Evas_Engine_Info structure. + * + * To get the Evas_Engine_Info structure to use, call + * @ref evas_engine_info_get. Do not try to obtain a pointer to an + * @c Evas_Engine_Info structure in any other way. + * + * You will need to call this function at least once before you can create + * objects on an evas or render that evas. Some engines allow their settings to + * be changed more than once. + * + * Once called, the @c info pointer should be considered invalid. + * + * @param[in] info The pointer to the engine info to use. + * + * @return @c true if no error occurred, @c false otherwise. + * + * @ingroup Evas_Canvas + */ +EAPI Eina_Bool evas_engine_info_set(Evas *obj, Evas_Engine_Info *info); + +/** + * @brief Retrieves the current render engine info struct from the given evas. + * + * The returned structure is publicly modifiable. The contents are valid until + * either @ref evas_engine_info_set or @ref evas_render are called. + * + * This structure does not need to be freed by the caller. + * + * @return The pointer to the engine info to use. + * + * @ingroup Evas_Canvas + */ +EAPI Evas_Engine_Info *evas_engine_info_get(const Evas *obj); + #include "canvas/evas_canvas.eo.legacy.h" /** diff --git a/src/lib/evas/canvas/evas_canvas.eo b/src/lib/evas/canvas/evas_canvas.eo index d71b342dd8..3e6298bd3a 100644 --- a/src/lib/evas/canvas/evas_canvas.eo +++ b/src/lib/evas/canvas/evas_canvas.eo @@ -88,37 +88,6 @@ class Evas.Canvas (Efl.Object, Efl.Canvas, Efl.Animator, Efl.Input.Interface, ]] } } - @property engine_info { - set { - [[Applies the engine settings for the given evas from the - given $Evas_Engine_Info structure. - - To get the Evas_Engine_Info structure to use, call - @.engine_info.get. Do not try to obtain a pointer to an - $Evas_Engine_Info structure in any other way. - - You will need to call this function at least once before you - can create objects on an evas or render that evas. Some - engines allow their settings to be changed more than once. - - Once called, the $info pointer should be considered invalid. - ]] - return: bool; [[$true if no error occurred, $false otherwise.]] - } - get { - [[Retrieves the current render engine info struct from the given - evas. - - The returned structure is publicly modifiable. The contents - are valid until either @.engine_info.set or @.render are called. - - This structure does not need to be freed by the caller. - ]] - } - values { - info: ptr(Evas.Engine_Info); [[The pointer to the engine info to use.]] - } - } @property focus { get { [[Retrieve the object focused by the default seat. diff --git a/src/lib/evas/canvas/evas_main.c b/src/lib/evas/canvas/evas_main.c index fff28b4bc2..e66393bfc8 100644 --- a/src/lib/evas/canvas/evas_main.c +++ b/src/lib/evas/canvas/evas_main.c @@ -421,9 +421,10 @@ _evas_canvas_efl_object_destructor(Eo *eo_e, Evas_Public_Data *e) efl_destructor(efl_super(eo_e, MY_CLASS)); } -EOLIAN static Evas_Engine_Info* -_evas_canvas_engine_info_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e) +EAPI Evas_Engine_Info * +evas_engine_info_get(const Evas *obj) { + const Evas_Public_Data *e = efl_data_scope_get(obj, EVAS_CANVAS_CLASS); Evas_Engine_Info *info; if (!e->engine.info) return NULL; @@ -434,9 +435,11 @@ _evas_canvas_engine_info_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e) return info; } -EOLIAN static Eina_Bool -_evas_canvas_engine_info_set(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, Evas_Engine_Info *info) +EAPI Eina_Bool +evas_engine_info_set(Evas *obj, Evas_Engine_Info *info) { + Evas_Public_Data *e = efl_data_scope_get(obj, EVAS_CANVAS_CLASS); + if (!info) return EINA_FALSE; if (info != e->engine.info) return EINA_FALSE; if (info->magic != e->engine.info_magic) return EINA_FALSE;