forked from enlightenment/enlightenment
170 lines
4.9 KiB
C
170 lines
4.9 KiB
C
#include "e.h"
|
|
#include "e_mod_main.h"
|
|
#include "e_mod_config.h"
|
|
#include "e_comp.h"
|
|
#include "e_comp_cfdata.h"
|
|
|
|
static Eina_Inlist *cfg_opts = NULL;
|
|
static E_Int_Menu_Augmentation *maug = NULL;
|
|
|
|
/* module private routines */
|
|
EINTERN Mod *_comp_mod = NULL;
|
|
|
|
/* public module routines. all modules must have these */
|
|
EAPI E_Module_Api e_modapi =
|
|
{
|
|
E_MODULE_API_VERSION,
|
|
"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__)
|
|
{
|
|
e_int_config_comp_module(NULL, NULL);
|
|
}
|
|
|
|
static void
|
|
_e_mod_config_menu_create(void *d EINA_UNUSED, E_Menu *m)
|
|
{
|
|
E_Menu_Item *mi;
|
|
char buf[4096];
|
|
|
|
mi = e_menu_item_new(m);
|
|
snprintf(buf, sizeof(buf), "%s/e-module-comp.edj", e_module_dir_get(_comp_mod->module));
|
|
e_menu_item_label_set(mi, _("Composite"));
|
|
e_menu_item_icon_file_set(mi, buf);
|
|
e_menu_item_callback_set(mi, _e_mod_comp_conf_cb, NULL);
|
|
}
|
|
|
|
EAPI void *
|
|
e_modapi_init(E_Module *m)
|
|
{
|
|
Mod *mod;
|
|
char buf[4096];
|
|
E_Comp_Config *conf;
|
|
|
|
conf = e_comp_config_get();
|
|
if (!conf)
|
|
{
|
|
EINA_LOG_CRIT("COMP CONFIG MISSING!!!! ARGH!");
|
|
return NULL;
|
|
}
|
|
|
|
mod = calloc(1, sizeof(Mod));
|
|
m->data = mod;
|
|
|
|
mod->module = m;
|
|
snprintf(buf, sizeof(buf), "%s/e-module-comp.edj", e_module_dir_get(m));
|
|
e_configure_registry_category_add("appearance", 10, _("Look"), NULL,
|
|
"preferences-look");
|
|
e_configure_registry_item_add("appearance/comp", 120, _("Composite"), NULL,
|
|
buf, e_int_config_comp_module);
|
|
|
|
mod->conf = conf;
|
|
maug = e_int_menus_menu_augmentation_add_sorted("config/1", _("Composite"), _e_mod_config_menu_create, NULL, NULL, NULL);
|
|
mod->conf->max_unmapped_pixels = 32 * 1024;
|
|
mod->conf->keep_unmapped = 1;
|
|
|
|
/* force some config vals off */
|
|
mod->conf->lock_fps = 0;
|
|
mod->conf->indirect = 0;
|
|
|
|
/* XXX: update old configs. add config versioning */
|
|
if (mod->conf->first_draw_delay == 0)
|
|
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"));
|
|
co->info = eina_stringshare_add("appearance/comp");
|
|
E_CONFIGURE_OPTION_ICON(co, buf);
|
|
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, smooth_windows, mod->conf, _("Smooth scaling of composited window content"), _("composite"), _("border"));
|
|
co->funcs[1].none = co->funcs[0].none = e_comp_shadow_set;
|
|
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_shadow_set;
|
|
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);
|
|
}
|
|
|
|
return mod;
|
|
}
|
|
|
|
EAPI int
|
|
e_modapi_shutdown(E_Module *m)
|
|
{
|
|
Mod *mod = m->data;
|
|
|
|
e_configure_registry_item_del("appearance/comp");
|
|
e_configure_registry_category_del("appearance");
|
|
|
|
if (mod->config_dialog)
|
|
{
|
|
e_object_del(E_OBJECT(mod->config_dialog));
|
|
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);
|
|
|
|
if (maug)
|
|
{
|
|
e_int_menus_menu_augmentation_del("config/1", maug);
|
|
maug = NULL;
|
|
}
|
|
|
|
if (mod == _comp_mod) _comp_mod = NULL;
|
|
|
|
return 1;
|
|
}
|