tizen 2.4 release
[framework/uifw/e17-mod-tizen-comp.git] / src / e_mod_comp_cfdata.c
1 #include "e.h"
2 #include "e_mod_main.h"
3 #include "e_mod_comp_cfdata.h"
4
5 EAPI void
6 e_mod_comp_cfdata_edd_init(E_Config_DD **conf_edd, E_Config_DD **match_edd)
7 {
8    *match_edd = E_CONFIG_DD_NEW("Comp_Match", Match);
9 #undef T
10 #undef D
11 #define T Match
12 #define D *match_edd
13    E_CONFIG_VAL(D, T, title, STR);
14    E_CONFIG_VAL(D, T, name, STR);
15    E_CONFIG_VAL(D, T, clas, STR);
16    E_CONFIG_VAL(D, T, role, STR);
17    E_CONFIG_VAL(D, T, primary_type, INT);
18    E_CONFIG_VAL(D, T, borderless, CHAR);
19    E_CONFIG_VAL(D, T, dialog, CHAR);
20    E_CONFIG_VAL(D, T, accepts_focus, CHAR);
21    E_CONFIG_VAL(D, T, vkbd, CHAR);
22    E_CONFIG_VAL(D, T, quickpanel, CHAR);
23    E_CONFIG_VAL(D, T, argb, CHAR);
24    E_CONFIG_VAL(D, T, fullscreen, CHAR);
25    E_CONFIG_VAL(D, T, modal, CHAR);
26    E_CONFIG_VAL(D, T, shadow_style, STR);
27
28    *conf_edd = E_CONFIG_DD_NEW("Comp_Config", Config);
29 #undef T
30 #undef D
31 #define T Config
32 #define D *conf_edd
33    E_CONFIG_VAL(D, T, shadow_file, STR);
34    E_CONFIG_VAL(D, T, shadow_style, STR);
35    E_CONFIG_VAL(D, T, effect_file, STR);
36    E_CONFIG_VAL(D, T, hwcomp_file, STR);
37    E_CONFIG_VAL(D, T, engine, INT);
38    E_CONFIG_VAL(D, T, max_unmapped_pixels, INT);
39    E_CONFIG_VAL(D, T, max_unmapped_time, INT);
40    E_CONFIG_VAL(D, T, min_unmapped_time, INT);
41    E_CONFIG_VAL(D, T, fps_average_range, INT);
42    E_CONFIG_VAL(D, T, fps_corner, UCHAR);
43    E_CONFIG_VAL(D, T, fps_show, UCHAR);
44    E_CONFIG_VAL(D, T, use_shadow, UCHAR);
45    E_CONFIG_VAL(D, T, indirect, UCHAR);
46    E_CONFIG_VAL(D, T, texture_from_pixmap, UCHAR);
47    E_CONFIG_VAL(D, T, lock_fps, UCHAR);
48    E_CONFIG_VAL(D, T, loose_sync, UCHAR);
49    E_CONFIG_VAL(D, T, efl_sync, UCHAR);
50    E_CONFIG_VAL(D, T, grab, UCHAR);
51    E_CONFIG_VAL(D, T, vsync, UCHAR);
52    E_CONFIG_VAL(D, T, keep_unmapped, UCHAR);
53    E_CONFIG_VAL(D, T, send_flush, UCHAR);
54    E_CONFIG_VAL(D, T, send_dump, UCHAR);
55    E_CONFIG_VAL(D, T, nocomp_fs, UCHAR);
56    E_CONFIG_VAL(D, T, use_hwc, UCHAR);
57    E_CONFIG_VAL(D, T, smooth_windows, UCHAR);
58    E_CONFIG_VAL(D, T, first_draw_delay, DOUBLE);
59    E_CONFIG_VAL(D, T, canvas_per_zone, UCHAR);
60    E_CONFIG_VAL(D, T, use_lock_screen, UCHAR);
61    E_CONFIG_VAL(D, T, default_window_effect, UCHAR);
62    E_CONFIG_VAL(D, T, keyboard_effect, UCHAR);
63    E_CONFIG_VAL(D, T, xv_rotation_effect, UCHAR);
64    E_CONFIG_VAL(D, T, fake_image_launch, UCHAR);
65    E_CONFIG_VAL(D, T, fake_launch_layer, INT);
66    E_CONFIG_VAL(D, T, lower_layer, INT);
67    E_CONFIG_VAL(D, T, defer_raise_effect, UCHAR);
68    E_CONFIG_VAL(D, T, max_lock_screen_time, DOUBLE);
69    E_CONFIG_VAL(D, T, damage_timeout, DOUBLE);
70    E_CONFIG_VAL(D, T, nocomp_begin_timeout, DOUBLE);
71    E_CONFIG_VAL(D, T, use_hw_ov, UCHAR);
72    E_CONFIG_VAL(D, T, debug_info_show, UCHAR);
73    E_CONFIG_VAL(D, T, max_debug_msgs, INT);
74    E_CONFIG_VAL(D, T, debug_type_nocomp, UCHAR);
75    E_CONFIG_VAL(D, T, debug_type_swap, UCHAR);
76    E_CONFIG_VAL(D, T, debug_type_effect, UCHAR);
77    E_CONFIG_VAL(D, T, use_efl_native_surface, UCHAR);
78    E_CONFIG_VAL(D, T, stand_by_canvas_render_enable, UCHAR);
79    E_CONFIG_VAL(D, T, effect_policy_unknown, STR);
80    E_CONFIG_VAL(D, T, effect_policy_desktop, STR);
81    E_CONFIG_VAL(D, T, effect_policy_dock, STR);
82    E_CONFIG_VAL(D, T, effect_policy_toolbar, STR);
83    E_CONFIG_VAL(D, T, effect_policy_menu, STR);
84    E_CONFIG_VAL(D, T, effect_policy_utility, STR);
85    E_CONFIG_VAL(D, T, effect_policy_splash, STR);
86    E_CONFIG_VAL(D, T, effect_policy_dialog, STR);
87    E_CONFIG_VAL(D, T, effect_policy_normal, STR);
88    E_CONFIG_VAL(D, T, effect_policy_videocall, STR);
89    E_CONFIG_VAL(D, T, effect_policy_dropdown_menu, STR);
90    E_CONFIG_VAL(D, T, effect_policy_popup_menu, STR);
91    E_CONFIG_VAL(D, T, effect_policy_tooltip, STR);
92    E_CONFIG_VAL(D, T, effect_policy_notification, STR);
93    E_CONFIG_VAL(D, T, effect_policy_combo, STR);
94    E_CONFIG_VAL(D, T, effect_policy_dnd, STR);
95    E_CONFIG_VAL(D, T, effect_policy_menuscreen, STR);
96    E_CONFIG_VAL(D, T, effect_policy_quickpanel_base, STR);
97    E_CONFIG_VAL(D, T, effect_policy_quickpanel, STR);
98    E_CONFIG_VAL(D, T, effect_policy_taskmanager, STR);
99    E_CONFIG_VAL(D, T, effect_policy_livemagazine, STR);
100    E_CONFIG_VAL(D, T, effect_policy_lockscreen, STR);
101    E_CONFIG_VAL(D, T, effect_policy_indicator, STR);
102    E_CONFIG_VAL(D, T, effect_policy_tickernoti, STR);
103    E_CONFIG_VAL(D, T, effect_policy_debugging_info, STR);
104    E_CONFIG_VAL(D, T, effect_policy_apptray, STR);
105    E_CONFIG_VAL(D, T, effect_policy_mini_apptray, STR);
106    E_CONFIG_VAL(D, T, effect_policy_volume, STR);
107    E_CONFIG_VAL(D, T, effect_policy_background, STR);
108    E_CONFIG_VAL(D, T, effect_policy_isf_keyboard, STR);
109    E_CONFIG_VAL(D, T, effect_policy_isf_sub, STR);
110    E_CONFIG_VAL(D, T, effect_policy_setup_wizard, STR);
111    E_CONFIG_VAL(D, T, effect_policy_toast, STR);
112    E_CONFIG_VAL(D, T, effect_policy_app_popup, STR);
113    E_CONFIG_LIST(D, T, match.popups, *match_edd);
114    E_CONFIG_LIST(D, T, match.borders, *match_edd);
115    E_CONFIG_LIST(D, T, match.overrides, *match_edd);
116    E_CONFIG_LIST(D, T, match.menus, *match_edd);
117 }
118
119 EAPI Config *
120 e_mod_comp_cfdata_config_new(void)
121 {
122    Config *cfg;
123    Match *mat;
124
125    cfg = E_NEW(Config, 1);
126    if (!cfg) return NULL;
127
128    cfg->shadow_file = calloc(4096, sizeof(unsigned char));
129    if (cfg->shadow_file)
130      {
131         snprintf((char *)(cfg->shadow_file),
132                  4096 * sizeof(unsigned char),
133                  "%s/data/themes/shadow.edj",
134                  e_prefix_data_get());
135         fprintf(stdout,
136                 "[E17-comp] shadow file path: %s\n",
137                 cfg->shadow_file);
138      }
139
140    cfg->shadow_style = eina_stringshare_add("default");
141    cfg->effect_file = eina_stringshare_add("/usr/lib/enlightenment/modules/e17-mod-tizen-comp/effect/common.so");
142    cfg->hwcomp_file = eina_stringshare_add("/usr/lib/enlightenment/modules/e17-mod-tizen-comp/effect/hwcomp.so");
143    cfg->engine = ENGINE_GL;
144    cfg->max_unmapped_pixels = 32 * 1024;  // implement
145    cfg->max_unmapped_time = 10 * 3600; // implement
146    cfg->min_unmapped_time = 5 * 60; // implement
147    cfg->fps_average_range = 30;
148    cfg->fps_corner = 0;
149    cfg->fps_show = 0;
150    cfg->use_shadow = 0;
151    cfg->indirect = 0;
152    cfg->texture_from_pixmap = 1;
153    cfg->lock_fps = 0;
154    cfg->loose_sync = 1;
155    cfg->efl_sync = 1;
156    cfg->grab = 0;
157    cfg->vsync = 1;
158    cfg->keep_unmapped = 1;
159    cfg->send_flush = 1; // implement
160    cfg->send_dump = 1; // implement
161    cfg->nocomp_fs = 0; // buggy
162    cfg->use_hwc = 0; // hardware_compositing
163    cfg->smooth_windows = 0; // 1 if gl, 0 if not
164    cfg->first_draw_delay = 0.15;
165
166    cfg->canvas_per_zone = 1;
167    cfg->use_lock_screen = 1;
168    cfg->default_window_effect = 0;
169    cfg->keyboard_effect = 0;
170    cfg->xv_rotation_effect = 0;
171    cfg->fake_image_launch = 0;
172    cfg->fake_launch_layer = 0;
173    cfg->lower_layer = 5;
174    cfg->defer_raise_effect = 0;
175    cfg->max_lock_screen_time = 2.0;
176    cfg->damage_timeout = 10.0;
177    cfg->nocomp_begin_timeout = 2.0;
178    cfg->use_hw_ov = 0;
179    cfg->debug_info_show = 0;
180    cfg->max_debug_msgs = 1;
181    cfg->debug_type_nocomp = 1;
182    cfg->debug_type_swap = 0;
183    cfg->debug_type_effect = 0;
184    cfg->use_efl_native_surface = 1;
185    cfg->stand_by_canvas_render_enable = 0;
186
187    cfg->effect_policy_unknown = eina_stringshare_add("shadow");
188    cfg->effect_policy_desktop = eina_stringshare_add("no-effect");
189    cfg->effect_policy_dock = eina_stringshare_add("shadow_fade");
190    cfg->effect_policy_toolbar = eina_stringshare_add("no-effect");
191    cfg->effect_policy_menu = eina_stringshare_add("no-effect");
192    cfg->effect_policy_utility = eina_stringshare_add("no-effect");
193    cfg->effect_policy_splash = eina_stringshare_add("no-effect");
194    cfg->effect_policy_dialog = eina_stringshare_add("dialog");
195    cfg->effect_policy_normal = eina_stringshare_add("shadow_fade");
196    cfg->effect_policy_videocall = eina_stringshare_add("shadow_fade");
197    cfg->effect_policy_dropdown_menu = eina_stringshare_add("no-effect");
198    cfg->effect_policy_popup_menu = eina_stringshare_add("shadow");
199    cfg->effect_policy_tooltip = eina_stringshare_add("shadow");
200    cfg->effect_policy_notification = eina_stringshare_add("dialog");
201    cfg->effect_policy_combo = eina_stringshare_add("no-effect");
202    cfg->effect_policy_dnd = eina_stringshare_add("no-effect");
203    cfg->effect_policy_menuscreen = eina_stringshare_add("home_screen");
204    cfg->effect_policy_quickpanel_base = eina_stringshare_add("quickpanel");
205    cfg->effect_policy_quickpanel = eina_stringshare_add("quickpanel");
206    cfg->effect_policy_taskmanager = eina_stringshare_add("taskmgr");
207    cfg->effect_policy_livemagazine = eina_stringshare_add("home_screen");
208    cfg->effect_policy_lockscreen = eina_stringshare_add("lockscreen");
209    cfg->effect_policy_indicator = eina_stringshare_add("indicator");
210    cfg->effect_policy_tickernoti = eina_stringshare_add("dialog_without_dim");
211    cfg->effect_policy_debugging_info = eina_stringshare_add("no-effect");
212    cfg->effect_policy_apptray = eina_stringshare_add("app_tray");
213    cfg->effect_policy_mini_apptray = eina_stringshare_add("app_tray");
214    cfg->effect_policy_volume = eina_stringshare_add("dialog_without_dim");
215    cfg->effect_policy_background = eina_stringshare_add("no-effect");
216    cfg->effect_policy_isf_keyboard = eina_stringshare_add("keyboard");
217    cfg->effect_policy_isf_sub = eina_stringshare_add("no-effect");
218    cfg->effect_policy_setup_wizard = eina_stringshare_add("no-effect");
219    cfg->effect_policy_toast = eina_stringshare_add("no-effect");
220    cfg->effect_policy_app_popup = eina_stringshare_add("dialog_without_dim");
221
222    cfg->match.popups = NULL;
223    mat = E_NEW(Match, 1);
224    if (mat)
225      {
226         cfg->match.popups = eina_list_append(cfg->match.popups, mat);
227         mat->name = eina_stringshare_add("shelf");
228         mat->shadow_style = eina_stringshare_add("popup");
229      }
230    mat = E_NEW(Match, 1);
231    if (mat)
232      {
233         cfg->match.popups = eina_list_append(cfg->match.popups, mat);
234         mat->shadow_style = eina_stringshare_add("popup");
235      }
236    cfg->match.borders = NULL;
237
238    cfg->match.overrides = NULL;
239    mat = E_NEW(Match, 1);
240    if (mat)
241      {
242         cfg->match.overrides = eina_list_append(cfg->match.overrides, mat);
243         mat->name = eina_stringshare_add("E");
244         mat->clas = eina_stringshare_add("Background_Window");
245         mat->shadow_style = eina_stringshare_add("none");
246      }
247    mat = E_NEW(Match, 1);
248    if (mat)
249      {
250         cfg->match.overrides = eina_list_append(cfg->match.overrides, mat);
251         mat->name = eina_stringshare_add("E");
252         mat->clas = eina_stringshare_add("everything");
253         mat->shadow_style = eina_stringshare_add("everything");
254      }
255    mat = E_NEW(Match, 1);
256    if (mat)
257      {
258         cfg->match.overrides = eina_list_append(cfg->match.overrides, mat);
259         mat->primary_type = ECORE_X_WINDOW_TYPE_DROPDOWN_MENU;
260         mat->shadow_style = eina_stringshare_add("menu");
261      }
262    mat = E_NEW(Match, 1);
263    if (mat)
264      {
265         cfg->match.overrides = eina_list_append(cfg->match.overrides, mat);
266         mat->primary_type = ECORE_X_WINDOW_TYPE_POPUP_MENU;
267         mat->shadow_style = eina_stringshare_add("menu");
268      }
269    mat = E_NEW(Match, 1);
270    if (mat)
271      {
272         cfg->match.overrides = eina_list_append(cfg->match.overrides, mat);
273         mat->primary_type = ECORE_X_WINDOW_TYPE_COMBO;
274         mat->shadow_style = eina_stringshare_add("menu");
275      }
276    mat = E_NEW(Match, 1);
277    if (mat)
278      {
279         cfg->match.overrides = eina_list_append(cfg->match.overrides, mat);
280         mat->primary_type = ECORE_X_WINDOW_TYPE_TOOLTIP;
281         mat->shadow_style = eina_stringshare_add("menu");
282      }
283    mat = E_NEW(Match, 1);
284    if (mat)
285      {
286         cfg->match.overrides = eina_list_append(cfg->match.overrides, mat);
287         mat->shadow_style = eina_stringshare_add("popup");
288      }
289    cfg->match.menus = NULL;
290    mat = E_NEW(Match, 1);
291    if (mat)
292      {
293         cfg->match.menus = eina_list_append(cfg->match.menus, mat);
294         mat->shadow_style = eina_stringshare_add("menu");
295      }
296
297    return cfg;
298 }
299
300 static void
301 _match_list_free(Eina_List *list)
302 {
303    Match *m;
304
305    EINA_LIST_FREE(list, m)
306      {
307         if (m->title) eina_stringshare_del(m->title);
308         if (m->name) eina_stringshare_del(m->name);
309         if (m->clas) eina_stringshare_del(m->clas);
310         if (m->role) eina_stringshare_del(m->role);
311         if (m->shadow_style) eina_stringshare_del(m->shadow_style);
312         free(m);
313      }
314 }
315
316 EAPI void
317 e_mod_cfdata_config_free(Config *cfg)
318 {
319    if (cfg->shadow_file) eina_stringshare_del(cfg->shadow_file);
320    if (cfg->shadow_style) eina_stringshare_del(cfg->shadow_style);
321    if (cfg->effect_file) eina_stringshare_del(cfg->effect_file);
322    if (cfg->hwcomp_file) eina_stringshare_del(cfg->hwcomp_file);
323
324    if (cfg->effect_policy_unknown) eina_stringshare_del(cfg->effect_policy_unknown);
325    if (cfg->effect_policy_desktop) eina_stringshare_del(cfg->effect_policy_desktop);
326    if (cfg->effect_policy_dock) eina_stringshare_del(cfg->effect_policy_dock);
327    if (cfg->effect_policy_toolbar) eina_stringshare_del(cfg->effect_policy_toolbar);
328    if (cfg->effect_policy_menu) eina_stringshare_del(cfg->effect_policy_menu);
329    if (cfg->effect_policy_utility) eina_stringshare_del(cfg->effect_policy_utility);
330    if (cfg->effect_policy_splash) eina_stringshare_del(cfg->effect_policy_splash);
331    if (cfg->effect_policy_dialog) eina_stringshare_del(cfg->effect_policy_dialog);
332    if (cfg->effect_policy_normal) eina_stringshare_del(cfg->effect_policy_normal);
333    if (cfg->effect_policy_videocall) eina_stringshare_del(cfg->effect_policy_videocall);
334    if (cfg->effect_policy_dropdown_menu) eina_stringshare_del(cfg->effect_policy_dropdown_menu);
335    if (cfg->effect_policy_popup_menu) eina_stringshare_del(cfg->effect_policy_popup_menu);
336    if (cfg->effect_policy_tooltip) eina_stringshare_del(cfg->effect_policy_tooltip);
337    if (cfg->effect_policy_notification) eina_stringshare_del(cfg->effect_policy_notification);
338    if (cfg->effect_policy_combo) eina_stringshare_del(cfg->effect_policy_combo);
339    if (cfg->effect_policy_dnd) eina_stringshare_del(cfg->effect_policy_dnd);
340    if (cfg->effect_policy_menuscreen) eina_stringshare_del(cfg->effect_policy_menuscreen);
341    if (cfg->effect_policy_quickpanel_base) eina_stringshare_del(cfg->effect_policy_quickpanel_base);
342    if (cfg->effect_policy_quickpanel) eina_stringshare_del(cfg->effect_policy_quickpanel);
343    if (cfg->effect_policy_taskmanager) eina_stringshare_del(cfg->effect_policy_taskmanager);
344    if (cfg->effect_policy_livemagazine) eina_stringshare_del(cfg->effect_policy_livemagazine);
345    if (cfg->effect_policy_lockscreen) eina_stringshare_del(cfg->effect_policy_lockscreen);
346    if (cfg->effect_policy_indicator) eina_stringshare_del(cfg->effect_policy_indicator);
347    if (cfg->effect_policy_tickernoti) eina_stringshare_del(cfg->effect_policy_tickernoti);
348    if (cfg->effect_policy_debugging_info) eina_stringshare_del(cfg->effect_policy_debugging_info);
349    if (cfg->effect_policy_apptray) eina_stringshare_del(cfg->effect_policy_apptray);
350    if (cfg->effect_policy_mini_apptray) eina_stringshare_del(cfg->effect_policy_mini_apptray);
351    if (cfg->effect_policy_volume) eina_stringshare_del(cfg->effect_policy_volume);
352    if (cfg->effect_policy_background) eina_stringshare_del(cfg->effect_policy_background);
353    if (cfg->effect_policy_isf_keyboard) eina_stringshare_del(cfg->effect_policy_isf_keyboard);
354    if (cfg->effect_policy_isf_sub) eina_stringshare_del(cfg->effect_policy_isf_sub);
355    if (cfg->effect_policy_setup_wizard) eina_stringshare_del(cfg->effect_policy_setup_wizard);
356    if (cfg->effect_policy_toast) eina_stringshare_del(cfg->effect_policy_toast);
357    if (cfg->effect_policy_app_popup) eina_stringshare_del(cfg->effect_policy_app_popup);
358
359    _match_list_free(cfg->match.popups);
360    _match_list_free(cfg->match.borders);
361    _match_list_free(cfg->match.overrides);
362    _match_list_free(cfg->match.menus);
363
364    free(cfg);
365 }
366