split conf_comp->advanced match settings into separate dialog to make comp settings dialog slightly less insane

SVN revision: 82709
devs/asdfuser/comp-sounds
Mike Blumenkrantz 10 years ago
parent f965a163bf
commit 374580215d
  1. 4
      ChangeLog
  2. 1
      NEWS
  3. 2
      src/modules/Makefile_conf_comp.am
  4. 1193
      src/modules/conf_comp/e_mod_config.c
  5. 8
      src/modules/conf_comp/e_mod_config.h
  6. 867
      src/modules/conf_comp/e_mod_config_match.c
  7. 190
      src/modules/conf_comp/e_mod_main.c
  8. 26
      src/modules/conf_comp/e_mod_main.h

@ -1,3 +1,7 @@
2013-01-12 Mike Blumenkrantz
* split comp window match settings into separate dialog
2013-01-11 Mike Blumenkrantz
* e_manager_comp_set() is no longer accessible by modules

@ -26,6 +26,7 @@ Additions:
* added options to disable comp effects on types of windows
* added option to disable comp effects on screen
* added options and functionality for "fast" composite effects
* split comp window match settings into separate dialog
Changes:
Modules:

@ -9,7 +9,7 @@ conf_comppkg_LTLIBRARIES = conf_comp/module.la
conf_comp_module_la_SOURCES = conf_comp/e_mod_main.h \
conf_comp/e_mod_main.c \
conf_comp/e_mod_config.c \
conf_comp/e_mod_config.h
conf_comp/e_mod_config_match.c
.PHONY: conf_comp install-conf_comp
conf_comp: $(conf_mppkg_LTLIBRARIES) $(conf_comp_DATA)

File diff suppressed because it is too large Load Diff

@ -1,8 +0,0 @@
#ifdef E_TYPEDEFS
#else
#ifndef E_MOD_CONFIG_H
#define E_MOD_CONFIG_H
E_Config_Dialog *e_int_config_comp_module(E_Container *con,
const char *params __UNUSED__);
#endif
#endif

