Tizen 2.1 release
[platform/core/uifw/e17.git] / src / modules / comp / e_mod_config.c
1 #include "e.h"
2 #include "e_mod_main.h"
3 #include "e_mod_config.h"
4 #include "e_mod_comp.h"
5
6 typedef struct _E_Demo_Style_Item
7 {
8    Evas_Object *preview;
9    Evas_Object *frame;
10    Evas_Object *livethumb;
11    Evas_Object *layout;
12    Evas_Object *border;
13    Evas_Object *client;
14 } E_Demo_Style_Item;
15
16 typedef struct _Match_Config
17 {
18    Match            match;
19    E_Config_Dialog *cfd;
20    char            *title, *name, *clas, *role;
21    int              borderless, dialog, accepts_focus, vkbd;
22    int              quickpanel, argb, fullscreen, modal;
23 } Match_Config;
24
25 struct _E_Config_Dialog_Data
26 {
27    int         engine;
28    int         indirect;
29    int         texture_from_pixmap;
30    int         smooth_windows;
31    int         lock_fps;
32    int         efl_sync;
33    int         loose_sync;
34    int         grab;
35    int         vsync;
36
37    const char *shadow_style;
38
39    struct
40    {
41       Eina_List *popups;
42       Eina_List *borders;
43       Eina_List *overrides;
44       Eina_List *menus;
45       int        changed;
46    } match;
47
48    Evas_Object *popups_il;
49    Evas_Object *borders_il;
50    Evas_Object *overrides_il;
51    Evas_Object *menus_il;
52
53    Evas_Object *edit_il;
54
55    int          keep_unmapped;
56    int          max_unmapped_pixels;
57    int          max_unmapped_time;
58    int          min_unmapped_time;
59    int          send_flush;
60    int          send_dump;
61    int          nocomp_fs;
62
63    int          fps_show;
64    int          fps_corner;
65    int          fps_average_range;
66    double       first_draw_delay;
67 };
68
69 /* Protos */
70 static void        *_create_data(E_Config_Dialog *cfd);
71 static void         _free_data(E_Config_Dialog *cfd,
72                                E_Config_Dialog_Data *cfdata);
73 static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd,
74                                           Evas *evas,
75                                           E_Config_Dialog_Data *cfdata);
76 static int          _basic_apply_data(E_Config_Dialog *cfd,
77                                       E_Config_Dialog_Data *cfdata);
78 static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd,
79                                           Evas *evas,
80                                           E_Config_Dialog_Data *cfdata);
81 static int          _advanced_apply_data(E_Config_Dialog *cfd,
82                                       E_Config_Dialog_Data *cfdata);
83
84 E_Config_Dialog *
85 e_int_config_comp_module(E_Container *con,
86                          const char *params __UNUSED__)
87 {
88    E_Config_Dialog *cfd;
89    E_Config_Dialog_View *v;
90    char buf[4096];
91    Mod *mod = _comp_mod;
92
93    if (e_config_dialog_find("E", "appearance/comp")) return NULL;
94    v = E_NEW(E_Config_Dialog_View, 1);
95
96    v->create_cfdata = _create_data;
97    v->free_cfdata = _free_data;
98    v->basic.apply_cfdata = _basic_apply_data;
99    v->basic.create_widgets = _basic_create_widgets;
100    v->advanced.apply_cfdata = _advanced_apply_data;
101    v->advanced.create_widgets = _advanced_create_widgets;
102    
103    snprintf(buf, sizeof(buf), "%s/e-module-comp.edj",
104             e_module_dir_get(mod->module));
105    cfd = e_config_dialog_new(con, _("Composite Settings"),
106                              "E", "appearance/comp", buf, 0, v, mod);
107    mod->config_dialog = cfd;
108    return cfd;
109 }
110
111 static void
112 _match_dup(Match *m,
113            Match_Config *m2)
114 {
115    m2->match = *m;
116    if (m2->match.title) m2->match.title = eina_stringshare_add(m2->match.title);
117    if (m2->match.name) m2->match.name = eina_stringshare_add(m2->match.name);
118    if (m2->match.clas) m2->match.clas = eina_stringshare_add(m2->match.clas);
119    if (m2->match.role) m2->match.role = eina_stringshare_add(m2->match.role);
120    if (m2->match.shadow_style) m2->match.shadow_style = eina_stringshare_add(m2->match.shadow_style);
121 }
122
123 static void *
124 _create_data(E_Config_Dialog *cfd)
125 {
126    E_Config_Dialog_Data *cfdata;
127    Eina_List *l;
128    Match *m;
129    Match_Config *m2;
130
131    cfdata = E_NEW(E_Config_Dialog_Data, 1);
132
133    cfdata->engine = _comp_mod->conf->engine;
134    if ((cfdata->engine != ENGINE_SW) &&
135        (cfdata->engine != ENGINE_GL))
136      cfdata->engine = ENGINE_SW;
137    cfdata->indirect = _comp_mod->conf->indirect;
138    cfdata->texture_from_pixmap = _comp_mod->conf->texture_from_pixmap;
139    cfdata->smooth_windows = _comp_mod->conf->smooth_windows;
140    cfdata->lock_fps = _comp_mod->conf->lock_fps;
141    cfdata->efl_sync = _comp_mod->conf->efl_sync;
142    cfdata->loose_sync = _comp_mod->conf->loose_sync;
143    cfdata->grab = _comp_mod->conf->grab;
144    cfdata->vsync = _comp_mod->conf->vsync;
145    if (_comp_mod->conf->shadow_style)
146      cfdata->shadow_style = eina_stringshare_add(_comp_mod->conf->shadow_style);
147
148    cfdata->keep_unmapped = _comp_mod->conf->keep_unmapped;
149    cfdata->max_unmapped_pixels = _comp_mod->conf->max_unmapped_pixels;
150    cfdata->max_unmapped_time = _comp_mod->conf->max_unmapped_time;
151    cfdata->min_unmapped_time = _comp_mod->conf->min_unmapped_time;
152    cfdata->send_flush = _comp_mod->conf->send_flush;
153    cfdata->send_dump = _comp_mod->conf->send_dump;
154    cfdata->nocomp_fs = _comp_mod->conf->nocomp_fs;
155
156    cfdata->fps_show = _comp_mod->conf->fps_show;
157    cfdata->fps_corner = _comp_mod->conf->fps_corner;
158    cfdata->fps_average_range = _comp_mod->conf->fps_average_range;
159    if (cfdata->fps_average_range < 1) cfdata->fps_average_range = 12;
160    else if (cfdata->fps_average_range > 120)
161      cfdata->fps_average_range = 120;
162    cfdata->first_draw_delay = _comp_mod->conf->first_draw_delay;
163
164    EINA_LIST_FOREACH(_comp_mod->conf->match.popups, l, m)
165      {
166         m2 = E_NEW(Match_Config, 1);
167         _match_dup(m, m2);
168         m2->cfd = cfd;
169         cfdata->match.popups = eina_list_append(cfdata->match.popups, m2);
170      }
171
172    EINA_LIST_FOREACH(_comp_mod->conf->match.borders, l, m)
173      {
174         m2 = E_NEW(Match_Config, 1);
175         _match_dup(m, m2);
176         m2->cfd = cfd;
177         cfdata->match.borders = eina_list_append(cfdata->match.borders, m2);
178      }
179
180    EINA_LIST_FOREACH(_comp_mod->conf->match.overrides, l, m)
181      {
182         m2 = E_NEW(Match_Config, 1);
183         _match_dup(m, m2);
184         m2->cfd = cfd;
185         cfdata->match.overrides = eina_list_append(cfdata->match.overrides, m2);
186      }
187
188    EINA_LIST_FOREACH(_comp_mod->conf->match.menus, l, m)
189      {
190         m2 = E_NEW(Match_Config, 1);
191         _match_dup(m, m2);
192         m2->cfd = cfd;
193         cfdata->match.menus = eina_list_append(cfdata->match.menus, m2);
194      }
195
196    return cfdata;
197 }
198
199 static void
200 _match_free(Match_Config *m)
201 {
202    if (m->match.title) eina_stringshare_del(m->match.title);
203    if (m->match.name) eina_stringshare_del(m->match.name);
204    if (m->match.clas) eina_stringshare_del(m->match.clas);
205    if (m->match.role) eina_stringshare_del(m->match.role);
206    if (m->match.shadow_style) eina_stringshare_del(m->match.shadow_style);
207    if (m->title) free(m->title);
208    if (m->name) free(m->name);
209    if (m->clas) free(m->clas);
210    if (m->role) free(m->role);
211    free(m);
212 }
213
214 static void
215 _free_data(E_Config_Dialog *cfd  __UNUSED__,
216            E_Config_Dialog_Data *cfdata)
217 {
218    Match_Config *m;
219
220    _comp_mod->config_dialog = NULL;
221    if (cfdata->shadow_style) eina_stringshare_del(cfdata->shadow_style);
222    EINA_LIST_FREE(cfdata->match.popups, m)
223      {
224         _match_free(m);
225      }
226    EINA_LIST_FREE(cfdata->match.borders, m)
227      {
228         _match_free(m);
229      }
230    EINA_LIST_FREE(cfdata->match.overrides, m)
231      {
232         _match_free(m);
233      }
234    EINA_LIST_FREE(cfdata->match.menus, m)
235      {
236         _match_free(m);
237      }
238    free(cfdata);
239 }
240
241 static Eina_Bool
242 _style_demo(void *data)
243 {
244    Eina_List *style_shadows, *l;
245    int demo_state;
246    const E_Demo_Style_Item *it;
247
248    demo_state = (long)evas_object_data_get(data, "style_demo_state");
249    demo_state = (demo_state + 1) % 4;
250    evas_object_data_set(data, "style_demo_state", (void *)(long)demo_state);
251
252    style_shadows = evas_object_data_get(data, "style_shadows");
253    EINA_LIST_FOREACH(style_shadows, l, it)
254      {
255         Evas_Object *ob = it->preview;
256         Evas_Object *of = it->frame;
257
258         switch (demo_state)
259           {
260            case 0:
261              edje_object_signal_emit(ob, "e,state,visible,on", "e");
262              edje_object_signal_emit(ob, "e,state,focus,on", "e");
263              edje_object_part_text_set(of, "e.text.label", _("Visible"));
264              break;
265
266            case 1:
267              edje_object_signal_emit(ob, "e,state,focus,off", "e");
268              edje_object_part_text_set(of, "e.text.label", _("Focus-Out"));
269              break;
270
271            case 2:
272              edje_object_signal_emit(ob, "e,state,focus,on", "e");
273              edje_object_part_text_set(of, "e.text.label", _("Focus-In"));
274              break;
275
276            case 3:
277              edje_object_signal_emit(ob, "e,state,visible,off", "e");
278              edje_object_part_text_set(of, "e.text.label", _("Hidden"));
279              break;
280
281            default:
282              break;
283           }
284      }
285    return ECORE_CALLBACK_RENEW;
286 }
287
288 static void
289 _style_selector_del(void *data       __UNUSED__,
290                     Evas *e,
291                     Evas_Object *o,
292                     void *event_info __UNUSED__)
293 {
294    Eina_List *style_shadows, *style_list;
295    Ecore_Timer *timer;
296    Evas_Object *orec0;
297
298    orec0 = evas_object_name_find(e, "style_shadows");
299    style_list = evas_object_data_get(orec0, "list");
300
301    style_shadows = evas_object_data_get(o, "style_shadows");
302    if (style_shadows)
303      {
304         E_Demo_Style_Item *ds_it;
305
306         EINA_LIST_FREE(style_shadows, ds_it)
307           {
308              style_list = eina_list_remove(style_list, ds_it);
309
310              evas_object_del(ds_it->client);
311              evas_object_del(ds_it->border);
312              evas_object_del(ds_it->frame);
313              evas_object_del(ds_it->preview);
314              evas_object_del(ds_it->layout);
315              evas_object_del(ds_it->livethumb);
316              free(ds_it);
317           }
318         evas_object_data_set(o, "style_shadows", NULL);
319      }
320
321    timer = evas_object_data_get(o, "style_timer");
322    if (timer)
323      {
324         ecore_timer_del(timer);
325         evas_object_data_set(o, "style_timer", NULL);
326      }
327
328    evas_object_data_set(orec0, "list", style_list);
329 }
330
331 static Evas_Object *
332 _style_selector(Evas *evas,
333                 const char **source)
334 {
335    Evas_Object *oi, *ob, *oo, *obd, *orec, *oly, *orec0;
336    Eina_List *styles, *l, *style_shadows = NULL, *style_list;
337    char *style;
338    const char *str;
339    int n, sel;
340    Evas_Coord wmw, wmh;
341    Ecore_Timer *timer;
342
343    orec0 = evas_object_name_find(evas, "style_shadows");
344    style_list = evas_object_data_get(orec0, "list");
345    oi = e_widget_ilist_add(evas, 80, 80, source);
346    evas_object_event_callback_add(oi, EVAS_CALLBACK_DEL,
347                                   _style_selector_del, oi);
348    sel = 0;
349    styles = e_theme_comp_list();
350    n = 0;
351    EINA_LIST_FOREACH(styles, l, style)
352      {
353         E_Demo_Style_Item *ds_it;
354         char buf[4096];
355
356         ds_it = malloc(sizeof(E_Demo_Style_Item));
357
358         ob = e_livethumb_add(evas);
359         ds_it->livethumb = ob;
360         e_livethumb_vsize_set(ob, 240, 240);
361
362         oly = e_layout_add(e_livethumb_evas_get(ob));
363         ds_it->layout = ob;
364         e_layout_virtual_size_set(oly, 240, 240);
365         e_livethumb_thumb_set(ob, oly);
366         evas_object_show(oly);
367
368         oo = edje_object_add(e_livethumb_evas_get(ob));
369         ds_it->preview = oo;
370         snprintf(buf, sizeof(buf), "e/comp/%s", style);
371         e_theme_edje_object_set(oo, "base/theme/borders", buf);
372         e_layout_pack(oly, oo);
373         e_layout_child_move(oo, 39, 39);
374         e_layout_child_resize(oo, 162, 162);
375         edje_object_signal_emit(oo, "e,state,shadow,on", "e");
376         edje_object_signal_emit(oo, "e,state,visible,on", "e");
377         evas_object_show(oo);
378
379         ds_it->frame = edje_object_add(evas);
380         e_theme_edje_object_set
381           (ds_it->frame, "base/theme/modules/comp", "e/modules/comp/preview");
382         edje_object_part_swallow(ds_it->frame, "e.swallow.preview", ob);
383         evas_object_show(ds_it->frame);
384         style_shadows = eina_list_append(style_shadows, ds_it);
385
386         obd = edje_object_add(e_livethumb_evas_get(ob));
387         ds_it->border = obd;
388         e_theme_edje_object_set(obd, "base/theme/borders",
389                                 "e/widgets/border/default/border");
390         edje_object_part_text_set(obd, "e.text.title", _("Title"));
391         edje_object_signal_emit(obd, "e,state,focused", "e");
392         edje_object_part_swallow(oo, "e.swallow.content", obd);
393         evas_object_show(obd);
394
395         orec = evas_object_rectangle_add(e_livethumb_evas_get(ob));
396         ds_it->client = orec;
397         evas_object_color_set(orec, 255, 255, 255, 255);
398         edje_object_part_swallow(obd, "e.swallow.client", orec);
399         evas_object_show(orec);
400
401         e_widget_ilist_append(oi, ds_it->frame, style, NULL, NULL, style);
402         evas_object_show(ob);
403         if (*source)
404           {
405              if (!strcmp(*source, style)) sel = n;
406           }
407         n++;
408
409         style_list = eina_list_append(style_list, ds_it);
410      }
411    evas_object_data_set(orec0, "list", style_list);
412    evas_object_data_set(oi, "style_shadows", style_shadows);
413    timer = ecore_timer_add(3.0, _style_demo, oi);
414    evas_object_data_set(oi, "style_timer", timer);
415    evas_object_data_set(oi, "style_demo_state", (void *)1);
416    e_widget_size_min_get(oi, &wmw, &wmh);
417    e_widget_size_min_set(oi, 160, 100);
418    e_widget_ilist_selected_set(oi, sel);
419    e_widget_ilist_go(oi);
420
421    EINA_LIST_FREE(styles, str)
422      eina_stringshare_del(str);
423
424    return oi;
425 }
426
427 static void
428 _match_sel(void *data __UNUSED__)
429 {
430 //   Match_Config *m = data;
431 //   E_Config_Dialog *cfd = m->cfd;
432 }
433
434 static const char *
435 _match_type_label_get(int type)
436 {
437    if (ECORE_X_WINDOW_TYPE_UNKNOWN == type)
438      return _("Unused");
439    if (ECORE_X_WINDOW_TYPE_COMBO == type)
440      return _("Combo");
441    if (ECORE_X_WINDOW_TYPE_DESKTOP == type)
442      return _("Desktop");
443    if (ECORE_X_WINDOW_TYPE_DIALOG == type)
444      return _("Dialog");
445    if (ECORE_X_WINDOW_TYPE_DOCK == type)
446      return _("Dock");
447    if (ECORE_X_WINDOW_TYPE_DND == type)
448      return _("Drag and Drop");
449    if (ECORE_X_WINDOW_TYPE_MENU == type)
450      return _("Menu");
451    if (ECORE_X_WINDOW_TYPE_DROPDOWN_MENU == type)
452      return _("Menu (Dropdown)");
453    if (ECORE_X_WINDOW_TYPE_POPUP_MENU == type)
454      return _("Menu (Popup)");
455    if (ECORE_X_WINDOW_TYPE_NORMAL == type)
456      return _("Normal");
457    if (ECORE_X_WINDOW_TYPE_NOTIFICATION == type)
458      return _("Notification");
459    if (ECORE_X_WINDOW_TYPE_SPLASH == type)
460      return _("Splash");
461    if (ECORE_X_WINDOW_TYPE_TOOLBAR == type)
462      return _("Toolbar");
463    if (ECORE_X_WINDOW_TYPE_TOOLTIP == type)
464      return _("Tooltip");
465    if (ECORE_X_WINDOW_TYPE_UTILITY == type)
466      return _("Utility");
467
468    return _("Unused");
469 }
470
471 static char *
472 _match_label_get(Match_Config *m)
473 {
474    char *label;
475    Eina_Strbuf *buf = eina_strbuf_new();
476
477    if (m->match.title)
478      {
479         eina_strbuf_append(buf, _("Title:"));
480         eina_strbuf_append(buf, m->match.title);
481         eina_strbuf_append(buf, _(" / "));
482      }
483    if (m->match.primary_type)
484      {
485         eina_strbuf_append(buf, _("Type:"));
486         eina_strbuf_append(buf, _match_type_label_get(m->match.primary_type));
487         eina_strbuf_append(buf, _(" / "));
488      }
489    if (m->match.name)
490      {
491         eina_strbuf_append(buf, _("Name:"));
492         eina_strbuf_append(buf, m->match.name);
493         eina_strbuf_append(buf, _(" / "));
494      }
495    if (m->match.clas)
496      {
497         eina_strbuf_append(buf, _("Class:"));
498         eina_strbuf_append(buf, m->match.clas);
499         eina_strbuf_append(buf, _(" / "));
500      }
501    if (m->match.role)
502      {
503         eina_strbuf_append(buf, _("Role:"));
504         eina_strbuf_append(buf, m->match.role);
505         eina_strbuf_append(buf, _(" / "));
506      }
507    if (m->match.shadow_style)
508      {
509         eina_strbuf_append(buf, _("Style:"));
510         eina_strbuf_append(buf, m->match.shadow_style);
511      }
512
513    if (!eina_strbuf_length_get(buf))
514      return _("Unknown");
515
516    label = strdup(eina_strbuf_string_get(buf));
517    eina_strbuf_free(buf);
518
519    return label;
520 }
521
522 static void
523 _match_ilist_append(Evas_Object *il,
524                     Match_Config *m,
525                     int pos,
526                     int pre)
527 {
528    char *name = _match_label_get(m);
529
530    if (pos == -1)
531      e_widget_ilist_append(il, NULL, name, _match_sel, m, NULL);
532    else
533      {
534         if (pre)
535           e_widget_ilist_prepend_relative(il, NULL, name, _match_sel, m, NULL, pos);
536         else
537           e_widget_ilist_append_relative(il, NULL, name, _match_sel, m, NULL, pos);
538      }
539    E_FREE(name);
540 }
541
542 static void
543 _match_list_up(Eina_List **list,
544                Match_Config *m)
545 {
546    Eina_List *l, *lp;
547
548    l = eina_list_data_find_list(*list, m);
549    if (!l) return;
550    lp = l->prev;
551    *list = eina_list_remove_list(*list, l);
552    if (lp) *list = eina_list_prepend_relative_list(*list, m, lp);
553    else *list = eina_list_prepend(*list, m);
554 }
555
556 static void
557 _match_list_down(Eina_List **list,
558                  Match_Config *m)
559 {
560    Eina_List *l, *lp;
561
562    l = eina_list_data_find_list(*list, m);
563    if (!l) return;
564    lp = l->next;
565    *list = eina_list_remove_list(*list, l);
566    if (lp) *list = eina_list_append_relative_list(*list, m, lp);
567    else *list = eina_list_append(*list, m);
568 }
569
570 static void
571 _match_list_del(Eina_List **list,
572                 Match_Config *m)
573 {
574    Eina_List *l, *lp;
575
576    l = eina_list_data_find_list(*list, m);
577    if (!l) return;
578    lp = l->next;
579    *list = eina_list_remove_list(*list, l);
580    _match_free(m);
581 }
582
583 static void
584 _cb_dialog_resize(void *data,
585                   Evas *e          __UNUSED__,
586                   Evas_Object *obj,
587                   void *event_info __UNUSED__)
588 {
589    Evas_Object *bg, *of;
590    int x, y, w, h;
591
592    of = data;
593    bg = evas_object_data_get(of, "bg");
594    evas_object_geometry_get(obj, &x, &y, &w, &h);
595
596    evas_object_move(bg, x, y);
597    evas_object_resize(bg, w, h);
598    evas_object_move(of, x, y);
599    evas_object_resize(of, w, h);
600 }
601
602 static void
603 _edit_ok(void *d1,
604          void *d2)
605 {
606    Match_Config *m = d1;
607   Evas_Object *dia, *bg, *of = d2;
608    Evas_Object *il;
609    char *label;
610    int n;
611
612    if (m->match.title) eina_stringshare_del(m->match.title);
613    m->match.title = NULL;
614    if (m->title)
615      {
616         if (m->title[0]) m->match.title = eina_stringshare_add(m->title);
617         free(m->title);
618         m->title = NULL;
619      }
620    if (m->match.name) eina_stringshare_del(m->match.name);
621    m->match.name = NULL;
622    if (m->name)
623      {
624         if (m->name[0]) m->match.name = eina_stringshare_add(m->name);
625         free(m->name);
626         m->name = NULL;
627      }
628    if (m->match.clas) eina_stringshare_del(m->match.clas);
629    m->match.clas = NULL;
630    if (m->clas)
631      {
632         if (m->clas[0]) m->match.clas = eina_stringshare_add(m->clas);
633         free(m->clas);
634         m->clas = NULL;
635      }
636    if (m->match.role) eina_stringshare_del(m->match.role);
637    m->match.role = NULL;
638    if (m->role)
639      {
640         if (m->role[0]) m->match.role = eina_stringshare_add(m->role);
641         free(m->role);
642         m->role = NULL;
643      }
644    m->match.borderless = m->borderless;
645    m->match.dialog = m->dialog;
646    m->match.accepts_focus = m->accepts_focus;
647    m->match.vkbd = m->vkbd;
648    m->match.quickpanel = m->quickpanel;
649    m->match.argb = m->argb;
650    m->match.fullscreen = m->fullscreen;
651    m->match.modal = m->modal;
652
653    il = m->cfd->cfdata->edit_il;
654    n = e_widget_ilist_selected_get(il);
655    label = _match_label_get(m);
656    e_widget_ilist_nth_label_set(il, n, label);
657    E_FREE(label);
658    bg = evas_object_data_get(of, "bg");
659    dia = evas_object_data_get(of, "dia");
660
661    evas_object_event_callback_del(dia, EVAS_CALLBACK_RESIZE, _cb_dialog_resize);
662    evas_object_del(bg);
663    evas_object_del(of);
664 }
665
666 static void
667 _create_edit_frame(E_Config_Dialog *cfd,
668                    Evas *evas,
669                    E_Config_Dialog_Data *cfdata,
670                    Match_Config *m)
671 {
672    Evas_Object *of, *oi, *lb, *en, *bt, *tb, *tab2, *o, *sf, *li;
673    E_Radio_Group *rg;
674    int row;
675    int x, y, w, h;
676
677    o = edje_object_add(evas);
678    e_theme_edje_object_set(o, "base/theme/dialog", "e/widgets/dialog/main");
679    evas_object_geometry_get(cfd->dia->bg_object, &x, &y, &w, &h);
680    evas_object_move(o, x, y);
681    evas_object_resize(o, w, h);
682    evas_object_show(o);
683
684    of = e_widget_frametable_add(evas, _("Edit Match"), 0);
685    evas_object_data_set(of, "bg", o);
686    evas_object_data_set(of, "dia", cfd->dia->bg_object);
687    evas_object_move(of, x, y);
688    evas_object_resize(of, w, h);
689    evas_object_show(of);
690
691    evas_object_event_callback_add(cfd->dia->bg_object, EVAS_CALLBACK_RESIZE,
692                                   _cb_dialog_resize, of);
693
694    tb = e_widget_toolbook_add(evas, 48 * e_scale, 48 * e_scale);
695
696    tab2 = e_widget_table_add(evas, 0);
697    if (cfdata->edit_il == cfdata->borders_il)
698      {
699         if (m->match.title) m->title = strdup(m->match.title);
700         else m->title = NULL;
701         lb = e_widget_label_add(evas, _("Title"));
702         e_widget_table_object_append(tab2, lb, 0, 0, 1, 1, 1, 0, 0, 0);
703         en = e_widget_entry_add(evas, &(m->title), NULL, NULL, NULL);
704         e_widget_table_object_append(tab2, en, 1, 0, 1, 1, 1, 0, 1, 0);
705      }
706    if ((cfdata->edit_il == cfdata->borders_il) ||
707        (cfdata->edit_il == cfdata->overrides_il) ||
708        (cfdata->edit_il == cfdata->popups_il))
709      {
710         if (m->match.name) m->name = strdup(m->match.name);
711         else m->name = NULL;
712         lb = e_widget_label_add(evas, _("Name"));
713         e_widget_table_object_append(tab2, lb, 0, 1, 1, 1, 1, 0, 0, 0);
714         en = e_widget_entry_add(evas, &(m->name), NULL, NULL, NULL);
715         e_widget_table_object_append(tab2, en, 1, 1, 1, 1, 1, 0, 1, 0);
716      }
717    if ((cfdata->edit_il == cfdata->borders_il) ||
718        (cfdata->edit_il == cfdata->overrides_il))
719      {
720         if (m->match.clas) m->clas = strdup(m->match.clas);
721         else m->clas = NULL;
722         lb = e_widget_label_add(evas, _("Class"));
723         e_widget_table_object_append(tab2, lb, 0, 2, 1, 1, 1, 0, 0, 0);
724         en = e_widget_entry_add(evas, &(m->clas), NULL, NULL, NULL);
725         e_widget_table_object_append(tab2, en, 1, 2, 1, 1, 1, 0, 1, 0);
726      }
727    if (cfdata->edit_il == cfdata->borders_il)
728      {
729         if (m->match.role) m->role = strdup(m->match.role);
730         else m->role = NULL;
731         lb = e_widget_label_add(evas, _("Role"));
732         e_widget_table_object_append(tab2, lb, 0, 3, 1, 1, 1, 0, 0, 0);
733         en = e_widget_entry_add(evas, &(m->role), NULL, NULL, NULL);
734         e_widget_table_object_append(tab2, en, 1, 3, 1, 1, 1, 0, 1, 0);
735      }
736    e_widget_toolbook_page_append(tb, NULL, _("Names"), tab2, 1, 1, 1, 1, 0.5, 0.0);
737
738    if ((cfdata->edit_il == cfdata->borders_il) ||
739        (cfdata->edit_il == cfdata->overrides_il))
740      {
741         Evas_Coord mw, mh;
742
743         rg = e_widget_radio_group_new(&m->match.primary_type);
744
745         li = e_widget_list_add(evas, 1, 0);
746
747         o = e_widget_radio_add(evas, _("Unused"), ECORE_X_WINDOW_TYPE_UNKNOWN, rg);
748         e_widget_list_object_append(li, o, 1, 0, 0.0);
749
750         o = e_widget_radio_add(evas, _("Combo"), ECORE_X_WINDOW_TYPE_COMBO, rg);
751         e_widget_list_object_append(li, o, 1, 0, 0.0);
752         o = e_widget_radio_add(evas, _("Desktop"), ECORE_X_WINDOW_TYPE_DESKTOP, rg);
753         e_widget_list_object_append(li, o, 1, 0, 0.0);
754         o = e_widget_radio_add(evas, _("Dialog"), ECORE_X_WINDOW_TYPE_DIALOG, rg);
755         e_widget_list_object_append(li, o, 1, 0, 0.0);
756         o = e_widget_radio_add(evas, _("Dock"), ECORE_X_WINDOW_TYPE_DOCK, rg);
757         e_widget_list_object_append(li, o, 1, 0, 0.0);
758         o = e_widget_radio_add(evas, _("Drag and Drop"), ECORE_X_WINDOW_TYPE_DND, rg);
759         e_widget_list_object_append(li, o, 1, 0, 0.0);
760         o = e_widget_radio_add(evas, _("Menu"), ECORE_X_WINDOW_TYPE_MENU, rg);
761         e_widget_list_object_append(li, o, 1, 0, 0.0);
762         o = e_widget_radio_add(evas, _("Menu (Dropdown)"), ECORE_X_WINDOW_TYPE_DROPDOWN_MENU, rg);
763         e_widget_list_object_append(li, o, 1, 0, 0.0);
764         o = e_widget_radio_add(evas, _("Menu (Popup)"), ECORE_X_WINDOW_TYPE_POPUP_MENU, rg);
765         e_widget_list_object_append(li, o, 1, 0, 0.0);
766         o = e_widget_radio_add(evas, _("Normal"), ECORE_X_WINDOW_TYPE_NORMAL, rg);
767         e_widget_list_object_append(li, o, 1, 0, 0.0);
768         o = e_widget_radio_add(evas, _("Notification"), ECORE_X_WINDOW_TYPE_NOTIFICATION, rg);
769         e_widget_list_object_append(li, o, 1, 0, 0.0);
770         o = e_widget_radio_add(evas, _("Splash"), ECORE_X_WINDOW_TYPE_SPLASH, rg);
771         e_widget_list_object_append(li, o, 1, 0, 0.0);
772         o = e_widget_radio_add(evas, _("Toolbar"), ECORE_X_WINDOW_TYPE_TOOLBAR, rg);
773         e_widget_list_object_append(li, o, 1, 0, 0.0);
774         o = e_widget_radio_add(evas, _("Tooltip"), ECORE_X_WINDOW_TYPE_TOOLTIP, rg);
775         e_widget_list_object_append(li, o, 1, 0, 0.0);
776         o = e_widget_radio_add(evas, _("Utility"), ECORE_X_WINDOW_TYPE_UTILITY, rg);
777         e_widget_list_object_append(li, o, 1, 0, 0.0);
778
779         e_widget_size_min_get(li, &mw, &mh);
780         evas_object_resize(li, mw, mh);
781
782         sf = e_widget_scrollframe_simple_add(evas, li);
783         e_widget_toolbook_page_append(tb, NULL, _("Types"), sf,
784                                       1, 1, 1, 1, 0.5, 0.0);
785      }
786
787    m->borderless = m->match.borderless;
788    m->dialog = m->match.dialog;
789    m->accepts_focus = m->match.accepts_focus;
790    m->vkbd = m->match.vkbd;
791    m->quickpanel = m->match.quickpanel;
792    m->argb = m->match.argb;
793    m->fullscreen = m->match.fullscreen;
794    m->modal = m->match.modal;
795
796    row = 0;
797    tab2 = e_widget_table_add(evas, 0);
798    lb = e_widget_label_add(evas, _("Unused"));
799    e_widget_table_object_append(tab2, lb, 1, row, 1, 1, 0, 0, 0, 0);
800    lb = e_widget_label_add(evas, _("On"));
801    e_widget_table_object_append(tab2, lb, 2, row, 1, 1, 0, 0, 0, 0);
802    lb = e_widget_label_add(evas, _("Off"));
803    e_widget_table_object_append(tab2, lb, 3, row, 1, 1, 0, 0, 0, 0);
804    row++;
805
806    if (cfdata->edit_il == cfdata->borders_il)
807      {
808         lb = e_widget_label_add(evas, _("Borderless"));
809         e_widget_table_object_append(tab2, lb, 0, row, 1, 1, 1, 0, 1, 0);
810         rg = e_widget_radio_group_new(&m->borderless);
811         o = e_widget_radio_add(evas, NULL, 0, rg);
812         e_widget_table_object_append(tab2, o, 1, row, 1, 1, 0, 0, 0, 0);
813         o = e_widget_radio_add(evas, NULL, 1, rg);
814         e_widget_table_object_append(tab2, o, 2, row, 1, 1, 0, 0, 0, 0);
815         o = e_widget_radio_add(evas, NULL, -1, rg);
816         e_widget_table_object_append(tab2, o, 3, row, 1, 1, 0, 0, 0, 0);
817         row++;
818      }
819    if (cfdata->edit_il == cfdata->borders_il)
820      {
821         lb = e_widget_label_add(evas, _("Dialog"));
822         e_widget_table_object_append(tab2, lb, 0, row, 1, 1, 1, 0, 1, 0);
823         rg = e_widget_radio_group_new(&m->dialog);
824         o = e_widget_radio_add(evas, NULL, 0, rg);
825         e_widget_table_object_append(tab2, o, 1, row, 1, 1, 0, 0, 0, 0);
826         o = e_widget_radio_add(evas, NULL, 1, rg);
827         e_widget_table_object_append(tab2, o, 2, row, 1, 1, 0, 0, 0, 0);
828         o = e_widget_radio_add(evas, NULL, -1, rg);
829         e_widget_table_object_append(tab2, o, 3, row, 1, 1, 0, 0, 0, 0);
830         row++;
831      }
832    if (cfdata->edit_il == cfdata->borders_il)
833      {
834         lb = e_widget_label_add(evas, _("Accepts Focus"));
835         e_widget_table_object_append(tab2, lb, 0, row, 1, 1, 1, 0, 1, 0);
836         rg = e_widget_radio_group_new(&m->accepts_focus);
837         o = e_widget_radio_add(evas, NULL, 0, rg);
838         e_widget_table_object_append(tab2, o, 1, row, 1, 1, 0, 0, 0, 0);
839         o = e_widget_radio_add(evas, NULL, 1, rg);
840         e_widget_table_object_append(tab2, o, 2, row, 1, 1, 0, 0, 0, 0);
841         o = e_widget_radio_add(evas, NULL, -1, rg);
842         e_widget_table_object_append(tab2, o, 3, row, 1, 1, 0, 0, 0, 0);
843         row++;
844      }
845    if (cfdata->edit_il == cfdata->borders_il)
846      {
847         lb = e_widget_label_add(evas, _("Virtual Keyboard"));
848         e_widget_table_object_append(tab2, lb, 0, row, 1, 1, 1, 0, 1, 0);
849         rg = e_widget_radio_group_new(&m->vkbd);
850         o = e_widget_radio_add(evas, NULL, 0, rg);
851         e_widget_table_object_append(tab2, o, 1, row, 1, 1, 0, 0, 0, 0);
852         o = e_widget_radio_add(evas, NULL, 1, rg);
853         e_widget_table_object_append(tab2, o, 2, row, 1, 1, 0, 0, 0, 0);
854         o = e_widget_radio_add(evas, NULL, -1, rg);
855         e_widget_table_object_append(tab2, o, 3, row, 1, 1, 0, 0, 0, 0);
856         row++;
857      }
858    if (cfdata->edit_il == cfdata->borders_il)
859      {
860         lb = e_widget_label_add(evas, _("Quick Panel"));
861         e_widget_table_object_append(tab2, lb, 0, row, 1, 1, 1, 0, 1, 0);
862         rg = e_widget_radio_group_new(&m->quickpanel);
863         o = e_widget_radio_add(evas, NULL, 0, rg);
864         e_widget_table_object_append(tab2, o, 1, row, 1, 1, 0, 0, 0, 0);
865         o = e_widget_radio_add(evas, NULL, 1, rg);
866         e_widget_table_object_append(tab2, o, 2, row, 1, 1, 0, 0, 0, 0);
867         o = e_widget_radio_add(evas, NULL, -1, rg);
868         e_widget_table_object_append(tab2, o, 3, row, 1, 1, 0, 0, 0, 0);
869         row++;
870      }
871    lb = e_widget_label_add(evas, _("ARGB"));
872    e_widget_table_object_append(tab2, lb, 0, row, 1, 1, 1, 0, 1, 0);
873    rg = e_widget_radio_group_new(&m->argb);
874    o = e_widget_radio_add(evas, NULL, 0, rg);
875    e_widget_table_object_append(tab2, o, 1, row, 1, 1, 0, 0, 0, 0);
876    o = e_widget_radio_add(evas, NULL, 1, rg);
877    e_widget_table_object_append(tab2, o, 2, row, 1, 1, 0, 0, 0, 0);
878    o = e_widget_radio_add(evas, NULL, -1, rg);
879    e_widget_table_object_append(tab2, o, 3, row, 1, 1, 0, 0, 0, 0);
880    row++;
881    if (cfdata->edit_il == cfdata->borders_il)
882      {
883         lb = e_widget_label_add(evas, _("Fullscreen"));
884         e_widget_table_object_append(tab2, lb, 0, row, 1, 1, 1, 0, 1, 0);
885         rg = e_widget_radio_group_new(&m->fullscreen);
886         o = e_widget_radio_add(evas, NULL, 0, rg);
887         e_widget_table_object_append(tab2, o, 1, row, 1, 1, 0, 0, 0, 0);
888         o = e_widget_radio_add(evas, NULL, 1, rg);
889         e_widget_table_object_append(tab2, o, 2, row, 1, 1, 0, 0, 0, 0);
890         o = e_widget_radio_add(evas, NULL, -1, rg);
891         e_widget_table_object_append(tab2, o, 3, row, 1, 1, 0, 0, 0, 0);
892         row++;
893      }
894    if (cfdata->edit_il == cfdata->borders_il)
895      {
896         lb = e_widget_label_add(evas, _("Modal"));
897         e_widget_table_object_append(tab2, lb, 0, row, 1, 1, 1, 0, 1, 0);
898         rg = e_widget_radio_group_new(&m->modal);
899         o = e_widget_radio_add(evas, NULL, 0, rg);
900         e_widget_table_object_append(tab2, o, 1, row, 1, 1, 0, 0, 0, 0);
901         o = e_widget_radio_add(evas, NULL, 1, rg);
902         e_widget_table_object_append(tab2, o, 2, row, 1, 1, 0, 0, 0, 0);
903         o = e_widget_radio_add(evas, NULL, -1, rg);
904         e_widget_table_object_append(tab2, o, 3, row, 1, 1, 0, 0, 0, 0);
905         row++;
906      }
907    e_widget_toolbook_page_append(tb, NULL, _("Flags"), tab2,
908                                  1, 1, 1, 1, 0.5, 0.0);
909
910    oi = _style_selector(evas, &(m->match.shadow_style));
911    e_widget_toolbook_page_append(tb, NULL, _("Style"), oi,
912                                  1, 1, 1, 1, 0.5, 0.0);
913
914    e_widget_frametable_object_append(of, tb, 0, 0, 1, 1, 1, 1, 1, 1);
915    e_widget_toolbook_page_show(tb, 0);
916
917    bt = e_widget_button_add(evas, _("OK"), NULL, _edit_ok, m, of);
918    e_widget_frametable_object_append(of, bt, 0, 1, 1, 1, 0, 0, 0, 0);
919 }
920
921 static void
922 _but_up(void *d1,
923         void *d2)
924 {
925    E_Config_Dialog *cfd = d1;
926    Evas_Object *il = d2;
927    Match_Config *m;
928    int n;
929
930    e_widget_ilist_freeze(il);
931    n = e_widget_ilist_selected_get(il);
932    if (n < 1) return;
933    m = e_widget_ilist_nth_data_get(il, n);
934    if (!m)
935      {
936         e_widget_ilist_thaw(il);
937         return;
938      }
939    e_widget_ilist_remove_num(il, n);
940    n--;
941    _match_ilist_append(il, m, n, 1);
942    e_widget_ilist_nth_show(il, n, 0);
943    e_widget_ilist_selected_set(il, n);
944    e_widget_ilist_thaw(il);
945    e_widget_ilist_go(il);
946    _match_list_up(&(cfd->cfdata->match.popups), m);
947    _match_list_up(&(cfd->cfdata->match.borders), m);
948    _match_list_up(&(cfd->cfdata->match.overrides), m);
949    _match_list_up(&(cfd->cfdata->match.menus), m);
950    cfd->cfdata->match.changed = 1;
951 }
952
953 static void
954 _but_down(void *d1,
955           void *d2)
956 {
957    E_Config_Dialog *cfd = d1;
958    Evas_Object *il = d2;
959    Match_Config *m;
960    int n;
961
962    e_widget_ilist_freeze(il);
963    n = e_widget_ilist_selected_get(il);
964    if (n >= (e_widget_ilist_count(il) - 1)) return;
965    m = e_widget_ilist_nth_data_get(il, n);
966    if (!m)
967      {
968         e_widget_ilist_thaw(il);
969         return;
970      }
971    e_widget_ilist_remove_num(il, n);
972    _match_ilist_append(il, m, n, 0);
973    e_widget_ilist_nth_show(il, n + 1, 0);
974    e_widget_ilist_selected_set(il, n + 1);
975    e_widget_ilist_thaw(il);
976    e_widget_ilist_go(il);
977    _match_list_down(&(cfd->cfdata->match.popups), m);
978    _match_list_down(&(cfd->cfdata->match.borders), m);
979    _match_list_down(&(cfd->cfdata->match.overrides), m);
980    _match_list_down(&(cfd->cfdata->match.menus), m);
981    cfd->cfdata->match.changed = 1;
982 }
983
984 static void
985 _but_add(void *d1,
986          void *d2)
987 {
988    E_Config_Dialog *cfd = d1;
989    Evas_Object *il = d2;
990    Match_Config *m;
991    int n;
992
993    m = E_NEW(Match_Config, 1);
994    m->cfd = cfd;
995    m->match.title = NULL;
996    m->match.name = NULL;
997    m->match.clas = NULL;
998    m->match.role = NULL;
999    m->match.shadow_style = eina_stringshare_add("default");
1000
1001    if (il == cfd->cfdata->popups_il)
1002      cfd->cfdata->match.popups = eina_list_append(cfd->cfdata->match.popups, m);
1003    else if (il == cfd->cfdata->borders_il)
1004      cfd->cfdata->match.borders = eina_list_append(cfd->cfdata->match.borders, m);
1005    else if (il == cfd->cfdata->overrides_il)
1006      cfd->cfdata->match.overrides = eina_list_append(cfd->cfdata->match.overrides, m);
1007    else if (il == cfd->cfdata->menus_il)
1008      cfd->cfdata->match.menus = eina_list_append(cfd->cfdata->match.menus, m);
1009    e_widget_ilist_freeze(il);
1010    _match_ilist_append(il, m, -1, 0);
1011    e_widget_ilist_thaw(il);
1012    e_widget_ilist_go(il);
1013    n = e_widget_ilist_count(il);
1014    e_widget_ilist_nth_show(il, n - 1, 0);
1015    e_widget_ilist_selected_set(il, n - 1);
1016
1017    cfd->cfdata->edit_il = il;
1018    _create_edit_frame(cfd, evas_object_evas_get(il), cfd->cfdata, m);
1019    cfd->cfdata->match.changed = 1;
1020 }
1021
1022 static void
1023 _but_del(void *d1,
1024          void *d2)
1025 {
1026    E_Config_Dialog *cfd = d1;
1027    Evas_Object *il = d2;
1028    Match_Config *m;
1029    int n;
1030
1031    e_widget_ilist_freeze(il);
1032    n = e_widget_ilist_selected_get(il);
1033    m = e_widget_ilist_nth_data_get(il, n);
1034    if (!m)
1035      {
1036         e_widget_ilist_thaw(il);
1037         return;
1038      }
1039    e_widget_ilist_remove_num(il, n);
1040    e_widget_ilist_thaw(il);
1041    e_widget_ilist_go(il);
1042    _match_list_del(&(cfd->cfdata->match.popups), m);
1043    _match_list_del(&(cfd->cfdata->match.borders), m);
1044    _match_list_del(&(cfd->cfdata->match.overrides), m);
1045    _match_list_del(&(cfd->cfdata->match.menus), m);
1046    cfd->cfdata->match.changed = 1;
1047 }
1048
1049 static void
1050 _but_edit(void *d1,
1051           void *d2)
1052 {
1053    E_Config_Dialog *cfd = d1;
1054    Evas_Object *il = d2;
1055    int n;
1056    Match_Config *m;
1057
1058    n = e_widget_ilist_selected_get(il);
1059    m = e_widget_ilist_nth_data_get(il, n);
1060    if (!m) return;
1061
1062    cfd->cfdata->edit_il = il;
1063    _create_edit_frame(cfd, evas_object_evas_get(il), cfd->cfdata, m);
1064    cfd->cfdata->match.changed = 1;
1065 }
1066
1067 static Evas_Object *
1068 _create_match_editor(E_Config_Dialog *cfd,
1069                      Evas *evas,
1070                      E_Config_Dialog_Data *cfdata __UNUSED__,
1071                      Eina_List **matches,
1072                      Evas_Object **il_ret)
1073 {
1074    Evas_Object *tab, *il, *bt;
1075    Match_Config *m;
1076    Eina_List *l;
1077
1078    tab = e_widget_table_add(evas, 0);
1079
1080    il = e_widget_ilist_add(evas, 16, 16, NULL);
1081    e_widget_size_min_set(il, 160, 100);
1082
1083    EINA_LIST_FOREACH(*matches, l, m)
1084      {
1085         _match_ilist_append(il, m, -1, 0);
1086      }
1087
1088    e_widget_ilist_go(il);
1089    e_widget_table_object_append(tab, il, 0, 0, 1, 5, 1, 1, 1, 1);
1090
1091    bt = e_widget_button_add(evas, _("Up"), NULL, _but_up, cfd, il);
1092    e_widget_table_object_append(tab, bt, 1, 0, 1, 1, 1, 1, 0, 0);
1093    bt = e_widget_button_add(evas, _("Down"), NULL, _but_down, cfd, il);
1094    e_widget_table_object_append(tab, bt, 1, 1, 1, 1, 1, 1, 0, 0);
1095    bt = e_widget_button_add(evas, _("Add"), NULL, _but_add, cfd, il);
1096    e_widget_table_object_append(tab, bt, 1, 2, 1, 1, 1, 1, 0, 0);
1097    bt = e_widget_button_add(evas, _("Del"), NULL, _but_del, cfd, il);
1098    e_widget_table_object_append(tab, bt, 1, 3, 1, 1, 1, 1, 0, 0);
1099    bt = e_widget_button_add(evas, _("Edit"), NULL, _but_edit, cfd, il);
1100    e_widget_table_object_append(tab, bt, 1, 4, 1, 1, 1, 1, 0, 0);
1101
1102    *il_ret = il;
1103
1104    return tab;
1105 }
1106
1107 static Evas_Object *
1108 _create_styles_toolbook(E_Config_Dialog *cfd,
1109                         Evas *evas,
1110                         E_Config_Dialog_Data *cfdata)
1111 {
1112    Evas_Object *tb, *oi, *il;
1113
1114    tb = e_widget_toolbook_add(evas, 48 * e_scale, 48 * e_scale);
1115
1116    oi = _style_selector(evas, &(cfdata->shadow_style));
1117    e_widget_toolbook_page_append(tb, NULL, _("Default"), oi, 1, 1, 1, 1, 0.5, 0.0);
1118
1119    oi = _create_match_editor(cfd, evas, cfdata, &(cfdata->match.borders), &il);
1120    cfdata->borders_il = il;
1121    e_widget_toolbook_page_append(tb, NULL, _("Apps"), oi, 1, 1, 1, 1, 0.5, 0.0);
1122
1123    oi = _create_match_editor(cfd, evas, cfdata, &(cfdata->match.popups), &il);
1124    cfdata->popups_il = il;
1125    e_widget_toolbook_page_append(tb, NULL, _("E"), oi, 1, 1, 1, 1, 0.5, 0.0);
1126
1127    oi = _create_match_editor(cfd, evas, cfdata, &(cfdata->match.overrides), &il);
1128    cfdata->overrides_il = il;
1129    e_widget_toolbook_page_append(tb, NULL, _("Over"), oi, 1, 1, 1, 1, 0.5, 0.0);
1130
1131    oi = _create_match_editor(cfd, evas, cfdata, &(cfdata->match.menus), &il);
1132    cfdata->menus_il = il;
1133    e_widget_toolbook_page_append(tb, NULL, _("Menus"), oi, 1, 1, 1, 1, 0.5, 0.0);
1134
1135    e_widget_toolbook_page_show(tb, 0);
1136
1137    return tb;
1138 }
1139
1140 static Evas_Object *
1141 _advanced_create_widgets(E_Config_Dialog *cfd,
1142                          Evas *evas,
1143                          E_Config_Dialog_Data *cfdata)
1144 {
1145    Evas_Object *ob,*ol, *ol2, *of, *otb, *oi, *orec0, *tab;
1146    E_Radio_Group *rg;
1147
1148    orec0 = evas_object_rectangle_add(evas);
1149    evas_object_name_set(orec0, "style_shadows");
1150
1151    tab = e_widget_table_add(evas, 0);
1152    evas_object_name_set(tab, "dia_table");
1153
1154    otb = e_widget_toolbook_add(evas, 48 * e_scale, 48 * e_scale);
1155
1156    ///////////////////////////////////////////
1157    ol = e_widget_list_add(evas, 0, 0);
1158    ob = e_widget_check_add(evas, _("Limit framerate"), &(cfdata->lock_fps));
1159    e_widget_list_object_append(ol, ob, 1, 0, 0.5);
1160    ob = e_widget_check_add(evas, _("Smooth scaling"), &(cfdata->smooth_windows));
1161    e_widget_list_object_append(ol, ob, 1, 0, 0.5);
1162
1163    of = e_widget_frametable_add(evas, _("Styles"), 0);
1164    e_widget_frametable_content_align_set(of, 0.5, 0.5);
1165    oi = _create_styles_toolbook(cfd, evas, cfdata);
1166    e_widget_frametable_object_append(of, oi, 0, 0, 1, 1, 1, 1, 1, 1);
1167    e_widget_list_object_append(ol, of, 1, 1, 0.5);
1168
1169    e_widget_toolbook_page_append(otb, NULL, _("Effects"), ol, 1, 1, 1, 1, 0.5, 0.0);
1170
1171    ///////////////////////////////////////////
1172    ol = e_widget_list_add(evas, 0, 0);
1173    ob = e_widget_check_add(evas, _("Tear-free updates (VSynced)"), &(cfdata->vsync));
1174    e_widget_list_object_append(ol, ob, 1, 1, 0.5);
1175    ob = e_widget_check_add(evas, _("Sync windows"), &(cfdata->efl_sync));
1176    e_widget_list_object_append(ol, ob, 1, 1, 0.5);
1177    ob = e_widget_check_add(evas, _("Loose sync"), &(cfdata->loose_sync));
1178    e_widget_list_object_append(ol, ob, 1, 1, 0.5);
1179    ob = e_widget_check_add(evas, _("Grab Server during draw"), &(cfdata->grab));
1180    e_widget_list_object_append(ol, ob, 1, 1, 0.5);
1181    ob = e_widget_label_add(evas, _("Initial draw timeout for newly mapped windows"));
1182    e_widget_list_object_append(ol, ob, 1, 1, 0.5);
1183    ob = e_widget_slider_add(evas, 1, 0, _("%1.2f Seconds"), 0.01, 0.5, 0.01, 0, &(cfdata->first_draw_delay), NULL, 150);
1184    e_widget_list_object_append(ol, ob, 1, 1, 0.5);
1185    e_widget_toolbook_page_append(otb, NULL, _("Sync"), ol, 0, 0, 0, 0, 0.5, 0.0);
1186
1187    ///////////////////////////////////////////
1188    ol = e_widget_list_add(evas, 0, 0);
1189    rg = e_widget_radio_group_new(&(cfdata->engine));
1190    ob = e_widget_radio_add(evas, _("Software"), ENGINE_SW, rg);
1191    e_widget_list_object_append(ol, ob, 1, 1, 0.5);
1192    if (!getenv("ECORE_X_NO_XLIB"))
1193      {
1194         if (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_OPENGL_X11))
1195           {
1196              ob = e_widget_radio_add(evas, _("OpenGL"), ENGINE_GL, rg);
1197              e_widget_list_object_append(ol, ob, 1, 1, 0.5);
1198
1199              of = e_widget_framelist_add(evas, _("OpenGL options"), 0);
1200              e_widget_framelist_content_align_set(of, 0.5, 0.0);
1201              ob = e_widget_check_add(evas, _("Texture from pixmap"), &(cfdata->texture_from_pixmap));
1202              e_widget_framelist_object_append(of, ob);
1203              ob = e_widget_check_add(evas, _("Indirect OpenGL (EXPERIMENTAL)"), &(cfdata->indirect));
1204              e_widget_framelist_object_append(of, ob);
1205              e_widget_list_object_append(ol, of, 1, 1, 0.5);
1206           }
1207      }
1208    e_widget_toolbook_page_append(otb, NULL, _("Engine"), ol, 0, 0, 0, 0, 0.5, 0.0);
1209
1210    ///////////////////////////////////////////
1211    ol = e_widget_list_add(evas, 0, 0);
1212    ob = e_widget_check_add(evas, _("Send flush"), &(cfdata->send_flush));
1213    e_widget_list_object_append(ol, ob, 1, 1, 0.5);
1214    ob = e_widget_check_add(evas, _("Send dump"), &(cfdata->send_dump));
1215    e_widget_list_object_append(ol, ob, 1, 1, 0.5);
1216    ob = e_widget_check_add(evas, _("Don't composite fullscreen windows"), &(cfdata->nocomp_fs));
1217    e_widget_list_object_append(ol, ob, 1, 1, 0.5);
1218    ob = e_widget_check_add(evas, _("Keep hidden windows"), &(cfdata->keep_unmapped));
1219    e_widget_list_object_append(ol, ob, 1, 1, 0.5);
1220    of = e_widget_frametable_add(evas, _("Maximum hidden pixels"), 0);
1221    e_widget_frametable_content_align_set(of, 0.5, 0.5);
1222    rg = e_widget_radio_group_new(&(cfdata->max_unmapped_pixels));
1223    ob = e_widget_radio_add(evas, _("1M"), 1 * 1024, rg);
1224    e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 1, 1, 0, 0);
1225    ob = e_widget_radio_add(evas, _("2M"), 2 * 1024, rg);
1226    e_widget_frametable_object_append(of, ob, 0, 1, 1, 1, 1, 1, 0, 0);
1227    ob = e_widget_radio_add(evas, _("4M"), 4 * 1024, rg);
1228    e_widget_frametable_object_append(of, ob, 0, 2, 1, 1, 1, 1, 0, 0);
1229    ob = e_widget_radio_add(evas, _("8M"), 8 * 1024, rg);
1230    e_widget_frametable_object_append(of, ob, 1, 0, 1, 1, 1, 1, 0, 0);
1231    ob = e_widget_radio_add(evas, _("16M"), 16 * 1024, rg);
1232    e_widget_frametable_object_append(of, ob, 1, 1, 1, 1, 1, 1, 0, 0);
1233    ob = e_widget_radio_add(evas, _("32M"), 32 * 1024, rg);
1234    e_widget_frametable_object_append(of, ob, 1, 2, 1, 1, 1, 1, 0, 0);
1235    ob = e_widget_radio_add(evas, _("64M"), 64 * 1024, rg);
1236    e_widget_frametable_object_append(of, ob, 2, 0, 1, 1, 1, 1, 0, 0);
1237    ob = e_widget_radio_add(evas, _("128M"), 128 * 1024, rg);
1238    e_widget_frametable_object_append(of, ob, 2, 1, 1, 1, 1, 1, 0, 0);
1239    ob = e_widget_radio_add(evas, _("256M"), 256 * 1024, rg);
1240    e_widget_frametable_object_append(of, ob, 2, 2, 1, 1, 1, 1, 0, 0);
1241    e_widget_list_object_append(ol, of, 1, 1, 0.5);
1242    e_widget_toolbook_page_append(otb, NULL, _("Memory"), ol, 0, 0, 0, 0, 0.5, 0.0);
1243
1244    ///////////////////////////////////////////
1245    ol = e_widget_list_add(evas, 0, 0);
1246    ol2 = e_widget_list_add(evas, 1, 1);
1247    of = e_widget_framelist_add(evas, _("Min hidden"), 0);
1248    e_widget_framelist_content_align_set(of, 0.5, 0.0);
1249    rg = e_widget_radio_group_new(&(cfdata->min_unmapped_time));
1250    ob = e_widget_radio_add(evas, _("30 Seconds"), 30, rg);
1251    e_widget_framelist_object_append(of, ob);
1252    ob = e_widget_radio_add(evas, _("1 Minute"), 60, rg);
1253    e_widget_framelist_object_append(of, ob);
1254    ob = e_widget_radio_add(evas, _("5 Minutes"), 5 * 60, rg);
1255    e_widget_framelist_object_append(of, ob);
1256    ob = e_widget_radio_add(evas, _("30 Minutes"), 30 * 60, rg);
1257    e_widget_framelist_object_append(of, ob);
1258    ob = e_widget_radio_add(evas, _("2 Hours"), 2 * 3600, rg);
1259    e_widget_framelist_object_append(of, ob);
1260    ob = e_widget_radio_add(evas, _("10 Hours"), 10 * 3600, rg);
1261    e_widget_framelist_object_append(of, ob);
1262    ob = e_widget_radio_add(evas, _("Forever"), 0, rg);
1263    e_widget_framelist_object_append(of, ob);
1264    e_widget_list_object_append(ol2, of, 1, 1, 0.5);
1265    of = e_widget_framelist_add(evas, _("Max hidden"), 0);
1266    e_widget_framelist_content_align_set(of, 0.5, 0.0);
1267    rg = e_widget_radio_group_new(&(cfdata->max_unmapped_time));
1268    ob = e_widget_radio_add(evas, _("30 Seconds"), 30, rg);
1269    e_widget_framelist_object_append(of, ob);
1270    ob = e_widget_radio_add(evas, _("1 Minute"), 60, rg);
1271    e_widget_framelist_object_append(of, ob);
1272    ob = e_widget_radio_add(evas, _("5 Minutes"), 5 * 60, rg);
1273    e_widget_framelist_object_append(of, ob);
1274    ob = e_widget_radio_add(evas, _("30 Minutes"), 30 * 60, rg);
1275    e_widget_framelist_object_append(of, ob);
1276    ob = e_widget_radio_add(evas, _("2 Hours"), 2 * 3600, rg);
1277    e_widget_framelist_object_append(of, ob);
1278    ob = e_widget_radio_add(evas, _("10 Hours"), 10 * 3600, rg);
1279    e_widget_framelist_object_append(of, ob);
1280    ob = e_widget_radio_add(evas, _("Forever"), 0, rg);
1281    e_widget_framelist_object_append(of, ob);
1282    e_widget_list_object_append(ol2, of, 1, 1, 0.5);
1283    e_widget_list_object_append(ol, ol2, 1, 1, 0.5);
1284    e_widget_toolbook_page_append(otb, NULL, _("Timeouts"), ol, 0, 0, 0, 0, 0.5, 0.0);
1285
1286    ///////////////////////////////////////////
1287    ol = e_widget_list_add(evas, 0, 0);
1288
1289    ob = e_widget_check_add(evas, _("Show Framerate"), &(cfdata->fps_show));
1290    e_widget_list_object_append(ol, ob, 1, 1, 0.5);
1291    ob = e_widget_label_add(evas, _("Rolling average frame count"));
1292    e_widget_list_object_append(ol, ob, 1, 1, 0.5);
1293    ob = e_widget_slider_add(evas, 1, 0, _("%1.0f Frames"), 1, 120, 1, 0,
1294                             NULL, &(cfdata->fps_average_range), 240);
1295    e_widget_list_object_append(ol, ob, 1, 1, 0.5);
1296
1297    of = e_widget_frametable_add(evas, _("Corner"), 0);
1298    e_widget_frametable_content_align_set(of, 0.5, 0.5);
1299    rg = e_widget_radio_group_new(&(cfdata->fps_corner));
1300    ob = e_widget_radio_icon_add(evas, "Top Left", "preferences-position-top-left",
1301                                 24, 24, 0, rg);
1302    e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 1, 1, 1, 1);
1303    ob = e_widget_radio_icon_add(evas, "Top Right", "preferences-position-top-right",
1304                                 24, 24, 1, rg);
1305    e_widget_frametable_object_append(of, ob, 1, 0, 1, 1, 1, 1, 1, 1);
1306    ob = e_widget_radio_icon_add(evas, "Bottom Left", "preferences-position-bottom-left",
1307                                 24, 24, 2, rg);
1308    e_widget_frametable_object_append(of, ob, 0, 1, 1, 1, 1, 1, 1, 1);
1309    ob = e_widget_radio_icon_add(evas, "Bottom Right", "preferences-position-bottom-right",
1310                                 24, 24, 3, rg);
1311    e_widget_frametable_object_append(of, ob, 1, 1, 1, 1, 1, 1, 1, 1);
1312    e_widget_list_object_append(ol, of, 1, 1, 0.5);
1313
1314    e_widget_toolbook_page_append(otb, NULL, _("Debug"), ol, 0, 0, 0, 0, 0.5, 0.0);
1315
1316    e_widget_toolbook_page_show(otb, 0);
1317
1318    e_dialog_resizable_set(cfd->dia, 1);
1319
1320    e_widget_table_object_append(tab, otb, 0, 0, 1, 1, 1, 1, 1, 1);
1321    return tab;
1322 }
1323
1324 static void
1325 _match_list_free(Eina_List *list)
1326 {
1327    Match *m;
1328
1329    EINA_LIST_FREE(list, m)
1330      {
1331         if (m->title) eina_stringshare_del(m->title);
1332         if (m->name) eina_stringshare_del(m->name);
1333         if (m->clas) eina_stringshare_del(m->clas);
1334         if (m->role) eina_stringshare_del(m->role);
1335         if (m->shadow_style) eina_stringshare_del(m->shadow_style);
1336         free(m);
1337      }
1338 }
1339
1340 static void
1341 _match_dup2(Match_Config *m2,
1342             Match *m)
1343 {
1344    *m = m2->match;
1345    if (m->title) m->title = eina_stringshare_add(m->title);
1346    if (m->name) m->name = eina_stringshare_add(m->name);
1347    if (m->clas) m->clas = eina_stringshare_add(m->clas);
1348    if (m->role) m->role = eina_stringshare_add(m->role);
1349    if (m->shadow_style) m->shadow_style = eina_stringshare_add(m->shadow_style);
1350 }
1351
1352 static int
1353 _advanced_apply_data(E_Config_Dialog *cfd  __UNUSED__,
1354                      E_Config_Dialog_Data *cfdata)
1355 {
1356    if ((cfdata->lock_fps != _comp_mod->conf->lock_fps) ||
1357        (cfdata->smooth_windows != _comp_mod->conf->smooth_windows) ||
1358        (cfdata->grab != _comp_mod->conf->grab) ||
1359        (cfdata->keep_unmapped != _comp_mod->conf->keep_unmapped) ||
1360        (cfdata->nocomp_fs != _comp_mod->conf->nocomp_fs) ||
1361        (cfdata->shadow_style != _comp_mod->conf->shadow_style) ||
1362        (cfdata->max_unmapped_pixels != _comp_mod->conf->max_unmapped_pixels) ||
1363        (cfdata->max_unmapped_time != _comp_mod->conf->max_unmapped_time) ||
1364        (cfdata->min_unmapped_time != _comp_mod->conf->min_unmapped_time) ||
1365        (cfdata->send_flush != _comp_mod->conf->send_flush) ||
1366        (cfdata->send_dump != _comp_mod->conf->send_dump) ||
1367        (cfdata->fps_show != _comp_mod->conf->fps_show) ||
1368        (cfdata->fps_corner != _comp_mod->conf->fps_corner) ||
1369        (cfdata->fps_average_range != _comp_mod->conf->fps_average_range) ||
1370        (cfdata->first_draw_delay != _comp_mod->conf->first_draw_delay) ||
1371        (cfdata->match.changed)
1372        )
1373      {
1374         if (cfdata->match.changed)
1375           {
1376              Eina_List *l;
1377              Match *m;
1378              Match_Config *m2;
1379
1380              _match_list_free(_comp_mod->conf->match.popups);
1381              _match_list_free(_comp_mod->conf->match.borders);
1382              _match_list_free(_comp_mod->conf->match.overrides);
1383              _match_list_free(_comp_mod->conf->match.menus);
1384
1385              _comp_mod->conf->match.popups = NULL;
1386              _comp_mod->conf->match.borders = NULL;
1387              _comp_mod->conf->match.overrides = NULL;
1388              _comp_mod->conf->match.menus = NULL;
1389
1390              EINA_LIST_FOREACH(cfdata->match.popups, l, m2)
1391                {
1392                   m = E_NEW(Match, 1);
1393                   _match_dup2(m2, m);
1394                   _comp_mod->conf->match.popups =
1395                     eina_list_append(_comp_mod->conf->match.popups, m);
1396                }
1397              EINA_LIST_FOREACH(cfdata->match.borders, l, m2)
1398                {
1399                   m = E_NEW(Match, 1);
1400                   _match_dup2(m2, m);
1401                   _comp_mod->conf->match.borders =
1402                     eina_list_append(_comp_mod->conf->match.borders, m);
1403                }
1404              EINA_LIST_FOREACH(cfdata->match.overrides, l, m2)
1405                {
1406                   m = E_NEW(Match, 1);
1407                   _match_dup2(m2, m);
1408                   _comp_mod->conf->match.overrides =
1409                     eina_list_append(_comp_mod->conf->match.overrides, m);
1410                }
1411              EINA_LIST_FOREACH(cfdata->match.menus, l, m2)
1412                {
1413                   m = E_NEW(Match, 1);
1414                   _match_dup2(m2, m);
1415                   _comp_mod->conf->match.menus =
1416                     eina_list_append(_comp_mod->conf->match.menus, m);
1417                }
1418              cfdata->match.changed = 0;
1419           }
1420         _comp_mod->conf->lock_fps = cfdata->lock_fps;
1421         _comp_mod->conf->smooth_windows = cfdata->smooth_windows;
1422         _comp_mod->conf->grab = cfdata->grab;
1423         _comp_mod->conf->keep_unmapped = cfdata->keep_unmapped;
1424         _comp_mod->conf->nocomp_fs = cfdata->nocomp_fs;
1425         _comp_mod->conf->max_unmapped_pixels = cfdata->max_unmapped_pixels;
1426         _comp_mod->conf->max_unmapped_time = cfdata->max_unmapped_time;
1427         _comp_mod->conf->min_unmapped_time = cfdata->min_unmapped_time;
1428         _comp_mod->conf->send_flush = cfdata->send_flush;
1429         _comp_mod->conf->send_dump = cfdata->send_dump;
1430         _comp_mod->conf->fps_show = cfdata->fps_show;
1431         _comp_mod->conf->fps_corner = cfdata->fps_corner;
1432         _comp_mod->conf->fps_average_range = cfdata->fps_average_range;
1433         _comp_mod->conf->first_draw_delay = cfdata->first_draw_delay;
1434         if (_comp_mod->conf->shadow_style)
1435           eina_stringshare_del(_comp_mod->conf->shadow_style);
1436         _comp_mod->conf->shadow_style = NULL;
1437         if (cfdata->shadow_style)
1438           _comp_mod->conf->shadow_style = eina_stringshare_add(cfdata->shadow_style);
1439         e_mod_comp_shadow_set();
1440      }
1441    if ((cfdata->engine != _comp_mod->conf->engine) ||
1442        (cfdata->indirect != _comp_mod->conf->indirect) ||
1443        (cfdata->texture_from_pixmap != _comp_mod->conf->texture_from_pixmap) ||
1444        (cfdata->efl_sync != _comp_mod->conf->efl_sync) ||
1445        (cfdata->loose_sync != _comp_mod->conf->loose_sync) ||
1446        (cfdata->vsync != _comp_mod->conf->vsync))
1447      {
1448         E_Action *a;
1449
1450         _comp_mod->conf->engine = cfdata->engine;
1451         _comp_mod->conf->indirect = cfdata->indirect;
1452         _comp_mod->conf->texture_from_pixmap = cfdata->texture_from_pixmap;
1453         _comp_mod->conf->efl_sync = cfdata->efl_sync;
1454         _comp_mod->conf->loose_sync = cfdata->loose_sync;
1455         _comp_mod->conf->vsync = cfdata->vsync;
1456
1457         a = e_action_find("restart");
1458         if ((a) && (a->func.go)) a->func.go(NULL, NULL);
1459 //        e_mod_comp_shutdown();
1460 //        e_mod_comp_init();
1461      }
1462    e_config_save_queue();
1463    return 1;
1464 }
1465
1466 static Evas_Object *
1467 _basic_create_widgets(E_Config_Dialog *cfd,
1468                       Evas *evas,
1469                       E_Config_Dialog_Data *cfdata)
1470 {
1471    Evas_Object *ob,*ol, *of, *otb, *oi, *orec0, *tab;
1472    E_Radio_Group *rg;
1473
1474    orec0 = evas_object_rectangle_add(evas);
1475    evas_object_name_set(orec0, "style_shadows");
1476
1477    tab = e_widget_table_add(evas, 0);
1478    evas_object_name_set(tab, "dia_table");
1479
1480    otb = e_widget_toolbook_add(evas, 48 * e_scale, 48 * e_scale);
1481
1482    ///////////////////////////////////////////
1483    ol = e_widget_list_add(evas, 0, 0);
1484    
1485    ob = e_widget_check_add(evas, _("Tear-free updates (VSynced)"), &(cfdata->vsync));
1486    e_widget_list_object_append(ol, ob, 1, 0, 0.5);
1487    
1488    ob = e_widget_check_add(evas, _("Smooth scaling of window content"), &(cfdata->smooth_windows));
1489    e_widget_list_object_append(ol, ob, 1, 0, 0.5);
1490
1491    ob = e_widget_check_add(evas, _("Don't composite fullscreen windows"), &(cfdata->nocomp_fs));
1492    e_widget_list_object_append(ol, ob, 1, 0, 0.5);
1493    
1494    of = e_widget_frametable_add(evas, _("Select default style"), 0);
1495    e_widget_frametable_content_align_set(of, 0.5, 0.5);
1496    oi = _style_selector(evas, &(cfdata->shadow_style));
1497    e_widget_frametable_object_append(of, oi, 0, 0, 1, 1, 1, 1, 1, 1);
1498    e_widget_list_object_append(ol, of, 1, 1, 0.5);
1499
1500    e_widget_toolbook_page_append(otb, NULL, _("General"), ol, 1, 1, 1, 1, 0.5, 0.0);
1501
1502    ///////////////////////////////////////////
1503    ol = e_widget_list_add(evas, 0, 0);
1504    rg = e_widget_radio_group_new(&(cfdata->engine));
1505    ob = e_widget_radio_add(evas, _("Software"), ENGINE_SW, rg);
1506    e_widget_list_object_append(ol, ob, 1, 1, 0.5);
1507    if (!getenv("ECORE_X_NO_XLIB"))
1508      {
1509         if (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_OPENGL_X11))
1510           {
1511              ob = e_widget_radio_add(evas, _("OpenGL"), ENGINE_GL, rg);
1512              e_widget_list_object_append(ol, ob, 1, 1, 0.5);
1513           }
1514      }
1515    ob = e_widget_label_add(evas, _("To reset compositor:"));
1516    e_widget_list_object_append(ol, ob, 1, 1, 0.5);
1517    ob = e_widget_label_add(evas, _("Ctrl+Alt+Shift+Home"));
1518    e_widget_list_object_append(ol, ob, 1, 1, 0.5);
1519    
1520    e_widget_toolbook_page_append(otb, NULL, _("Rendering"), ol, 0, 0, 0, 0, 0.5, 0.0);
1521
1522    e_widget_toolbook_page_show(otb, 0);
1523
1524    e_dialog_resizable_set(cfd->dia, 1);
1525
1526    e_widget_table_object_append(tab, otb, 0, 0, 1, 1, 1, 1, 1, 1);
1527    return tab;
1528 }
1529
1530 static int
1531 _basic_apply_data(E_Config_Dialog *cfd  __UNUSED__,
1532                   E_Config_Dialog_Data *cfdata)
1533 {
1534    if ((cfdata->lock_fps != _comp_mod->conf->lock_fps) ||
1535        (cfdata->smooth_windows != _comp_mod->conf->smooth_windows) ||
1536        (cfdata->grab != _comp_mod->conf->grab) ||
1537        (cfdata->keep_unmapped != _comp_mod->conf->keep_unmapped) ||
1538        (cfdata->nocomp_fs != _comp_mod->conf->nocomp_fs) ||
1539        (cfdata->shadow_style != _comp_mod->conf->shadow_style) ||
1540        (cfdata->max_unmapped_pixels != _comp_mod->conf->max_unmapped_pixels) ||
1541        (cfdata->max_unmapped_time != _comp_mod->conf->max_unmapped_time) ||
1542        (cfdata->min_unmapped_time != _comp_mod->conf->min_unmapped_time) ||
1543        (cfdata->send_flush != _comp_mod->conf->send_flush) ||
1544        (cfdata->send_dump != _comp_mod->conf->send_dump) ||
1545        (cfdata->fps_show != _comp_mod->conf->fps_show) ||
1546        (cfdata->fps_corner != _comp_mod->conf->fps_corner) ||
1547        (cfdata->fps_average_range != _comp_mod->conf->fps_average_range) ||
1548        (cfdata->first_draw_delay != _comp_mod->conf->first_draw_delay) ||
1549        (cfdata->match.changed)
1550        )
1551      {
1552         if (cfdata->match.changed)
1553           {
1554              Eina_List *l;
1555              Match *m;
1556              Match_Config *m2;
1557
1558              _match_list_free(_comp_mod->conf->match.popups);
1559              _match_list_free(_comp_mod->conf->match.borders);
1560              _match_list_free(_comp_mod->conf->match.overrides);
1561              _match_list_free(_comp_mod->conf->match.menus);
1562
1563              _comp_mod->conf->match.popups = NULL;
1564              _comp_mod->conf->match.borders = NULL;
1565              _comp_mod->conf->match.overrides = NULL;
1566              _comp_mod->conf->match.menus = NULL;
1567
1568              EINA_LIST_FOREACH(cfdata->match.popups, l, m2)
1569                {
1570                   m = E_NEW(Match, 1);
1571                   _match_dup2(m2, m);
1572                   _comp_mod->conf->match.popups =
1573                     eina_list_append(_comp_mod->conf->match.popups, m);
1574                }
1575              EINA_LIST_FOREACH(cfdata->match.borders, l, m2)
1576                {
1577                   m = E_NEW(Match, 1);
1578                   _match_dup2(m2, m);
1579                   _comp_mod->conf->match.borders =
1580                     eina_list_append(_comp_mod->conf->match.borders, m);
1581                }
1582              EINA_LIST_FOREACH(cfdata->match.overrides, l, m2)
1583                {
1584                   m = E_NEW(Match, 1);
1585                   _match_dup2(m2, m);
1586                   _comp_mod->conf->match.overrides =
1587                     eina_list_append(_comp_mod->conf->match.overrides, m);
1588                }
1589              EINA_LIST_FOREACH(cfdata->match.menus, l, m2)
1590                {
1591                   m = E_NEW(Match, 1);
1592                   _match_dup2(m2, m);
1593                   _comp_mod->conf->match.menus =
1594                     eina_list_append(_comp_mod->conf->match.menus, m);
1595                }
1596              cfdata->match.changed = 0;
1597           }
1598         _comp_mod->conf->lock_fps = cfdata->lock_fps;
1599         _comp_mod->conf->smooth_windows = cfdata->smooth_windows;
1600         _comp_mod->conf->grab = cfdata->grab;
1601         _comp_mod->conf->keep_unmapped = cfdata->keep_unmapped;
1602         _comp_mod->conf->nocomp_fs = cfdata->nocomp_fs;
1603         _comp_mod->conf->max_unmapped_pixels = cfdata->max_unmapped_pixels;
1604         _comp_mod->conf->max_unmapped_time = cfdata->max_unmapped_time;
1605         _comp_mod->conf->min_unmapped_time = cfdata->min_unmapped_time;
1606         _comp_mod->conf->send_flush = cfdata->send_flush;
1607         _comp_mod->conf->send_dump = cfdata->send_dump;
1608         _comp_mod->conf->fps_show = cfdata->fps_show;
1609         _comp_mod->conf->fps_corner = cfdata->fps_corner;
1610         _comp_mod->conf->fps_average_range = cfdata->fps_average_range;
1611         _comp_mod->conf->first_draw_delay = cfdata->first_draw_delay;
1612         if (_comp_mod->conf->shadow_style)
1613           eina_stringshare_del(_comp_mod->conf->shadow_style);
1614         _comp_mod->conf->shadow_style = NULL;
1615         if (cfdata->shadow_style)
1616           _comp_mod->conf->shadow_style = eina_stringshare_add(cfdata->shadow_style);
1617         e_mod_comp_shadow_set();
1618      }
1619    if ((cfdata->engine != _comp_mod->conf->engine) ||
1620        (cfdata->indirect != _comp_mod->conf->indirect) ||
1621        (cfdata->texture_from_pixmap != _comp_mod->conf->texture_from_pixmap) ||
1622        (cfdata->efl_sync != _comp_mod->conf->efl_sync) ||
1623        (cfdata->loose_sync != _comp_mod->conf->loose_sync) ||
1624        (cfdata->vsync != _comp_mod->conf->vsync))
1625      {
1626         E_Action *a;
1627
1628         _comp_mod->conf->engine = cfdata->engine;
1629         _comp_mod->conf->indirect = cfdata->indirect;
1630         _comp_mod->conf->texture_from_pixmap = cfdata->texture_from_pixmap;
1631         _comp_mod->conf->efl_sync = cfdata->efl_sync;
1632         _comp_mod->conf->loose_sync = cfdata->loose_sync;
1633         _comp_mod->conf->vsync = cfdata->vsync;
1634
1635         a = e_action_find("restart");
1636         if ((a) && (a->func.go)) a->func.go(NULL, NULL);
1637 //        e_mod_comp_shutdown();
1638 //        e_mod_comp_init();
1639      }
1640    e_config_save_queue();
1641    return 1;
1642 }
1643