diff --git a/src/bin/e_comp.c b/src/bin/e_comp.c index faab25ef7..fc8b97331 100644 --- a/src/bin/e_comp.c +++ b/src/bin/e_comp.c @@ -166,6 +166,8 @@ static E_Comp_Config *conf = NULL; static E_Config_DD *conf_edd = NULL; static E_Config_DD *conf_match_edd = NULL; +static Eina_Inlist *cfg_opts = NULL; + ////////////////////////////////////////////////////////////////////////// #undef DBG #if 0 @@ -4051,6 +4053,74 @@ _e_comp_sys_resume(void) EINA_FALSE); } +static Eina_List * +_e_comp_engine_info_cb(E_Configure_Option *co) +{ + Eina_List *ret = NULL; + E_Configure_Option_Info *oi; + int x; + const char *name[] = + { + "Software", + NULL + }; + +#define ENGINE_SW 1 +#define ENGINE_GL 2 + if (!getenv("ECORE_X_NO_XLIB")) + { + if (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_OPENGL_X11)) + { + name[1] = "OpenGL"; + } + } + + for (x = ENGINE_SW; x <= ENGINE_GL; x++) + { + if (!name[x - 1]) continue; + oi = e_configure_option_info_new(co, _(name[x - 1]), (intptr_t*)(long)x); + oi->current = (*(int*)co->valptr == x); + ret = eina_list_append(ret, oi); + } + return ret; +} + +static void +_e_comp_cfg_init(void) +{ + E_Configure_Option *co; + + E_CONFIGURE_OPTION_ADD(co, BOOL, vsync, conf, _("Tear-free compositing (VSYNC)"), _("composite"), _("border")); + co->requires_restart = 1; + cfg_opts = eina_inlist_append(cfg_opts, EINA_INLIST_GET(co)); + E_CONFIGURE_OPTION_ADD(co, BOOL, match.disable_borders, conf, _("Disable composite effects for windows"), _("composite"), _("border"), _("theme"), _("animate")); + co->funcs[1].none = co->funcs[0].none = e_comp_shadows_reset; + cfg_opts = eina_inlist_append(cfg_opts, EINA_INLIST_GET(co)); + E_CONFIGURE_OPTION_ADD(co, BOOL, match.disable_menus, conf, _("Disable composite effects for menus"), _("composite"), _("menu"), _("theme"), _("animate")); + co->funcs[1].none = co->funcs[0].none = e_comp_shadows_reset; + cfg_opts = eina_inlist_append(cfg_opts, EINA_INLIST_GET(co)); + E_CONFIGURE_OPTION_ADD(co, BOOL, match.disable_popups, conf, _("Disable composite effects for popups"), _("composite"), _("popup"), _("theme"), _("animate")); + co->funcs[1].none = co->funcs[0].none = e_comp_shadows_reset; + cfg_opts = eina_inlist_append(cfg_opts, EINA_INLIST_GET(co)); + E_CONFIGURE_OPTION_ADD(co, BOOL, match.disable_overrides, conf, _("Disable composite effects for override-redirect windows (tooltips and such)"), _("composite"), _("theme"), _("animate")); + co->funcs[1].none = co->funcs[0].none = e_comp_shadows_reset; + cfg_opts = eina_inlist_append(cfg_opts, EINA_INLIST_GET(co)); + E_CONFIGURE_OPTION_ADD(co, BOOL, smooth_windows, conf, _("Smooth scaling of composited window content"), _("composite"), _("border")); + co->funcs[1].none = co->funcs[0].none = e_comp_shadows_reset; + cfg_opts = eina_inlist_append(cfg_opts, EINA_INLIST_GET(co)); + E_CONFIGURE_OPTION_ADD(co, BOOL, nocomp_fs, conf, _("Don't composite fullscreen windows"), _("composite"), _("border")); + co->funcs[1].none = co->funcs[0].none = e_comp_shadows_reset; + cfg_opts = eina_inlist_append(cfg_opts, EINA_INLIST_GET(co)); + E_CONFIGURE_OPTION_ADD(co, ENUM, engine, conf, _("Compositing engine"), _("composite"), _("border")); + co->info_cb = _e_comp_engine_info_cb; + co->requires_restart = 1; + cfg_opts = eina_inlist_append(cfg_opts, EINA_INLIST_GET(co)); + + e_configure_option_category_tag_add(_("windows"), _("composite")); + e_configure_option_category_tag_add(_("composite"), _("composite")); + e_configure_option_category_icon_set(_("composite"), "preferences-composite"); +} + ////////////////////////////////////////////////////////////////////////// EINTERN Eina_Bool @@ -4143,7 +4213,7 @@ e_comp_init(void) if (!e_comp_wl_init()) EINA_LOG_ERR("Failed to initialize Wayland Client Support !!\n"); #endif - + _e_comp_cfg_init(); EINA_LIST_FOREACH(e_manager_list(), l, man) { E_Comp *c; @@ -4175,6 +4245,10 @@ e_comp_shutdown(void) e_comp_wl_shutdown(); #endif + E_CONFIGURE_OPTION_LIST_CLEAR(cfg_opts); + e_configure_option_category_tag_del(_("composite"), _("composite")); + e_configure_option_category_tag_del(_("windows"), _("composite")); + e_comp_cfdata_config_free(conf); E_CONFIG_DD_FREE(conf_match_edd); E_CONFIG_DD_FREE(conf_edd); diff --git a/src/bin/e_configure_option.h b/src/bin/e_configure_option.h index 92e12a27f..3e8346b3b 100644 --- a/src/bin/e_configure_option.h +++ b/src/bin/e_configure_option.h @@ -23,6 +23,9 @@ typedef Evas_Object *(*E_Configure_Option_Info_Thumb_Cb)(E_Configure_Option_Info #define E_CONFIGURE_OPTION_ADD(OPT, TYPE, NAME, CFGPTR, DESC, ...) \ OPT = e_configure_option_add(E_CONFIGURE_OPTION_TYPE_##TYPE, DESC, #NAME, EINA_TRUE, &CFGPTR->NAME, NULL);\ e_configure_option_tags_set(OPT, (const char*[]){__VA_ARGS__, NULL}, 0) +#define E_CONFIGURE_OPTION_ADD_CUSTOM(OPT, NAME, DESC, ...) \ + OPT = e_configure_option_add(E_CONFIGURE_OPTION_TYPE_CUSTOM, DESC, NAME, EINA_TRUE, NULL, NULL);\ + e_configure_option_tags_set(OPT, (const char*[]){__VA_ARGS__, NULL}, 0) #define E_CONFIGURE_OPTION_HELP(OPT, STR) \ OPT->help = eina_stringshare_add(_(STR)) #define E_CONFIGURE_OPTION_MINMAX_STEP_FMT(OPT, MIN, MAX, STEP, FMT) \ diff --git a/src/modules/conf_comp/e_mod_main.c b/src/modules/conf_comp/e_mod_main.c index 966fdc489..35b50aa8d 100644 --- a/src/modules/conf_comp/e_mod_main.c +++ b/src/modules/conf_comp/e_mod_main.c @@ -4,8 +4,8 @@ #include "e_comp.h" #include "e_comp_cfdata.h" -static Eina_Inlist *cfg_opts = NULL; static E_Int_Menu_Augmentation *maug = NULL; +static Eina_Inlist *cfg_opts = NULL; /* module private routines */ EINTERN Mod *_comp_mod = NULL; @@ -17,36 +17,6 @@ EAPI E_Module_Api e_modapi = "Composite Settings" }; -static Eina_List * -_e_mod_engine_info_cb(E_Configure_Option *co) -{ - Eina_List *ret = NULL; - E_Configure_Option_Info *oi; - int x; - const char *name[] = - { - "Software", - NULL - }; - - if (!getenv("ECORE_X_NO_XLIB")) - { - if (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_OPENGL_X11)) - { - name[1] = "OpenGL"; - } - } - - for (x = ENGINE_SW; x <= ENGINE_GL; x++) - { - if (!name[x - 1]) continue; - oi = e_configure_option_info_new(co, _(name[x - 1]), (intptr_t*)(long)x); - oi->current = (*(int*)co->valptr == x); - ret = eina_list_append(ret, oi); - } - return ret; -} - static void _e_mod_comp_conf_cb(void *data __UNUSED__, E_Menu *m EINA_UNUSED, E_Menu_Item *mi __UNUSED__) { @@ -104,48 +74,18 @@ e_modapi_init(E_Module *m) mod->conf->first_draw_delay = 0.20; _comp_mod = mod; - - e_module_delayed_set(m, 0); - e_module_priority_set(m, -1000); - { E_Configure_Option *co; - E_CONFIGURE_OPTION_ADD(co, CUSTOM, engine, mod->conf, _("Composite settings panel"), _("composite"), _("border")); + E_CONFIGURE_OPTION_ADD_CUSTOM(co, _("settings"), _("Composite settings panel"), _("composite"), _("border")); co->info = eina_stringshare_add("appearance/comp"); - E_CONFIGURE_OPTION_ICON(co, buf); + E_CONFIGURE_OPTION_ICON(co, "preferences-composite"); cfg_opts = eina_inlist_append(cfg_opts, EINA_INLIST_GET(co)); - E_CONFIGURE_OPTION_ADD(co, BOOL, vsync, mod->conf, _("Tear-free compositing (VSYNC)"), _("composite"), _("border")); - co->requires_restart = 1; - cfg_opts = eina_inlist_append(cfg_opts, EINA_INLIST_GET(co)); - E_CONFIGURE_OPTION_ADD(co, BOOL, match.disable_borders, mod->conf, _("Disable composite effects for windows"), _("composite"), _("border"), _("theme"), _("animate")); - co->funcs[1].none = co->funcs[0].none = e_comp_shadows_reset; - cfg_opts = eina_inlist_append(cfg_opts, EINA_INLIST_GET(co)); - E_CONFIGURE_OPTION_ADD(co, BOOL, match.disable_menus, mod->conf, _("Disable composite effects for menus"), _("composite"), _("menu"), _("theme"), _("animate")); - co->funcs[1].none = co->funcs[0].none = e_comp_shadows_reset; - cfg_opts = eina_inlist_append(cfg_opts, EINA_INLIST_GET(co)); - E_CONFIGURE_OPTION_ADD(co, BOOL, match.disable_popups, mod->conf, _("Disable composite effects for popups"), _("composite"), _("popup"), _("theme"), _("animate")); - co->funcs[1].none = co->funcs[0].none = e_comp_shadows_reset; - cfg_opts = eina_inlist_append(cfg_opts, EINA_INLIST_GET(co)); - E_CONFIGURE_OPTION_ADD(co, BOOL, match.disable_overrides, mod->conf, _("Disable composite effects for override-redirect windows (tooltips and such)"), _("composite"), _("theme"), _("animate")); - co->funcs[1].none = co->funcs[0].none = e_comp_shadows_reset; - cfg_opts = eina_inlist_append(cfg_opts, EINA_INLIST_GET(co)); - E_CONFIGURE_OPTION_ADD(co, BOOL, smooth_windows, mod->conf, _("Smooth scaling of composited window content"), _("composite"), _("border")); - co->funcs[1].none = co->funcs[0].none = e_comp_shadows_reset; - cfg_opts = eina_inlist_append(cfg_opts, EINA_INLIST_GET(co)); - E_CONFIGURE_OPTION_ADD(co, BOOL, nocomp_fs, mod->conf, _("Don't composite fullscreen windows"), _("composite"), _("border")); - co->funcs[1].none = co->funcs[0].none = e_comp_shadows_reset; - cfg_opts = eina_inlist_append(cfg_opts, EINA_INLIST_GET(co)); - E_CONFIGURE_OPTION_ADD(co, ENUM, engine, mod->conf, _("Compositing engine"), _("composite"), _("border")); - co->info_cb = _e_mod_engine_info_cb; - co->requires_restart = 1; - cfg_opts = eina_inlist_append(cfg_opts, EINA_INLIST_GET(co)); - - e_configure_option_category_tag_add(_("windows"), _("composite")); - e_configure_option_category_tag_add(_("composite"), _("composite")); - e_configure_option_category_icon_set(_("composite"), buf); } + e_module_delayed_set(m, 0); + e_module_priority_set(m, -1000); + return mod; } @@ -163,11 +103,8 @@ e_modapi_shutdown(E_Module *m) mod->config_dialog = NULL; } - E_CONFIGURE_OPTION_LIST_CLEAR(cfg_opts); - e_configure_option_category_tag_del(_("composite"), _("composite")); - e_configure_option_category_tag_del(_("windows"), _("composite")); - free(mod); + E_CONFIGURE_OPTION_LIST_CLEAR(cfg_opts); if (maug) {