2 #include "e_mod_main.h"
3 #include "e_mod_config.h"
4 #include "e_mod_comp.h"
6 //static Ecore_Event_Handler *init_done_handler = NULL;
9 //_e_init_done(void *data, int type, void *event)
11 // ecore_event_handler_del(init_done_handler);
12 // init_done_handler = NULL;
13 // if (!e_mod_comp_init())
15 // // FIXME: handle if comp init fails
20 /* module private routines */
21 Mod *_comp_mod = NULL;
23 /* public module routines. all modules must have these */
24 EAPI E_Module_Api e_modapi =
31 e_modapi_init(E_Module *m)
36 mod = calloc(1, sizeof(Mod));
40 snprintf(buf, sizeof(buf), "%s/e-module-comp.edj", e_module_dir_get(m));
41 e_configure_registry_category_add("appearance", 10, _("Look"), NULL,
43 e_configure_registry_item_add("appearance/comp", 120, _("Composite"), NULL,
44 buf, e_int_config_comp_module);
46 mod->conf_match_edd = E_CONFIG_DD_NEW("Comp_Match", Match);
50 #define D mod->conf_match_edd
51 E_CONFIG_VAL(D, T, title, STR);
52 E_CONFIG_VAL(D, T, name, STR);
53 E_CONFIG_VAL(D, T, clas, STR);
54 E_CONFIG_VAL(D, T, role, STR);
55 E_CONFIG_VAL(D, T, primary_type, INT);
56 E_CONFIG_VAL(D, T, borderless, CHAR);
57 E_CONFIG_VAL(D, T, dialog, CHAR);
58 E_CONFIG_VAL(D, T, accepts_focus, CHAR);
59 E_CONFIG_VAL(D, T, vkbd, CHAR);
60 E_CONFIG_VAL(D, T, quickpanel, CHAR);
61 E_CONFIG_VAL(D, T, argb, CHAR);
62 E_CONFIG_VAL(D, T, fullscreen, CHAR);
63 E_CONFIG_VAL(D, T, modal, CHAR);
64 E_CONFIG_VAL(D, T, shadow_style, STR);
66 mod->conf_edd = E_CONFIG_DD_NEW("Comp_Config", Config);
70 #define D mod->conf_edd
71 E_CONFIG_VAL(D, T, shadow_file, STR);
72 E_CONFIG_VAL(D, T, shadow_style, STR);
73 E_CONFIG_VAL(D, T, engine, INT);
74 E_CONFIG_VAL(D, T, max_unmapped_pixels, INT);
75 E_CONFIG_VAL(D, T, max_unmapped_time, INT);
76 E_CONFIG_VAL(D, T, min_unmapped_time, INT);
77 E_CONFIG_VAL(D, T, fps_average_range, INT);
78 E_CONFIG_VAL(D, T, fps_corner, UCHAR);
79 E_CONFIG_VAL(D, T, fps_show, UCHAR);
80 E_CONFIG_VAL(D, T, use_shadow, UCHAR);
81 E_CONFIG_VAL(D, T, indirect, UCHAR);
82 E_CONFIG_VAL(D, T, texture_from_pixmap, UCHAR);
83 E_CONFIG_VAL(D, T, lock_fps, UCHAR);
84 E_CONFIG_VAL(D, T, efl_sync, UCHAR);
85 E_CONFIG_VAL(D, T, loose_sync, UCHAR);
86 E_CONFIG_VAL(D, T, grab, UCHAR);
87 E_CONFIG_VAL(D, T, vsync, UCHAR);
88 E_CONFIG_VAL(D, T, keep_unmapped, UCHAR);
89 E_CONFIG_VAL(D, T, send_flush, UCHAR);
90 E_CONFIG_VAL(D, T, send_dump, UCHAR);
91 E_CONFIG_VAL(D, T, nocomp_fs, UCHAR);
92 E_CONFIG_VAL(D, T, smooth_windows, UCHAR);
93 E_CONFIG_VAL(D, T, first_draw_delay, DOUBLE);
94 E_CONFIG_LIST(D, T, match.popups, mod->conf_match_edd);
95 E_CONFIG_LIST(D, T, match.borders, mod->conf_match_edd);
96 E_CONFIG_LIST(D, T, match.overrides, mod->conf_match_edd);
97 E_CONFIG_LIST(D, T, match.menus, mod->conf_match_edd);
99 mod->conf = e_config_domain_load("module.comp", mod->conf_edd);
100 if (!mod->conf) _e_mod_config_new(m);
102 if (!e_config->use_composite)
104 e_config->use_composite = 1;
105 e_config_save_queue();
108 /* XXX: disabled dropshadow module when comp is running */
112 EINA_LIST_FOREACH(e_module_list(), l, m2)
114 if (m2->enabled && (!strcmp(m2->name, "dropshadow")))
115 e_module_disable(m2);
119 /* XXX: update old configs. add config versioning */
120 if (mod->conf->first_draw_delay == 0)
121 mod->conf->first_draw_delay = 0.05;
125 if (!e_mod_comp_init())
127 // FIXME: handle if comp init fails
130 e_module_delayed_set(m, 0);
131 e_module_priority_set(m, -1000);
136 _e_mod_config_new(E_Module *m)
141 mod->conf = E_NEW(Config, 1);
142 mod->conf->shadow_file = NULL;
143 mod->conf->shadow_style = eina_stringshare_add("default");
144 mod->conf->engine = E_EVAS_ENGINE_SOFTWARE_X11;
145 mod->conf->max_unmapped_pixels = 32 * 1024; // implement
146 mod->conf->max_unmapped_time = 10 * 3600; // implement
147 mod->conf->min_unmapped_time = 5 * 60; // implement
148 mod->conf->fps_average_range = 30;
149 mod->conf->fps_corner = 0;
150 mod->conf->fps_show = 0;
151 mod->conf->use_shadow = 1;
152 mod->conf->indirect = 0;
153 mod->conf->texture_from_pixmap = 0;
154 mod->conf->lock_fps = 0;
155 mod->conf->efl_sync = 1;
156 mod->conf->loose_sync = 1;
158 mod->conf->vsync = 1;
159 mod->conf->keep_unmapped = 1;
160 mod->conf->send_flush = 1; // implement
161 mod->conf->send_dump = 0; // implement
162 mod->conf->nocomp_fs = 0; // buggy
163 mod->conf->smooth_windows = 0;
164 mod->conf->first_draw_delay = 0.05;
166 mod->conf->match.popups = NULL;
167 mat = E_NEW(Match, 1);
168 mod->conf->match.popups = eina_list_append(mod->conf->match.popups, mat);
169 mat->name = eina_stringshare_add("shelf");
170 mat->shadow_style = eina_stringshare_add("still");
171 mat = E_NEW(Match, 1);
172 mod->conf->match.popups = eina_list_append(mod->conf->match.popups, mat);
173 mat->shadow_style = eina_stringshare_add("popup");
175 mod->conf->match.borders = NULL;
177 mod->conf->match.overrides = NULL;
178 mat = E_NEW(Match, 1);
179 mod->conf->match.overrides = eina_list_append(mod->conf->match.overrides, mat);
180 mat->name = eina_stringshare_add("E");
181 mat->clas = eina_stringshare_add("Background_Window");
182 mat->shadow_style = eina_stringshare_add("none");
183 mat = E_NEW(Match, 1);
184 mod->conf->match.overrides = eina_list_append(mod->conf->match.overrides, mat);
185 mat->name = eina_stringshare_add("E");
186 mat->clas = eina_stringshare_add("everything");
187 mat->shadow_style = eina_stringshare_add("everything");
188 mat = E_NEW(Match, 1);
189 mod->conf->match.overrides = eina_list_append(mod->conf->match.overrides, mat);
190 mat->primary_type = ECORE_X_WINDOW_TYPE_DROPDOWN_MENU;
191 mat->shadow_style = eina_stringshare_add("menu");
192 mat = E_NEW(Match, 1);
193 mod->conf->match.overrides = eina_list_append(mod->conf->match.overrides, mat);
194 mat->primary_type = ECORE_X_WINDOW_TYPE_POPUP_MENU;
195 mat->shadow_style = eina_stringshare_add("menu");
196 mat = E_NEW(Match, 1);
197 mod->conf->match.overrides = eina_list_append(mod->conf->match.overrides, mat);
198 mat->primary_type = ECORE_X_WINDOW_TYPE_COMBO;
199 mat->shadow_style = eina_stringshare_add("menu");
200 mat = E_NEW(Match, 1);
201 mod->conf->match.overrides = eina_list_append(mod->conf->match.overrides, mat);
202 mat->primary_type = ECORE_X_WINDOW_TYPE_TOOLTIP;
203 mat->shadow_style = eina_stringshare_add("menu");
204 mat = E_NEW(Match, 1);
205 mod->conf->match.overrides = eina_list_append(mod->conf->match.overrides, mat);
206 mat->shadow_style = eina_stringshare_add("popup");
208 mod->conf->match.menus = NULL;
209 mat = E_NEW(Match, 1);
210 mod->conf->match.menus = eina_list_append(mod->conf->match.menus, mat);
211 mat->shadow_style = eina_stringshare_add("menu");
215 _match_list_free(Eina_List *list)
219 EINA_LIST_FREE(list, m)
221 if (m->title) eina_stringshare_del(m->title);
222 if (m->name) eina_stringshare_del(m->name);
223 if (m->clas) eina_stringshare_del(m->clas);
224 if (m->role) eina_stringshare_del(m->role);
225 if (m->shadow_style) eina_stringshare_del(m->shadow_style);
231 _e_mod_config_free(E_Module *m)
235 if (mod->conf->shadow_file) eina_stringshare_del(mod->conf->shadow_file);
236 if (mod->conf->shadow_style) eina_stringshare_del(mod->conf->shadow_style);
238 _match_list_free(mod->conf->match.popups);
239 _match_list_free(mod->conf->match.borders);
240 _match_list_free(mod->conf->match.overrides);
241 _match_list_free(mod->conf->match.menus);
248 e_modapi_shutdown(E_Module *m)
252 e_mod_comp_shutdown();
254 e_configure_registry_item_del("appearance/comp");
255 e_configure_registry_category_del("appearance");
257 if (mod->config_dialog)
259 e_object_del(E_OBJECT(mod->config_dialog));
260 mod->config_dialog = NULL;
262 _e_mod_config_free(m);
264 E_CONFIG_DD_FREE(mod->conf_match_edd);
265 E_CONFIG_DD_FREE(mod->conf_edd);
268 if (mod == _comp_mod) _comp_mod = NULL;
274 e_modapi_save(E_Module *m)
277 e_config_domain_save("module.comp", mod->conf_edd, mod->conf);