diff --git a/src/modules/illume2/E_Illume.h b/src/modules/illume2/E_Illume.h index 18cac216f..dd87f7bff 100644 --- a/src/modules/illume2/E_Illume.h +++ b/src/modules/illume2/E_Illume.h @@ -127,5 +127,6 @@ EAPI void e_illume_border_app2_safe_region_get(E_Zone *zone, int *x, int *y, int EAPI void e_illume_kbd_safe_app_region_get(E_Zone *zone, int *x, int *y, int *w, int *h); extern EAPI E_Illume_Config *il_cfg; +extern EAPI int E_ILLUME_EVENT_POLICY_CHANGE; #endif diff --git a/src/modules/illume2/e_mod_layout.c b/src/modules/illume2/e_mod_layout.c index 294156476..54c23cfc2 100644 --- a/src/modules/illume2/e_mod_layout.c +++ b/src/modules/illume2/e_mod_layout.c @@ -18,10 +18,12 @@ static int _e_mod_layout_cb_border_focus_in(void *data, int type, void *event); static int _e_mod_layout_cb_border_focus_out(void *data, int type, void *event); static int _e_mod_layout_cb_zone_move_resize(void *data, int type, void *event); static int _e_mod_layout_cb_client_message(void *data, int type, void *event); +static int _e_mod_layout_cb_policy_change(void *data, int type, void *event); /* local variables */ static Eina_List *hooks = NULL, *handlers = NULL; static E_Illume_Layout_Policy *policy = NULL; +EAPI int E_ILLUME_EVENT_POLICY_CHANGE = 0; int e_mod_layout_init(void) @@ -32,6 +34,8 @@ e_mod_layout_init(void) char buff[PATH_MAX], dir[PATH_MAX], *file; int ret = 0; + E_ILLUME_EVENT_POLICY_CHANGE = ecore_event_type_new(); + snprintf(buff, sizeof(buff), "%s.so", il_cfg->policy.name); snprintf(dir, sizeof(dir), "%s/enlightenment/modules/illume2/policies", e_prefix_lib_get()); @@ -189,6 +193,10 @@ _e_mod_layout_policy_load(const char *file) static void _e_mod_layout_handlers_add(void) { + handlers = + eina_list_append(handlers, + ecore_event_handler_add(E_ILLUME_EVENT_POLICY_CHANGE, + _e_mod_layout_cb_policy_change, NULL)); handlers = eina_list_append(handlers, ecore_event_handler_add(E_EVENT_BORDER_ADD, @@ -486,3 +494,47 @@ _e_mod_layout_cb_client_message(void *data, int type, void *event) } return 1; } + +static int +_e_mod_layout_cb_policy_change(void *data, int type, void *event) +{ + Eina_List *files; + char buff[PATH_MAX], dir[PATH_MAX], *file; + + if (type != E_ILLUME_EVENT_POLICY_CHANGE) return 1; + if (policy) + { + e_object_del(E_OBJECT(policy)); + policy = NULL; + } + + snprintf(buff, sizeof(buff), "%s.so", il_cfg->policy.name); + snprintf(dir, sizeof(dir), "%s/enlightenment/modules/illume2/policies", + e_prefix_lib_get()); + + files = ecore_file_ls(dir); + EINA_LIST_FREE(files, file) + { + if (strcmp(file, buff)) + { + free(file); + continue; + } + snprintf(dir, sizeof(dir), + "%s/enlightenment/modules/illume2/policies/%s", + e_prefix_lib_get(), file); + break; + } + if (!file) + { + snprintf(dir, sizeof(dir), + "%s/enlightenment/modules/illume2/policies/illume.so", + e_prefix_lib_get()); + } + else + free(file); + + _e_mod_layout_policy_load(dir); + + return 1; +} diff --git a/src/modules/illume2/e_mod_main.c b/src/modules/illume2/e_mod_main.c index a5be8891d..05418ef6f 100644 --- a/src/modules/illume2/e_mod_main.c +++ b/src/modules/illume2/e_mod_main.c @@ -31,7 +31,16 @@ e_modapi_init(E_Module *m) e_module_priority_set(m, 100); /* init the config subsystem */ - if (!e_mod_config_init(m)) return NULL; + if (!e_mod_config_init(m)) + { + /* cleanup eina log domain */ + if (_e_illume_log_dom >= 0) + { + eina_log_domain_unregister(_e_illume_log_dom); + _e_illume_log_dom = -1; + } + return NULL; + } /* init the keyboard subsystem */ e_kbd_init(); diff --git a/src/modules/illume2/e_mod_policy.c b/src/modules/illume2/e_mod_policy.c index 3a197df5d..21f9cf72f 100644 --- a/src/modules/illume2/e_mod_policy.c +++ b/src/modules/illume2/e_mod_policy.c @@ -1,7 +1,5 @@ #include "E_Illume.h" -#include "e_mod_layout.h" #include "e_mod_policy.h" -#include "e_mod_config.h" /* local function prototypes */ static void *_il_config_policy_create(E_Config_Dialog *cfd); @@ -109,5 +107,6 @@ _il_config_policy_change_timeout(void *data) { e_config_save_queue(); _policy_change_timer = NULL; + ecore_event_add(E_ILLUME_EVENT_POLICY_CHANGE, NULL, NULL, NULL); return 0; } diff --git a/src/modules/illume2/e_quickpanel.c b/src/modules/illume2/e_quickpanel.c index a747361be..19a61c955 100644 --- a/src/modules/illume2/e_quickpanel.c +++ b/src/modules/illume2/e_quickpanel.c @@ -199,6 +199,9 @@ _e_quickpanel_cb_border_pre_post_fetch(void *data, void *data2) if (!_e_quickpanel_border_is_quickpanel(bd)) return; if (_e_quickpanel_by_border_get(bd)) return; if (!(qp = e_quickpanel_by_zone_get(bd->zone))) return; + + qp->borders = eina_list_sorted_insert(qp->borders, _e_quickpanel_cb_sort, bd); + e_illume_border_top_shelf_pos_get(qp->zone, NULL, &ty); bd->stolen = 1; if (bd->remember) @@ -223,7 +226,6 @@ _e_quickpanel_cb_border_pre_post_fetch(void *data, void *data2) e_illume_border_top_shelf_size_get(qp->zone, NULL, &th); e_border_fx_offset(bd, 0, (bd->h - th)); } - qp->borders = eina_list_sorted_insert(qp->borders, _e_quickpanel_cb_sort, bd); } static E_Quickpanel *