diff options
author | Tom 'TAsn' Hacohen <tom@stosb.com> | 2013-08-30 16:39:51 +0100 |
---|---|---|
committer | Tom 'TAsn' Hacohen <tom@stosb.com> | 2013-08-30 16:41:03 +0100 |
commit | 49a3f7ee22b6ddf0869a6ba82660308c3f4d0bbd (patch) | |
tree | ed6caf77a5efd6a31ceb0c6b535eba6b2db5a514 | |
parent | 7c61aa0cb550ae22a0657ce45f0aea4cf95a74aa (diff) | |
download | elementary-49a3f7ee22b6ddf0869a6ba82660308c3f4d0bbd.tar.gz |
Added clouseau integration.
You need to make sure the clouseau daemon is running (clouseaud), and then
you can just run applications by setting the env var ELM_CLOUSEAU to 1.
This is very useful for platforms that do not have LD_PRELOAD, or block
them for any reason.
Most people should just stick to using clouseau_start or clouseau.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | src/lib/elm_main.c | 72 |
3 files changed, 80 insertions, 0 deletions
@@ -840,3 +840,8 @@ 2013-08-02 Eduardo Lima (Etrunko) * 1.7.8 release + +2013-08-30 Tom Hacohen (TAsn) + + * Clouseau: Added clouseau integration. + @@ -3,6 +3,9 @@ Elementary 1.7.8 Changes since Elementary 1.7.7: ------------------------- +Improvements: + * Clouseau: Added clouseau integration. + Fixes: * Fix potential free'ed memory dereference in naviframe. diff --git a/src/lib/elm_main.c b/src/lib/elm_main.c index 1a0966377..81e610340 100644 --- a/src/lib/elm_main.c +++ b/src/lib/elm_main.c @@ -23,6 +23,12 @@ #define SEMI_BROKEN_QUICKLAUNCH 1 +#ifdef __CYGWIN__ +# define LIBEXT ".dll" +#else +# define LIBEXT ".so" +#endif + static Elm_Version _version = { VMAJ, VMIN, VMIC, VREV }; EAPI Elm_Version *elm_version = &_version; @@ -198,6 +204,55 @@ _prefix_shutdown(void) app_pfx = NULL; } +static struct { + Eina_Module *handle; + void (*init)(void); + void (*shutdown)(void); + Eina_Bool (*app_connect)(const char *appname); +} _clouseau_info; + +#define _CLOUSEAU_LOAD_SYMBOL(cls_struct, sym) \ + do \ + { \ + (cls_struct).sym = eina_module_symbol_get((cls_struct).handle, "clouseau_" #sym); \ + if (!(cls_struct).sym) \ + { \ + WRN("Failed loading symbol '%s' from the clouseau library.", "clouseau_" #sym); \ + eina_module_free((cls_struct).handle); \ + (cls_struct).handle = NULL; \ + return EINA_FALSE; \ + } \ + } \ + while (0) + +static Eina_Bool +_clouseau_module_load() +{ + const char *elm_clouseau_env = getenv("ELM_CLOUSEAU"); + Eina_Bool want_cls = EINA_FALSE; + if (elm_clouseau_env) + want_cls = atoi(elm_clouseau_env); + + if (!want_cls) + return EINA_FALSE; + + _clouseau_info.handle = eina_module_new( + PACKAGE_LIB_DIR "/clouseau/libclouseau" LIBEXT); + if (!eina_module_load(_clouseau_info.handle)) + { + WRN("Failed loading the clouseau library."); + eina_module_free(_clouseau_info.handle); + _clouseau_info.handle = NULL; + return EINA_FALSE; + } + + _CLOUSEAU_LOAD_SYMBOL(_clouseau_info, init); + _CLOUSEAU_LOAD_SYMBOL(_clouseau_info, shutdown); + _CLOUSEAU_LOAD_SYMBOL(_clouseau_info, app_connect); + + return EINA_TRUE; +} + EAPI int elm_init(int argc, char **argv) @@ -206,6 +261,16 @@ elm_init(int argc, if (_elm_init_count > 1) return _elm_init_count; elm_quicklaunch_sub_init(argc, argv); _prefix_shutdown(); + + if (_clouseau_module_load()) + { + _clouseau_info.init(); + if(!_clouseau_info.app_connect(argv[0])) + { + ERR("Failed connecting to the clouseau server."); + } + } + return _elm_init_count; } @@ -221,6 +286,13 @@ elm_shutdown(void) if (_elm_init_count > 0) return _elm_init_count; _elm_win_shutdown(); while (_elm_win_deferred_free) ecore_main_loop_iterate(); + + if (_clouseau_info.shutdown) + { + _clouseau_info.shutdown(); + eina_module_free(_clouseau_info.handle); + _clouseau_info.handle = NULL; + } // wrningz :( // _prefix_shutdown(); elm_quicklaunch_sub_shutdown(); |