1 /* Ask about compositing */
3 #include "e_mod_main.h"
4 #include "e_mod_comp_cfdata.h"
6 static int do_comp = 1;
8 static int do_vsync = 0;
11 match_file_glob(FILE *f, const char *glob)
16 while (fgets(buf, sizeof(buf), f))
18 if (e_util_glob_match(buf, glob))
29 match_xorg_log(const char *glob)
35 for (i = 0; i < 5; i++)
37 snprintf(buf, sizeof(buf), "/var/log/Xorg.%i.log", i);
41 if (match_file_glob(f, glob)) return 1;
48 wizard_page_init(E_Wizard_Page *pg __UNUSED__)
54 wizard_page_shutdown(E_Wizard_Page *pg __UNUSED__)
60 wizard_page_show(E_Wizard_Page *pg)
62 Evas_Object *o, *of, *ob;
64 Ecore_X_Window_Attributes att;
66 if (!ecore_x_composite_query()) return 0;
67 if (!ecore_x_damage_query()) return 0;
69 memset((&att), 0, sizeof(Ecore_X_Window_Attributes));
70 ecore_x_window_attributes_get(ecore_x_window_root_first_get(), &att);
71 if ((att.depth != 24) && (att.depth != 32)) return 0;
73 ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 320, 240);
78 (match_xorg_log("*(II)*NVIDIA*: Creating default Display*")) ||
79 (match_xorg_log("*(II)*intel*: Creating default Display*")) ||
80 (match_xorg_log("*(II)*NOUVEAU*: Creating default Display*")) ||
81 (match_xorg_log("*(II)*RADEON*: Creating default Display*"))
89 o = e_widget_list_add(pg->evas, 1, 0);
90 e_wizard_title_set(_("Compositing"));
92 of = e_widget_framelist_add(pg->evas, _("Transparent windows and effects"), 0);
94 ob = e_widget_textblock_add(pg->evas);
95 e_widget_size_min_set(ob, 200 * e_scale, 180 * e_scale);
96 e_widget_textblock_markup_set
98 _("Compositing provides translucency<br>"
99 "for windows, window effects like<br>"
100 "fading in and out and zooming<br>"
101 "when they appear and dissapear.<br>"
102 "It is highly recommended to<br>"
103 "enable this for a better<br>"
104 "experience, but it comes at a<br>"
105 "cost. It requires extra CPU<br>"
106 "or a GLSL Shader capable GPU<br>"
107 "with well written drivers.<br>"
108 "It also will add between 10 to<br>"
109 "100 MB to the memory needed<br>"
113 e_widget_framelist_object_append(of, ob);
115 ob = e_widget_check_add(pg->evas, _("Enable Compositing"), &(do_comp));
116 e_widget_framelist_object_append(of, ob);
118 if (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_OPENGL_X11))
120 ob = e_widget_check_add(pg->evas, _("Hardware Accelerated (OpenGL)"), &(do_gl));
121 e_widget_framelist_object_append(of, ob);
123 ob = e_widget_check_add(pg->evas, _("Tear-free Rendering (OpenGL only)"), &(do_vsync));
124 e_widget_framelist_object_append(of, ob);
127 e_widget_list_object_append(o, of, 0, 0, 0.5);
129 evas_object_show(of);
131 e_wizard_page_show(o);
133 return 1; /* 1 == show ui, and wait for user, 0 == just continue */
137 wizard_page_hide(E_Wizard_Page *pg __UNUSED__)
144 EINA_LIST_FOREACH(e_config->modules, l, em)
146 if (!em->name) continue;
147 if (!strcmp(em->name, "comp"))
149 e_config->modules = eina_list_remove_list
150 (e_config->modules, l);
151 if (em->name) eina_stringshare_del(em->name);
156 e_config->use_composite = 0;
162 E_Config_DD *conf_edd = NULL;
163 E_Config_DD *conf_match_edd = NULL;
166 EINA_LIST_FOREACH(e_config->modules, l, em)
168 if (!em->name) continue;
169 if (!strcmp(em->name, "dropshadow"))
171 e_config->modules = eina_list_remove_list
172 (e_config->modules, l);
173 if (em->name) eina_stringshare_del(em->name);
179 e_config->use_composite = 1;
181 e_mod_comp_cfdata_edd_init(&(conf_edd), &(conf_match_edd));
182 cfg = e_mod_comp_cfdata_config_new();
186 cfg->engine = E_EVAS_ENGINE_GL_X11;
187 cfg->smooth_windows = 1;
188 cfg->vsync = do_vsync;
192 cfg->engine = E_EVAS_ENGINE_SOFTWARE_X11;
193 cfg->smooth_windows = 0;
197 e_config_domain_save("module.comp", conf_edd, cfg);
198 E_CONFIG_DD_FREE(conf_match_edd);
199 E_CONFIG_DD_FREE(conf_edd);
201 e_config_save_queue();
202 // if (pg->data) evas_object_del(pg->data);
207 wizard_page_apply(E_Wizard_Page *pg __UNUSED__)