devilhorns pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=1132afd78a6d6f37a429a84dbcf343c6917a97f2
commit 1132afd78a6d6f37a429a84dbcf343c6917a97f2 Author: Chris Michael <cp.mich...@samsung.com> Date: Tue Aug 18 10:06:40 2015 -0400 ecore-wl2: Add API function for ecore_wl2_init Signed-off-by: Chris Michael <cp.mich...@samsung.com> --- src/lib/ecore_wl2/Ecore_Wl2.h | 6 +++++ src/lib/ecore_wl2/ecore_wl2.c | 57 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h index f18c2bb..7a25863 100644 --- a/src/lib/ecore_wl2/Ecore_Wl2.h +++ b/src/lib/ecore_wl2/Ecore_Wl2.h @@ -29,6 +29,12 @@ typedef struct _Ecore_Wl_Window Ecore_Wl_Window; # endif +EAPI extern int ECORE_WL2_EVENT_GLOBAL_ADDED; +EAPI extern int ECORE_WL2_EVENT_GLOBAL_REMOVED; + +EAPI int ecore_wl2_init(void); +EAPI int ecore_wl2_shutdown(void); + /* # ifdef __cplusplus */ /* } */ /* # endif */ diff --git a/src/lib/ecore_wl2/ecore_wl2.c b/src/lib/ecore_wl2/ecore_wl2.c new file mode 100644 index 0000000..524228a --- /dev/null +++ b/src/lib/ecore_wl2/ecore_wl2.c @@ -0,0 +1,57 @@ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "ecore_wl2_private.h" + +/* local variables */ +static int _ecore_wl2_init_count = 0; + +/* external variables */ +int _ecore_wl2_log_dom = -1; + +/* public API functions */ +EAPI int +ecore_wl2_init(void) +{ + if (++_ecore_wl2_init_count != 1) return _ecore_wl2_init_count; + + /* try to initialize Eina */ + if (!eina_init()) return --_ecore_wl2_init_count; + + /* try to create Eina logging domain */ + _ecore_wl2_log_dom = + eina_log_domain_register("ecore_wl2", ECORE_WL2_DEFAULT_LOG_COLOR); + if (_ecore_wl2_log_dom < 0) + { + EINA_LOG_ERR("Cannot create a log domain for Ecore Wl2"); + goto eina_err; + } + + /* try to initialize Ecore */ + if (!ecore_init()) + { + ERR("Could not initialize Ecore"); + goto ecore_err; + } + + /* try to initialize Ecore_Event */ + if (!ecore_event_init()) + { + ERR("Could not initialize Ecore_Event"); + goto ecore_event_err; + } + + return _ecore_wl2_init_count; + +ecore_event_err: + ecore_shutdown(); + +ecore_err: + eina_log_domain_unregister(_ecore_wl2_log_dom); + _ecore_wl2_log_dom = -1; + +eina_err: + eina_shutdown(); + return --_ecore_wl2_init_count; +} --