also make comp config reset to default on ctrl+alt+shift+home

SVN revision: 49092
This commit is contained in:
Carsten Haitzler 2010-05-21 10:04:54 +00:00
parent 9554af6ed0
commit 50e0cc1db0
3 changed files with 99 additions and 101 deletions

View File

@ -2040,6 +2040,9 @@ _e_mod_comp_key_down(void *data, int type, void *event)
{
if (_comp_mod)
{
_e_mod_config_free(_comp_mod->module);
_e_mod_config_new(_comp_mod->module);
e_config_save();
e_module_disable(_comp_mod->module);
e_config_save();
e_sys_action_do(E_SYS_RESTART, NULL);

View File

@ -91,108 +91,90 @@ e_modapi_init(E_Module *m)
mod->conf = e_config_domain_load("module.comp", mod->conf_edd);
if (!mod->conf)
{
mod->conf = E_NEW(Config, 1);
mod->conf->use_shadow = 1;
mod->conf->shadow_file = NULL;
mod->conf->shadow_style = eina_stringshare_add("default");
mod->conf->engine = E_EVAS_ENGINE_SOFTWARE_X11;
mod->conf->indirect = 0;
mod->conf->texture_from_pixmap = 0;
mod->conf->lock_fps = 0;
mod->conf->efl_sync = 1;
mod->conf->loose_sync = 1;
mod->conf->grab = 0;
mod->conf->vsync = 1;
mod->conf->keep_unmapped = 1;
mod->conf->send_flush = 1; // implement
mod->conf->send_dump = 0; // implement
mod->conf->nocomp_fs = 0; // buggy
mod->conf->smooth_windows = 0;
mod->conf->max_unmapped_pixels = 32 * 1024; // implement
mod->conf->max_unmapped_time = 10 * 3600; // implement
mod->conf->min_unmapped_time = 5 * 60; // implement
// FIXME: add some default matches
}
mod->conf->match.popups = NULL;
mod->conf->match.borders = NULL;
mod->conf->match.overrides = NULL;
mod->conf->match.menus = NULL;
if (!mod->conf->match.popups)
{
Match *m;
m = E_NEW(Match, 1);
mod->conf->match.popups = eina_list_append(mod->conf->match.popups, m);
m->name = eina_stringshare_add("shelf");
m->shadow_style = eina_stringshare_add("still");
m = E_NEW(Match, 1);
mod->conf->match.popups = eina_list_append(mod->conf->match.popups, m);
m->shadow_style = eina_stringshare_add("popup");
}
if (!mod->conf->match.borders)
{
// just fall abck to default ont
}
if (!mod->conf->match.overrides)
{
Match *m;
m = E_NEW(Match, 1);
mod->conf->match.overrides = eina_list_append(mod->conf->match.overrides, m);
m->name = eina_stringshare_add("E");
m->clas = eina_stringshare_add("Background_Window");
m->shadow_style = eina_stringshare_add("none");
m = E_NEW(Match, 1);
mod->conf->match.overrides = eina_list_append(mod->conf->match.overrides, m);
m->primary_type = ECORE_X_WINDOW_TYPE_DROPDOWN_MENU;
m->shadow_style = eina_stringshare_add("menu");
m = E_NEW(Match, 1);
mod->conf->match.overrides = eina_list_append(mod->conf->match.overrides, m);
m->primary_type = ECORE_X_WINDOW_TYPE_POPUP_MENU;
m->shadow_style = eina_stringshare_add("menu");
m = E_NEW(Match, 1);
mod->conf->match.overrides = eina_list_append(mod->conf->match.overrides, m);
m->primary_type = ECORE_X_WINDOW_TYPE_COMBO;
m->shadow_style = eina_stringshare_add("menu");
m = E_NEW(Match, 1);
mod->conf->match.overrides = eina_list_append(mod->conf->match.overrides, m);
m->primary_type = ECORE_X_WINDOW_TYPE_TOOLTIP;
m->shadow_style = eina_stringshare_add("menu");
m = E_NEW(Match, 1);
mod->conf->match.overrides = eina_list_append(mod->conf->match.overrides, m);
m->shadow_style = eina_stringshare_add("popup");
}
if (!mod->conf->match.menus)
{
Match *m;
m = E_NEW(Match, 1);
mod->conf->match.menus = eina_list_append(mod->conf->match.menus, m);
m->shadow_style = eina_stringshare_add("menu");
_e_mod_config_new(m);
}
_comp_mod = mod;
// if (e_init_count_get() <= 0)
// {
if (!e_mod_comp_init())
{
// FIXME: handle if comp init fails
}
// }
// else
// {
// init_done_handler = ecore_event_handler_add(E_EVENT_INIT_DONE,
// _e_init_done, NULL);
// }
if (!e_mod_comp_init())
{
// FIXME: handle if comp init fails
}
e_module_priority_set(m, -1000);
return mod;
}
void
_e_mod_config_new(E_Module *m)
{
Mod *mod = m->data;
Match *mat;
mod->conf = E_NEW(Config, 1);
mod->conf->use_shadow = 1;
mod->conf->shadow_file = NULL;
mod->conf->shadow_style = eina_stringshare_add("default");
mod->conf->engine = E_EVAS_ENGINE_SOFTWARE_X11;
mod->conf->indirect = 0;
mod->conf->texture_from_pixmap = 0;
mod->conf->lock_fps = 0;
mod->conf->efl_sync = 1;
mod->conf->loose_sync = 1;
mod->conf->grab = 0;
mod->conf->vsync = 1;
mod->conf->keep_unmapped = 1;
mod->conf->send_flush = 1; // implement
mod->conf->send_dump = 0; // implement
mod->conf->nocomp_fs = 0; // buggy
mod->conf->smooth_windows = 0;
mod->conf->max_unmapped_pixels = 32 * 1024; // implement
mod->conf->max_unmapped_time = 10 * 3600; // implement
mod->conf->min_unmapped_time = 5 * 60; // implement
mod->conf->match.popups = NULL;
mat = E_NEW(Match, 1);
mod->conf->match.popups = eina_list_append(mod->conf->match.popups, mat);
mat->name = eina_stringshare_add("shelf");
mat->shadow_style = eina_stringshare_add("still");
mat = E_NEW(Match, 1);
mod->conf->match.popups = eina_list_append(mod->conf->match.popups, mat);
mat->shadow_style = eina_stringshare_add("popup");
mod->conf->match.borders = NULL;
mod->conf->match.overrides = NULL;
mat = E_NEW(Match, 1);
mod->conf->match.overrides = eina_list_append(mod->conf->match.overrides, mat);
mat->name = eina_stringshare_add("E");
mat->clas = eina_stringshare_add("Background_Window");
mat->shadow_style = eina_stringshare_add("none");
mat = E_NEW(Match, 1);
mod->conf->match.overrides = eina_list_append(mod->conf->match.overrides, mat);
mat->primary_type = ECORE_X_WINDOW_TYPE_DROPDOWN_MENU;
mat->shadow_style = eina_stringshare_add("menu");
mat = E_NEW(Match, 1);
mod->conf->match.overrides = eina_list_append(mod->conf->match.overrides, mat);
mat->primary_type = ECORE_X_WINDOW_TYPE_POPUP_MENU;
mat->shadow_style = eina_stringshare_add("menu");
mat = E_NEW(Match, 1);
mod->conf->match.overrides = eina_list_append(mod->conf->match.overrides, mat);
mat->primary_type = ECORE_X_WINDOW_TYPE_COMBO;
mat->shadow_style = eina_stringshare_add("menu");
mat = E_NEW(Match, 1);
mod->conf->match.overrides = eina_list_append(mod->conf->match.overrides, mat);
mat->primary_type = ECORE_X_WINDOW_TYPE_TOOLTIP;
mat->shadow_style = eina_stringshare_add("menu");
mat = E_NEW(Match, 1);
mod->conf->match.overrides = eina_list_append(mod->conf->match.overrides, mat);
mat->shadow_style = eina_stringshare_add("popup");
mod->conf->match.menus = NULL;
mat = E_NEW(Match, 1);
mod->conf->match.menus = eina_list_append(mod->conf->match.menus, mat);
mat->shadow_style = eina_stringshare_add("menu");
}
static void
_match_list_free(Eina_List *list)
{
@ -209,6 +191,23 @@ _match_list_free(Eina_List *list)
}
}
void
_e_mod_config_free(E_Module *m)
{
Mod *mod = m->data;
if (mod->conf->shadow_file) eina_stringshare_del(mod->conf->shadow_file);
if (mod->conf->shadow_style) eina_stringshare_del(mod->conf->shadow_style);
_match_list_free(mod->conf->match.popups);
_match_list_free(mod->conf->match.borders);
_match_list_free(mod->conf->match.overrides);
_match_list_free(mod->conf->match.menus);
free(mod->conf);
mod->conf = NULL;
}
EAPI int
e_modapi_shutdown(E_Module *m)
{
@ -224,15 +223,8 @@ e_modapi_shutdown(E_Module *m)
e_object_del(E_OBJECT(mod->config_dialog));
mod->config_dialog = NULL;
}
if (mod->conf->shadow_file) eina_stringshare_del(mod->conf->shadow_file);
if (mod->conf->shadow_style) eina_stringshare_del(mod->conf->shadow_style);
_match_list_free(mod->conf->match.popups);
_match_list_free(mod->conf->match.borders);
_match_list_free(mod->conf->match.overrides);
_match_list_free(mod->conf->match.menus);
_e_mod_config_free(mod);
free(mod->conf);
E_CONFIG_DD_FREE(mod->conf_match_edd);
E_CONFIG_DD_FREE(mod->conf_edd);
free(mod);

View File

@ -76,4 +76,7 @@ EAPI int e_modapi_shutdown (E_Module *m);
EAPI int e_modapi_save (E_Module *m);
EAPI int e_modapi_info (E_Module *m);
void _e_mod_config_new(E_Module *m);
void _e_mod_config_free(E_Module *m);
#endif