forked from enlightenment/efl
Added basic clouseau auto-start support.
If the ELM_CLOUSEAU env var is set to 1 elm auto-starts clouseau. Next step would be integrating it into the elm config and making it toggle-able on run-time.
This commit is contained in:
parent
bb3e1ab36e
commit
123596ee5b
|
@ -204,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 "/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)
|
||||
|
@ -213,6 +262,16 @@ elm_init(int argc,
|
|||
elm_quicklaunch_init(argc, argv);
|
||||
elm_quicklaunch_sub_init(argc, argv);
|
||||
_prefix_shutdown();
|
||||
|
||||
if (_clouseau_module_load())
|
||||
{
|
||||
_clouseau_info.init();
|
||||
if(!_clouseau_info.app_connect(elm_app_name_get()))
|
||||
{
|
||||
ERR("Failed connecting to the clouseau server.");
|
||||
}
|
||||
}
|
||||
|
||||
return _elm_init_count;
|
||||
}
|
||||
|
||||
|
@ -228,6 +287,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();
|
||||
if (app_name)
|
||||
|
|
Loading…
Reference in New Issue