@ -0,0 +1,867 @@
#include "e.h"
#include "e_mod_main.h"
#include "e_comp.h"
#include "e_comp_cfdata.h"
typedef struct _Match_Config
{
E_Comp_Match match;
E_Config_Dialog *cfd;
char *title, *name, *clas, *role;
int borderless, dialog, accepts_focus, vkbd;
int quickpanel, argb, fullscreen, modal;
} Match_Config;
struct _E_Config_Dialog_Data
{
Eina_List *popups; // used for e popups
Eina_List *borders; // used for borders
Eina_List *overrides; // used for client menus, tooltips etc.
Eina_List *menus; // used for e menus
int changed;
Evas_Object *edit_il;
Evas_Object *popups_il;
Evas_Object *borders_il;
Evas_Object *overrides_il;
Evas_Object *menus_il;
};
static void
_match_dup(E_Comp_Match *m, Match_Config *m2)
{
m2->match = *m;
m2->match.title = eina_stringshare_ref(m2->match.title);
m2->match.name = eina_stringshare_ref(m2->match.name);
m2->match.clas = eina_stringshare_ref(m2->match.clas);
m2->match.role = eina_stringshare_ref(m2->match.role);
m2->match.shadow_style = eina_stringshare_ref(m2->match.shadow_style);
}
static void
_match_free(Match_Config *m)
{
eina_stringshare_del(m->match.title);
eina_stringshare_del(m->match.name);
eina_stringshare_del(m->match.clas);
eina_stringshare_del(m->match.role);
eina_stringshare_del(m->match.shadow_style);
free(m->title);
free(m->name);
free(m->clas);
free(m->role);
free(m);
}
static void
_match_dup2(Match_Config *m2, E_Comp_Match *m)
{
*m = m2->match;
m->title = eina_stringshare_add(m->title);
m->name = eina_stringshare_add(m->name);
m->clas = eina_stringshare_add(m->clas);
m->role = eina_stringshare_add(m->role);
m->shadow_style = eina_stringshare_add(m->shadow_style);
}
static const char *
_match_type_label_get(int type)
{
if (ECORE_X_WINDOW_TYPE_UNKNOWN == type)
return _("Unused");
if (ECORE_X_WINDOW_TYPE_COMBO == type)
return _("Combo");
if (ECORE_X_WINDOW_TYPE_DESKTOP == type)
return _("Desktop");
if (ECORE_X_WINDOW_TYPE_DIALOG == type)
return _("Dialog");
if (ECORE_X_WINDOW_TYPE_DOCK == type)
return _("Dock");
if (ECORE_X_WINDOW_TYPE_DND == type)
return _("Drag and Drop");
if (ECORE_X_WINDOW_TYPE_MENU == type)
return _("Menu");
if (ECORE_X_WINDOW_TYPE_DROPDOWN_MENU == type)
return _("Menu (Dropdown)");
if (ECORE_X_WINDOW_TYPE_POPUP_MENU == type)
return _("Menu (Popup)");
if (ECORE_X_WINDOW_TYPE_NORMAL == type)
return _("Normal");
if (ECORE_X_WINDOW_TYPE_NOTIFICATION == type)
return _("Notification");
if (ECORE_X_WINDOW_TYPE_SPLASH == type)
return _("Splash");
if (ECORE_X_WINDOW_TYPE_TOOLBAR == type)
return _("Toolbar");
if (ECORE_X_WINDOW_TYPE_TOOLTIP == type)
return _("Tooltip");
if (ECORE_X_WINDOW_TYPE_UTILITY == type)
return _("Utility");
return _("Unused");
}
static char *
_match_label_get(Match_Config *m)
{
char *label;
Eina_Strbuf *buf = eina_strbuf_new();
if (m->match.title)
{
eina_strbuf_append(buf, _("Title:"));
eina_strbuf_append(buf, m->match.title);
eina_strbuf_append(buf, _(" / "));
}
if (m->match.primary_type)
{
eina_strbuf_append(buf, _("Type:"));
eina_strbuf_append(buf, _match_type_label_get(m->match.primary_type));
eina_strbuf_append(buf, _(" / "));
}
if (m->match.name)
{
eina_strbuf_append(buf, _("Name:"));
eina_strbuf_append(buf, m->match.name);
eina_strbuf_append(buf, _(" / "));
}
if (m->match.clas)
{
eina_strbuf_append(buf, _("Class:"));
eina_strbuf_append(buf, m->match.clas);
eina_strbuf_append(buf, _(" / "));
}
if (m->match.role)
{
eina_strbuf_append(buf, _("Role:"));
eina_strbuf_append(buf, m->match.role);
eina_strbuf_append(buf, _(" / "));
}
if (m->match.shadow_style)
{
eina_strbuf_append(buf, _("Style:"));
eina_strbuf_append(buf, m->match.shadow_style);
}
if (!eina_strbuf_length_get(buf))
return _("Unknown");
label = eina_strbuf_string_steal(buf);
eina_strbuf_free(buf);
return label;
}
static void
_match_ilist_append(Evas_Object *il, Match_Config *m, int pos, int pre)
{
char *name = _match_label_get(m);
if (pos == -1)
e_widget_ilist_append(il, NULL, name, NULL, m, NULL);
else
{
if (pre)
e_widget_ilist_prepend_relative(il, NULL, name, NULL, m, NULL, pos);
else
e_widget_ilist_append_relative(il, NULL, name, NULL, m, NULL, pos);
}
free(name);
}
static void
_match_list_up(Eina_List **list, Match_Config *m)
{
Eina_List *l, *lp;
l = eina_list_data_find_list(*list, m);
if (!l) return;
lp = l->prev;
*list = eina_list_remove_list(*list, l);
if (lp) *list = eina_list_prepend_relative_list(*list, m, lp);
else *list = eina_list_prepend(*list, m);
}
static void
_match_list_down(Eina_List **list, Match_Config *m)
{
Eina_List *l, *lp;
l = eina_list_data_find_list(*list, m);
if (!l) return;
lp = l->next;
*list = eina_list_remove_list(*list, l);
if (lp) *list = eina_list_append_relative_list(*list, m, lp);
else *list = eina_list_append(*list, m);
}
static void
_match_list_del(Eina_List **list, Match_Config *m)
{
Eina_List *l;
l = eina_list_data_find_list(*list, m);
if (!l) return;
*list = eina_list_remove_list(*list, l);
_match_free(m);
}
static void
_cb_dialog_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
{
Evas_Object *bg, *of;
int x, y, w, h;
of = data;
bg = evas_object_data_get(of, "bg");
evas_object_geometry_get(obj, &x, &y, &w, &h);
evas_object_move(bg, x, y);
evas_object_resize(bg, w, h);
evas_object_move(of, x, y);
evas_object_resize(of, w, h);
}
static void
_edit_ok(void *d1, void *d2)
{
Match_Config *m = d1;
Evas_Object *dia, *bg, *of = d2;
Evas_Object *il;
int n;
if (m->title || m->name || m->clas || m->role)
{
m->cfd->cfdata->changed = 1;
e_config_dialog_changed_set(m->cfd, 1);
eina_stringshare_replace(&m->match.title, NULL);
if (m->title)
{
if (m->title[0]) m->match.title = eina_stringshare_add(m->title);
E_FREE(m->title);
}
eina_stringshare_replace(&m->match.name, NULL);
if (m->name)
{
if (m->name[0]) m->match.name = eina_stringshare_add(m->name);
E_FREE(m->name);
}
eina_stringshare_replace(&m->match.clas, NULL);
if (m->clas)
{
if (m->clas[0]) m->match.clas = eina_stringshare_add(m->clas);
E_FREE(m->clas);
}
eina_stringshare_replace(&m->match.role, NULL);
if (m->role)
{
if (m->role[0]) m->match.role = eina_stringshare_add(m->role);
E_FREE(m->role);
}
m->match.borderless = m->borderless;
m->match.dialog = m->dialog;
m->match.accepts_focus = m->accepts_focus;
m->match.vkbd = m->vkbd;
m->match.quickpanel = m->quickpanel;
m->match.argb = m->argb;
m->match.fullscreen = m->fullscreen;
m->match.modal = m->modal;
il = m->cfd->cfdata->edit_il;
if (il == m->cfd->cfdata->popups_il)
m->cfd->cfdata->popups = eina_list_append(m->cfd->cfdata->popups, m);
else if (il == m->cfd->cfdata->borders_il)
m->cfd->cfdata->borders = eina_list_append(m->cfd->cfdata->borders, m);
else if (il == m->cfd->cfdata->overrides_il)
m->cfd->cfdata->overrides = eina_list_append(m->cfd->cfdata->overrides, m);
else if (il == m->cfd->cfdata->menus_il)
m->cfd->cfdata->menus = eina_list_append(m->cfd->cfdata->menus, m);
_match_ilist_append(il, m, -1, 0);
n = e_widget_ilist_count(il);
e_widget_ilist_nth_show(il, n - 1, 0);
e_widget_ilist_selected_set(il, n - 1);
}
bg = evas_object_data_get(of, "bg");
dia = evas_object_data_get(of, "dia");
evas_object_event_callback_del(dia, EVAS_CALLBACK_RESIZE, _cb_dialog_resize);
evas_object_del(bg);
evas_object_del(of);
}
static void
_create_edit_frame(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata, Match_Config *m)
{
Evas_Object *of, *oi, *lb, *en, *bt, *tb, *tab2, *o, *sf, *li;
E_Radio_Group *rg;
int row;
int x, y, w, h, mw, mh;
o = edje_object_add(evas);
e_theme_edje_object_set(o, "base/theme/dialog", "e/widgets/dialog/main");
evas_object_geometry_get(cfd->dia->bg_object, &x, &y, &w, &h);
evas_object_move(o, x, y);
evas_object_resize(o, w, h);
evas_object_show(o);
of = e_widget_frametable_add(evas, _("Edit E_Comp_Match"), 0);
evas_object_data_set(of, "bg", o);
evas_object_data_set(of, "dia", cfd->dia->bg_object);
evas_object_move(of, x, y);
evas_object_resize(of, w, h);
evas_object_show(of);
evas_object_event_callback_add(cfd->dia->bg_object, EVAS_CALLBACK_RESIZE,
_cb_dialog_resize, of);
tb = e_widget_toolbook_add(evas, 48 * e_scale, 48 * e_scale);
tab2 = e_widget_table_add(evas, 0);
if (cfdata->edit_il == cfdata->borders_il)
{
if (m->match.title) m->title = strdup(m->match.title);
else m->title = NULL;
lb = e_widget_label_add(evas, _("Title"));
e_widget_table_object_append(tab2, lb, 0, 0, 1, 1, 1, 0, 0, 0);
en = e_widget_entry_add(evas, &(m->title), NULL, NULL, NULL);
e_widget_table_object_append(tab2, en, 1, 0, 1, 1, 1, 0, 1, 0);
}
if ((cfdata->edit_il == cfdata->borders_il) ||
(cfdata->edit_il == cfdata->overrides_il) ||
(cfdata->edit_il == cfdata->popups_il))
{
if (m->match.name) m->name = strdup(m->match.name);
else m->name = NULL;
lb = e_widget_label_add(evas, _("Name"));
e_widget_table_object_append(tab2, lb, 0, 1, 1, 1, 1, 0, 0, 0);
en = e_widget_entry_add(evas, &(m->name), NULL, NULL, NULL);
e_widget_table_object_append(tab2, en, 1, 1, 1, 1, 1, 0, 1, 0);
}
if ((cfdata->edit_il == cfdata->borders_il) ||
(cfdata->edit_il == cfdata->overrides_il))
{
if (m->match.clas) m->clas = strdup(m->match.clas);
else m->clas = NULL;
lb = e_widget_label_add(evas, _("Class"));
e_widget_table_object_append(tab2, lb, 0, 2, 1, 1, 1, 0, 0, 0);
en = e_widget_entry_add(evas, &(m->clas), NULL, NULL, NULL);
e_widget_table_object_append(tab2, en, 1, 2, 1, 1, 1, 0, 1, 0);
}
if (cfdata->edit_il == cfdata->borders_il)
{
if (m->match.role) m->role = strdup(m->match.role);
else m->role = NULL;
lb = e_widget_label_add(evas, _("Role"));
e_widget_table_object_append(tab2, lb, 0, 3, 1, 1, 1, 0, 0, 0);
en = e_widget_entry_add(evas, &(m->role), NULL, NULL, NULL);
e_widget_table_object_append(tab2, en, 1, 3, 1, 1, 1, 0, 1, 0);
}
e_widget_toolbook_page_append(tb, NULL, _("Names"), tab2, 1, 1, 1, 1, 0.5, 0.0);
if ((cfdata->edit_il == cfdata->borders_il) ||
(cfdata->edit_il == cfdata->overrides_il))
{
rg = e_widget_radio_group_new(&m->match.primary_type);
li = e_widget_list_add(evas, 1, 0);
o = e_widget_radio_add(evas, _("Unused"), ECORE_X_WINDOW_TYPE_UNKNOWN, rg);
e_widget_list_object_append(li, o, 1, 0, 0.0);
o = e_widget_radio_add(evas, _("Combo"), ECORE_X_WINDOW_TYPE_COMBO, rg);
e_widget_list_object_append(li, o, 1, 0, 0.0);
o = e_widget_radio_add(evas, _("Desktop"), ECORE_X_WINDOW_TYPE_DESKTOP, rg);
e_widget_list_object_append(li, o, 1, 0, 0.0);
o = e_widget_radio_add(evas, _("Dialog"), ECORE_X_WINDOW_TYPE_DIALOG, rg);
e_widget_list_object_append(li, o, 1, 0, 0.0);
o = e_widget_radio_add(evas, _("Dock"), ECORE_X_WINDOW_TYPE_DOCK, rg);
e_widget_list_object_append(li, o, 1, 0, 0.0);
o = e_widget_radio_add(evas, _("Drag and Drop"), ECORE_X_WINDOW_TYPE_DND, rg);
e_widget_list_object_append(li, o, 1, 0, 0.0);
o = e_widget_radio_add(evas, _("Menu"), ECORE_X_WINDOW_TYPE_MENU, rg);
e_widget_list_object_append(li, o, 1, 0, 0.0);
o = e_widget_radio_add(evas, _("Menu (Dropdown)"), ECORE_X_WINDOW_TYPE_DROPDOWN_MENU, rg);
e_widget_list_object_append(li, o, 1, 0, 0.0);
o = e_widget_radio_add(evas, _("Menu (Popup)"), ECORE_X_WINDOW_TYPE_POPUP_MENU, rg);
e_widget_list_object_append(li, o, 1, 0, 0.0);
o = e_widget_radio_add(evas, _("Normal"), ECORE_X_WINDOW_TYPE_NORMAL, rg);
e_widget_list_object_append(li, o, 1, 0, 0.0);
o = e_widget_radio_add(evas, _("Notification"), ECORE_X_WINDOW_TYPE_NOTIFICATION, rg);
e_widget_list_object_append(li, o, 1, 0, 0.0);
o = e_widget_radio_add(evas, _("Splash"), ECORE_X_WINDOW_TYPE_SPLASH, rg);
e_widget_list_object_append(li, o, 1, 0, 0.0);
o = e_widget_radio_add(evas, _("Toolbar"), ECORE_X_WINDOW_TYPE_TOOLBAR, rg);
e_widget_list_object_append(li, o, 1, 0, 0.0);
o = e_widget_radio_add(evas, _("Tooltip"), ECORE_X_WINDOW_TYPE_TOOLTIP, rg);
e_widget_list_object_append(li, o, 1, 0, 0.0);
o = e_widget_radio_add(evas, _("Utility"), ECORE_X_WINDOW_TYPE_UTILITY, rg);
e_widget_list_object_append(li, o, 1, 0, 0.0);
e_widget_size_min_get(li, &mw, &mh);
evas_object_resize(li, mw, mh);
sf = e_widget_scrollframe_simple_add(evas, li);
e_widget_toolbook_page_append(tb, NULL, _("Types"), sf,
1, 1, 1, 1, 0.5, 0.0);
}
m->borderless = m->match.borderless;
m->dialog = m->match.dialog;
m->accepts_focus = m->match.accepts_focus;
m->vkbd = m->match.vkbd;
m->quickpanel = m->match.quickpanel;
m->argb = m->match.argb;
m->fullscreen = m->match.fullscreen;
m->modal = m->match.modal;
row = 0;
tab2 = e_widget_table_add(evas, 0);
lb = e_widget_label_add(evas, _("Unused"));
e_widget_table_object_append(tab2, lb, 1, row, 1, 1, 0, 0, 0, 0);
lb = e_widget_label_add(evas, _("On"));
e_widget_table_object_append(tab2, lb, 2, row, 1, 1, 0, 0, 0, 0);
lb = e_widget_label_add(evas, _("Off"));
e_widget_table_object_append(tab2, lb, 3, row, 1, 1, 0, 0, 0, 0);
row++;
if (cfdata->edit_il == cfdata->borders_il)
{
lb = e_widget_label_add(evas, _("Borderless"));
e_widget_table_object_append(tab2, lb, 0, row, 1, 1, 1, 0, 1, 0);
rg = e_widget_radio_group_new(&m->borderless);
o = e_widget_radio_add(evas, NULL, 0, rg);
e_widget_table_object_append(tab2, o, 1, row, 1, 1, 0, 0, 0, 0);
o = e_widget_radio_add(evas, NULL, 1, rg);
e_widget_table_object_append(tab2, o, 2, row, 1, 1, 0, 0, 0, 0);
o = e_widget_radio_add(evas, NULL, -1, rg);
e_widget_table_object_append(tab2, o, 3, row, 1, 1, 0, 0, 0, 0);
row++;
}
if (cfdata->edit_il == cfdata->borders_il)
{
lb = e_widget_label_add(evas, _("Dialog"));
e_widget_table_object_append(tab2, lb, 0, row, 1, 1, 1, 0, 1, 0);
rg = e_widget_radio_group_new(&m->dialog);
o = e_widget_radio_add(evas, NULL, 0, rg);
e_widget_table_object_append(tab2, o, 1, row, 1, 1, 0, 0, 0, 0);
o = e_widget_radio_add(evas, NULL, 1, rg);
e_widget_table_object_append(tab2, o, 2, row, 1, 1, 0, 0, 0, 0);
o = e_widget_radio_add(evas, NULL, -1, rg);
e_widget_table_object_append(tab2, o, 3, row, 1, 1, 0, 0, 0, 0);
row++;
}
if (cfdata->edit_il == cfdata->borders_il)
{
lb = e_widget_label_add(evas, _("Accepts Focus"));
e_widget_table_object_append(tab2, lb, 0, row, 1, 1, 1, 0, 1, 0);
rg = e_widget_radio_group_new(&m->accepts_focus);
o = e_widget_radio_add(evas, NULL, 0, rg);
e_widget_table_object_append(tab2, o, 1, row, 1, 1, 0, 0, 0, 0);
o = e_widget_radio_add(evas, NULL, 1, rg);
e_widget_table_object_append(tab2, o, 2, row, 1, 1, 0, 0, 0, 0);
o = e_widget_radio_add(evas, NULL, -1, rg);
e_widget_table_object_append(tab2, o, 3, row, 1, 1, 0, 0, 0, 0);
row++;
}
if (cfdata->edit_il == cfdata->borders_il)
{
lb = e_widget_label_add(evas, _("Virtual Keyboard"));
e_widget_table_object_append(tab2, lb, 0, row, 1, 1, 1, 0, 1, 0);
rg = e_widget_radio_group_new(&m->vkbd);
o = e_widget_radio_add(evas, NULL, 0, rg);
e_widget_table_object_append(tab2, o, 1, row, 1, 1, 0, 0, 0, 0);
o = e_widget_radio_add(evas, NULL, 1, rg);
e_widget_table_object_append(tab2, o, 2, row, 1, 1, 0, 0, 0, 0);
o = e_widget_radio_add(evas, NULL, -1, rg);
e_widget_table_object_append(tab2, o, 3, row, 1, 1, 0, 0, 0, 0);
row++;
}
if (cfdata->edit_il == cfdata->borders_il)
{
lb = e_widget_label_add(evas, _("Quick Panel"));
e_widget_table_object_append(tab2, lb, 0, row, 1, 1, 1, 0, 1, 0);
rg = e_widget_radio_group_new(&m->quickpanel);
o = e_widget_radio_add(evas, NULL, 0, rg);
e_widget_table_object_append(tab2, o, 1, row, 1, 1, 0, 0, 0, 0);
o = e_widget_radio_add(evas, NULL, 1, rg);
e_widget_table_object_append(tab2, o, 2, row, 1, 1, 0, 0, 0, 0);
o = e_widget_radio_add(evas, NULL, -1, rg);
e_widget_table_object_append(tab2, o, 3, row, 1, 1, 0, 0, 0, 0);
row++;
}
lb = e_widget_label_add(evas, _("ARGB"));
e_widget_table_object_append(tab2, lb, 0, row, 1, 1, 1, 0, 1, 0);
rg = e_widget_radio_group_new(&m->argb);
o = e_widget_radio_add(evas, NULL, 0, rg);
e_widget_table_object_append(tab2, o, 1, row, 1, 1, 0, 0, 0, 0);
o = e_widget_radio_add(evas, NULL, 1, rg);
e_widget_table_object_append(tab2, o, 2, row, 1, 1, 0, 0, 0, 0);
o = e_widget_radio_add(evas, NULL, -1, rg);
e_widget_table_object_append(tab2, o, 3, row, 1, 1, 0, 0, 0, 0);
row++;
if (cfdata->edit_il == cfdata->borders_il)
{
lb = e_widget_label_add(evas, _("Fullscreen"));
e_widget_table_object_append(tab2, lb, 0, row, 1, 1, 1, 0, 1, 0);
rg = e_widget_radio_group_new(&m->fullscreen);
o = e_widget_radio_add(evas, NULL, 0, rg);
e_widget_table_object_append(tab2, o, 1, row, 1, 1, 0, 0, 0, 0);
o = e_widget_radio_add(evas, NULL, 1, rg);
e_widget_table_object_append(tab2, o, 2, row, 1, 1, 0, 0, 0, 0);
o = e_widget_radio_add(evas, NULL, -1, rg);
e_widget_table_object_append(tab2, o, 3, row, 1, 1, 0, 0, 0, 0);
row++;
}
if (cfdata->edit_il == cfdata->borders_il)
{
lb = e_widget_label_add(evas, _("Modal"));
e_widget_table_object_append(tab2, lb, 0, row, 1, 1, 1, 0, 1, 0);
rg = e_widget_radio_group_new(&m->modal);
o = e_widget_radio_add(evas, NULL, 0, rg);
e_widget_table_object_append(tab2, o, 1, row, 1, 1, 0, 0, 0, 0);
o = e_widget_radio_add(evas, NULL, 1, rg);
e_widget_table_object_append(tab2, o, 2, row, 1, 1, 0, 0, 0, 0);
o = e_widget_radio_add(evas, NULL, -1, rg);
e_widget_table_object_append(tab2, o, 3, row, 1, 1, 0, 0, 0, 0);
row++;
}
e_widget_toolbook_page_append(tb, NULL, _("Flags"), tab2,
1, 1, 1, 1, 0.5, 0.0);
oi = _style_selector(evas, &(m->match.shadow_style));
e_widget_toolbook_page_append(tb, NULL, _("Style"), oi,
1, 1, 1, 1, 0.5, 0.0);
e_widget_frametable_object_append(of, tb, 0, 0, 1, 1, 1, 1, 1, 1);
e_widget_toolbook_page_show(tb, 0);
bt = e_widget_button_add(evas, _("OK"), NULL, _edit_ok, m, of);
e_widget_frametable_object_append(of, bt, 0, 1, 1, 1, 0, 0, 0, 0);
e_widget_size_min_get(of, &mw, &mh);
e_win_resize(cfd->dia->win, MAX(mw, cfd->dia->win->w), MAX(mh, cfd->dia->win->h));
}
static void
_but_up(void *d1, void *d2)
{
E_Config_Dialog *cfd = d1;
Evas_Object *il = d2;
Match_Config *m;
int n;
e_widget_ilist_freeze(il);
n = e_widget_ilist_selected_get(il);
if (n < 1) return;
m = e_widget_ilist_nth_data_get(il, n);
if (!m)
{
e_widget_ilist_thaw(il);
return;
}
e_widget_ilist_remove_num(il, n);
n--;
_match_ilist_append(il, m, n, 1);
e_widget_ilist_nth_show(il, n, 0);
e_widget_ilist_selected_set(il, n);
e_widget_ilist_thaw(il);
e_widget_ilist_go(il);
_match_list_up(&(cfd->cfdata->popups), m);
_match_list_up(&(cfd->cfdata->borders), m);
_match_list_up(&(cfd->cfdata->overrides), m);
_match_list_up(&(cfd->cfdata->menus), m);
cfd->cfdata->changed = 1;
e_config_dialog_changed_set(cfd, 1);
}
static void
_but_down(void *d1, void *d2)
{
E_Config_Dialog *cfd = d1;
Evas_Object *il = d2;
Match_Config *m;
int n;
e_widget_ilist_freeze(il);
n = e_widget_ilist_selected_get(il);
if (n >= (e_widget_ilist_count(il) - 1)) return;
m = e_widget_ilist_nth_data_get(il, n);
if (!m)
{
e_widget_ilist_thaw(il);
return;
}
e_widget_ilist_remove_num(il, n);
_match_ilist_append(il, m, n, 0);
e_widget_ilist_nth_show(il, n + 1, 0);
e_widget_ilist_selected_set(il, n + 1);
e_widget_ilist_thaw(il);
e_widget_ilist_go(il);
_match_list_down(&(cfd->cfdata->popups), m);
_match_list_down(&(cfd->cfdata->borders), m);
_match_list_down(&(cfd->cfdata->overrides), m);
_match_list_down(&(cfd->cfdata->menus), m);
cfd->cfdata->changed = 1;
e_config_dialog_changed_set(cfd, 1);
}
static void
_but_add(void *d1, void *d2)
{
E_Config_Dialog *cfd = d1;
Evas_Object *il = d2;
Match_Config *m;
m = E_NEW(Match_Config, 1);
m->cfd = cfd;
m->match.shadow_style = eina_stringshare_add("default");
cfd->cfdata->edit_il = il;
_create_edit_frame(cfd, evas_object_evas_get(il), cfd->cfdata, m);
}
static void
_but_del(void *d1, void *d2)
{
E_Config_Dialog *cfd = d1;
Evas_Object *il = d2;
Match_Config *m;
int n;
e_widget_ilist_freeze(il);
n = e_widget_ilist_selected_get(il);
m = e_widget_ilist_nth_data_get(il, n);
if (!m)
{
e_widget_ilist_thaw(il);
return;
}
e_widget_ilist_remove_num(il, n);
e_widget_ilist_thaw(il);
e_widget_ilist_go(il);
_match_list_del(&(cfd->cfdata->popups), m);
_match_list_del(&(cfd->cfdata->borders), m);
_match_list_del(&(cfd->cfdata->overrides), m);
_match_list_del(&(cfd->cfdata->menus), m);
cfd->cfdata->changed = 1;
e_config_dialog_changed_set(cfd, 1);
}
static void
_but_edit(void *d1, void *d2)
{
E_Config_Dialog *cfd = d1;
Evas_Object *il = d2;
int n;
Match_Config *m;
n = e_widget_ilist_selected_get(il);
m = e_widget_ilist_nth_data_get(il, n);
if (!m) return;
cfd->cfdata->edit_il = il;
_create_edit_frame(cfd, evas_object_evas_get(il), cfd->cfdata, m);
cfd->cfdata->changed = 1;
e_config_dialog_changed_set(cfd, 1);
}
static Evas_Object *
_create_match_editor(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata EINA_UNUSED, Eina_List **matches, Evas_Object **il_ret)
{
Evas_Object *tab, *il, *bt;
Match_Config *m;
Eina_List *l;
tab = e_widget_table_add(evas, 0);
il = e_widget_ilist_add(evas, 16, 16, NULL);
e_widget_size_min_set(il, 160, 100);
EINA_LIST_FOREACH(*matches, l, m)
{
_match_ilist_append(il, m, -1, 0);
}
e_widget_ilist_go(il);
e_widget_table_object_append(tab, il, 0, 0, 1, 5, 1, 1, 1, 1);
bt = e_widget_button_add(evas, _("Up"), NULL, _but_up, cfd, il);
e_widget_table_object_append(tab, bt, 1, 0, 1, 1, 1, 1, 0, 0);
bt = e_widget_button_add(evas, _("Down"), NULL, _but_down, cfd, il);
e_widget_table_object_append(tab, bt, 1, 1, 1, 1, 1, 1, 0, 0);
bt = e_widget_button_add(evas, _("Add"), NULL, _but_add, cfd, il);
e_widget_table_object_append(tab, bt, 1, 2, 1, 1, 1, 1, 0, 0);
bt = e_widget_button_add(evas, _("Del"), NULL, _but_del, cfd, il);
e_widget_table_object_append(tab, bt, 1, 3, 1, 1, 1, 1, 0, 0);
bt = e_widget_button_add(evas, _("Edit"), NULL, _but_edit, cfd, il);
e_widget_table_object_append(tab, bt, 1, 4, 1, 1, 1, 1, 0, 0);
*il_ret = il;
return tab;
}
static Evas_Object *
_create_styles_toolbook(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
{
Evas_Object *tb, *oi, *il;
tb = e_widget_toolbook_add(evas, 48 * e_scale, 48 * e_scale);
oi = _create_match_editor(cfd, evas, cfdata, &(cfdata->borders), &il);
cfdata->borders_il = il;
e_widget_toolbook_page_append(tb, NULL, _("Apps"), oi, 1, 1, 1, 1, 0.5, 0.0);
oi = _create_match_editor(cfd, evas, cfdata, &(cfdata->popups), &il);
cfdata->popups_il = il;
e_widget_toolbook_page_append(tb, NULL, _("E"), oi, 1, 1, 1, 1, 0.5, 0.0);
oi = _create_match_editor(cfd, evas, cfdata, &(cfdata->overrides), &il);
cfdata->overrides_il = il;
e_widget_toolbook_page_append(tb, NULL, _("Over"), oi, 1, 1, 1, 1, 0.5, 0.0);
oi = _create_match_editor(cfd, evas, cfdata, &(cfdata->menus), &il);
cfdata->menus_il = il;
e_widget_toolbook_page_append(tb, NULL, _("Menus"), oi, 1, 1, 1, 1, 0.5, 0.0);
e_widget_toolbook_page_show(tb, 0);
return tb;
}
static int
_basic_apply_data(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
{
Eina_List *l;
E_Comp_Match *m;
Match_Config *m2;
if (!cfdata->changed) return 0;
E_FREE_LIST(_comp_mod->conf->match.popups, e_comp_cfdata_match_free);
E_FREE_LIST(_comp_mod->conf->match.borders, e_comp_cfdata_match_free);
E_FREE_LIST(_comp_mod->conf->match.overrides, e_comp_cfdata_match_free);
E_FREE_LIST(_comp_mod->conf->match.menus, e_comp_cfdata_match_free);
EINA_LIST_FOREACH(cfdata->popups, l, m2)
{
m = E_NEW(E_Comp_Match, 1);
_match_dup2(m2, m);
_comp_mod->conf->match.popups = eina_list_append(_comp_mod->conf->match.popups, m);
}
EINA_LIST_FOREACH(cfdata->borders, l, m2)
{
m = E_NEW(E_Comp_Match, 1);
_match_dup2(m2, m);
_comp_mod->conf->match.borders = eina_list_append(_comp_mod->conf->match.borders, m);
}
EINA_LIST_FOREACH(cfdata->overrides, l, m2)
{
m = E_NEW(E_Comp_Match, 1);
_match_dup2(m2, m);
_comp_mod->conf->match.overrides = eina_list_append(_comp_mod->conf->match.overrides, m);
}
EINA_LIST_FOREACH(cfdata->menus, l, m2)
{
m = E_NEW(E_Comp_Match, 1);
_match_dup2(m2, m);
_comp_mod->conf->match.menus = eina_list_append(_comp_mod->conf->match.menus, m);
}
cfdata->changed = 0;
e_comp_shadows_reset();
e_config_save_queue();
return 1;
}
static Evas_Object *
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
{
Evas_Object *orec0;
orec0 = evas_object_rectangle_add(evas);
evas_object_name_set(orec0, "style_shadows");
return _create_styles_toolbook(cfd, evas, cfdata);
}
static void
_free_data(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfdata)
{
_comp_mod->match_config_dialog = NULL;
E_FREE_LIST(cfdata->popups, _match_free);
E_FREE_LIST(cfdata->borders, _match_free);
E_FREE_LIST(cfdata->menus, _match_free);
E_FREE_LIST(cfdata->overrides, _match_free);
free(cfdata);
}
static void *
_create_data(E_Config_Dialog *cfd)
{
E_Config_Dialog_Data *cfdata;
Eina_List *l;
E_Comp_Match *m;
Match_Config *m2;
_comp_mod->match_config_dialog = cfd;
cfdata = E_NEW(E_Config_Dialog_Data, 1);
EINA_LIST_FOREACH(_comp_mod->conf->match.popups, l, m)
{
m2 = E_NEW(Match_Config, 1);
_match_dup(m, m2);
m2->cfd = cfd;
cfdata->popups = eina_list_append(cfdata->popups, m2);
}
EINA_LIST_FOREACH(_comp_mod->conf->match.borders, l, m)
{
m2 = E_NEW(Match_Config, 1);
_match_dup(m, m2);
m2->cfd = cfd;
cfdata->borders = eina_list_append(cfdata->borders, m2);
}
EINA_LIST_FOREACH(_comp_mod->conf->match.overrides, l, m)
{
m2 = E_NEW(Match_Config, 1);
_match_dup(m, m2);
m2->cfd = cfd;
cfdata->overrides = eina_list_append(cfdata->overrides, m2);
}
EINA_LIST_FOREACH(_comp_mod->conf->match.menus, l, m)
{
m2 = E_NEW(Match_Config, 1);
_match_dup(m, m2);
m2->cfd = cfd;
cfdata->menus = eina_list_append(cfdata->menus, m2);
}
return cfdata;
}
EINTERN E_Config_Dialog *
e_int_config_comp_match(E_Container *con, const char *params __UNUSED__)
{
E_Config_Dialog *cfd;
E_Config_Dialog_View *v;
Mod *mod = _comp_mod;
if (e_config_dialog_find("E", "internal/comp_matches")) return NULL;
v = E_NEW(E_Config_Dialog_View, 1);
v->create_cfdata = _create_data;
v->free_cfdata = _free_data;
v->basic.apply_cfdata = _basic_apply_data;
v->basic.create_widgets = _basic_create_widgets;
cfd = e_config_dialog_new(con, _("Composite Match Settings"),
"E", "_comp_matches", "preferences-composite", 0, v, mod);
mod->match_config_dialog = cfd;
e_dialog_resizable_set(cfd->dia, 1);
return cfd;
}

@ -1,6 +1,5 @@
#include "e.h"
#include "e_mod_main.h"
#include "e_mod_config.h"
#include "e_comp.h"
#include "e_comp_cfdata.h"
@ -33,6 +32,187 @@ _e_mod_config_menu_create(void *d EINA_UNUSED, E_Menu *m)
e_menu_item_callback_set(mi, _e_mod_comp_conf_cb, NULL);
}
static Eina_Bool
_style_demo(void *data)
{
Eina_List *style_shadows, *l;
int demo_state;
const E_Demo_Style_Item *it;
demo_state = (long)evas_object_data_get(data, "style_demo_state");
demo_state = (demo_state + 1) % 4;
evas_object_data_set(data, "style_demo_state", (void *)(long)demo_state);
style_shadows = evas_object_data_get(data, "style_shadows");
EINA_LIST_FOREACH(style_shadows, l, it)
{
Evas_Object *ob = it->preview;
Evas_Object *of = it->frame;
switch (demo_state)
{
case 0:
edje_object_signal_emit(ob, "e,state,visible,on", "e");
edje_object_signal_emit(ob, "e,state,focus,on", "e");
edje_object_part_text_set(of, "e.text.label", _("Visible"));
break;
case 1:
edje_object_signal_emit(ob, "e,state,focus,off", "e");
edje_object_part_text_set(of, "e.text.label", _("Focus-Out"));
break;
case 2:
edje_object_signal_emit(ob, "e,state,focus,on", "e");
edje_object_part_text_set(of, "e.text.label", _("Focus-In"));
break;
case 3:
edje_object_signal_emit(ob, "e,state,visible,off", "e");
edje_object_part_text_set(of, "e.text.label", _("Hidden"));
break;
default:
break;
}
}
return ECORE_CALLBACK_RENEW;
}
static void
_style_selector_del(void *data __UNUSED__,
Evas *e,
Evas_Object *o,
void *event_info __UNUSED__)
{
Eina_List *style_shadows, *style_list;
Ecore_Timer *timer;
Evas_Object *orec0;
orec0 = evas_object_name_find(e, "style_shadows");
style_list = evas_object_data_get(orec0, "list");
style_shadows = evas_object_data_get(o, "style_shadows");
if (style_shadows)
{
E_Demo_Style_Item *ds_it;
EINA_LIST_FREE(style_shadows, ds_it)
{
style_list = eina_list_remove(style_list, ds_it);
evas_object_del(ds_it->frame);
evas_object_del(ds_it->livethumb);
free(ds_it);
}
evas_object_data_set(o, "style_shadows", NULL);
}
timer = evas_object_data_get(o, "style_timer");
if (timer)
{
ecore_timer_del(timer);
evas_object_data_set(o, "style_timer", NULL);
}
evas_object_data_set(orec0, "list", style_list);
}
EINTERN Evas_Object *
_style_selector(Evas *evas, const char **source)
{
Evas_Object *oi, *ob, *oo, *obd, *orec, *oly, *orec0;
Eina_List *styles, *l, *style_shadows = NULL, *style_list;
char *style;
const char *str;
int n, sel;
Evas_Coord wmw, wmh;
Ecore_Timer *timer;
orec0 = evas_object_name_find(evas, "style_shadows");
style_list = evas_object_data_get(orec0, "list");
oi = e_widget_ilist_add(evas, 80, 80, source);
evas_object_event_callback_add(oi, EVAS_CALLBACK_DEL,
_style_selector_del, oi);
sel = 0;
styles = e_theme_comp_list();
n = 0;
EINA_LIST_FOREACH(styles, l, style)
{
E_Demo_Style_Item *ds_it;
char buf[4096];
ds_it = malloc(sizeof(E_Demo_Style_Item));
ob = e_livethumb_add(evas);
ds_it->livethumb = ob;
e_livethumb_vsize_set(ob, 240, 240);
oly = e_layout_add(e_livethumb_evas_get(ob));
ds_it->layout = ob;
e_layout_virtual_size_set(oly, 240, 240);
e_livethumb_thumb_set(ob, oly);
evas_object_show(oly);
oo = edje_object_add(e_livethumb_evas_get(ob));
ds_it->preview = oo;
snprintf(buf, sizeof(buf), "e/comp/%s", style);
e_theme_edje_object_set(oo, "base/theme/borders", buf);
e_layout_pack(oly, oo);
e_layout_child_move(oo, 39, 39);
e_layout_child_resize(oo, 162, 162);
edje_object_signal_emit(oo, "e,state,shadow,on", "e");
edje_object_signal_emit(oo, "e,state,visible,on", "e");
evas_object_show(oo);
ds_it->frame = edje_object_add(evas);
e_theme_edje_object_set
(ds_it->frame, "base/theme/modules/comp", "e/modules/comp/preview");
edje_object_part_swallow(ds_it->frame, "e.swallow.preview", ob);
evas_object_show(ds_it->frame);
style_shadows = eina_list_append(style_shadows, ds_it);
obd = edje_object_add(e_livethumb_evas_get(ob));
ds_it->border = obd;
e_theme_edje_object_set(obd, "base/theme/borders",
"e/widgets/border/default/border");
edje_object_part_text_set(obd, "e.text.title", _("Title"));
edje_object_signal_emit(obd, "e,state,focused", "e");
edje_object_part_swallow(oo, "e.swallow.content", obd);
evas_object_show(obd);
orec = evas_object_rectangle_add(e_livethumb_evas_get(ob));
ds_it->client = orec;
evas_object_color_set(orec, 0, 0, 0, 128);
edje_object_part_swallow(obd, "e.swallow.client", orec);
evas_object_show(orec);
e_widget_ilist_append(oi, ds_it->frame, style, NULL, NULL, style);
evas_object_show(ob);
if (*source)
{
if (!strcmp(*source, style)) sel = n;
}
n++;
style_list = eina_list_append(style_list, ds_it);
}
evas_object_data_set(orec0, "list", style_list);
evas_object_data_set(oi, "style_shadows", style_shadows);
timer = ecore_timer_add(3.0, _style_demo, oi);
evas_object_data_set(oi, "style_timer", timer);
evas_object_data_set(oi, "style_demo_state", (void *)1);
e_widget_size_min_get(oi, &wmw, &wmh);
e_widget_size_min_set(oi, 160, 100);
e_widget_ilist_selected_set(oi, sel);
e_widget_ilist_go(oi);
EINA_LIST_FREE(styles, str)
eina_stringshare_del(str);
return oi;
}
EAPI void *
e_modapi_init(E_Module *m)
{
@ -55,6 +235,11 @@ e_modapi_init(E_Module *m)
e_configure_registry_item_add("appearance/comp", 120, _("Composite"), NULL,
"preferences-composite", e_int_config_comp_module);
e_configure_registry_category_add("internal", -1, _("Internal"),
NULL, "enlightenment/internal");
e_configure_registry_item_add("internal/comp_matches", -1, _("Composite Style Settings"),
NULL, "preferences-composite", e_int_config_comp_match);
mod->conf = conf;
maug = e_int_menus_menu_augmentation_add_sorted("config/1", _("Composite"), _e_mod_config_menu_create, NULL, NULL, NULL);
mod->conf->max_unmapped_pixels = 32 * 1024;
@ -92,6 +277,9 @@ e_modapi_shutdown(E_Module *m)
e_configure_registry_item_del("appearance/comp");
e_configure_registry_category_del("appearance");
e_configure_registry_item_del("internal/comp_matches");
e_configure_registry_category_del("internal");
if (mod->config_dialog)
{
e_object_del(E_OBJECT(mod->config_dialog));

@ -9,31 +9,37 @@ struct _Mod
{
E_Module *module;
E_Config_DD *conf_edd;
E_Config_DD *conf_match_edd;
E_Comp_Config *conf;
E_Config_Dialog *config_dialog;
E_Config_Dialog *match_config_dialog;
};
extern Mod *_comp_mod;
#define ENGINE_SW 1
#define ENGINE_GL 2
typedef struct _E_Demo_Style_Item
{
Evas_Object *preview;
Evas_Object *frame;
Evas_Object *livethumb;
Evas_Object *layout;
Evas_Object *border;
Evas_Object *client;
} E_Demo_Style_Item;
/**
* @addtogroup Optional_Look
* @addtogroup Optional_Conf
* @{
*
* @defgroup Module_Comp Comp (Composite Manager)
* @defgroup Module_Conf_Comp Conf_Comp (Composite Settings)
*
* Implements the X11 Composite Manager to support alpha blend,
* semi-transparent windows and drop shadow. Does support animations
* and effects such as coloring unfocused windows.
* Change settings for the internal compositor.
*
* @}
*/
EINTERN Evas_Object *_style_selector(Evas *evas, const char **source);
EINTERN E_Config_Dialog *e_int_config_comp_module(E_Container *con, const char *params EINA_UNUSED);
EINTERN E_Config_Dialog *e_int_config_comp_match(E_Container *con, const char *params EINA_UNUSED);
#endif

Loading…
Cancel
Save