enlightenment/src/modules/illume2/e_mod_config.c

260 lines
9.7 KiB
C
Raw Normal View History

#include "e_illume_private.h"
#include "e_mod_main.h"
/* local function prototypes */
static void _e_mod_illume_config_free(void);
static void _e_mod_illume_config_new(void);
/* local variables */
static E_Config_DD *_il_conf_edd = NULL;
static E_Config_DD *_il_conf_zone_edd = NULL;
/* external variables */
E_Illume_Config *_e_illume_cfg = NULL;
int
e_mod_illume_config_init(void)
{
/* create config structure for zones */
_il_conf_zone_edd = E_CONFIG_DD_NEW("Illume_Config_Zone", E_Illume_Config_Zone);
#undef T
#undef D
#define T E_Illume_Config_Zone
#define D _il_conf_zone_edd
E_CONFIG_VAL(D, T, id, INT);
E_CONFIG_VAL(D, T, mode.dual, INT);
E_CONFIG_VAL(D, T, mode.side, INT);
/* create config structure for module */
_il_conf_edd = E_CONFIG_DD_NEW("Illume_Config", E_Illume_Config);
#undef T
#undef D
#define T E_Illume_Config
#define D _il_conf_edd
E_CONFIG_VAL(D, T, version, INT);
E_CONFIG_VAL(D, T, animation.vkbd.duration, INT);
E_CONFIG_VAL(D, T, animation.vkbd.resize_before, INT);
E_CONFIG_VAL(D, T, animation.quickpanel.duration, INT);
E_CONFIG_VAL(D, T, policy.name, STR);
E_CONFIG_VAL(D, T, policy.vkbd.class, STR);
E_CONFIG_VAL(D, T, policy.vkbd.name, STR);
E_CONFIG_VAL(D, T, policy.vkbd.title, STR);
E_CONFIG_VAL(D, T, policy.vkbd.type, INT);
E_CONFIG_VAL(D, T, policy.vkbd.match.class, INT);
E_CONFIG_VAL(D, T, policy.vkbd.match.name, INT);
E_CONFIG_VAL(D, T, policy.vkbd.match.title, INT);
E_CONFIG_VAL(D, T, policy.vkbd.match.type, INT);
E_CONFIG_VAL(D, T, policy.indicator.class, STR);
E_CONFIG_VAL(D, T, policy.indicator.name, STR);
E_CONFIG_VAL(D, T, policy.indicator.title, STR);
E_CONFIG_VAL(D, T, policy.indicator.type, INT);
E_CONFIG_VAL(D, T, policy.indicator.match.class, INT);
E_CONFIG_VAL(D, T, policy.indicator.match.name, INT);
E_CONFIG_VAL(D, T, policy.indicator.match.title, INT);
E_CONFIG_VAL(D, T, policy.indicator.match.type, INT);
E_CONFIG_VAL(D, T, policy.softkey.class, STR);
E_CONFIG_VAL(D, T, policy.softkey.name, STR);
E_CONFIG_VAL(D, T, policy.softkey.title, STR);
E_CONFIG_VAL(D, T, policy.softkey.type, INT);
E_CONFIG_VAL(D, T, policy.softkey.match.class, INT);
E_CONFIG_VAL(D, T, policy.softkey.match.name, INT);
E_CONFIG_VAL(D, T, policy.softkey.match.title, INT);
E_CONFIG_VAL(D, T, policy.softkey.match.type, INT);
E_CONFIG_VAL(D, T, policy.home.class, STR);
E_CONFIG_VAL(D, T, policy.home.name, STR);
E_CONFIG_VAL(D, T, policy.home.title, STR);
E_CONFIG_VAL(D, T, policy.home.type, INT);
E_CONFIG_VAL(D, T, policy.home.match.class, INT);
E_CONFIG_VAL(D, T, policy.home.match.name, INT);
E_CONFIG_VAL(D, T, policy.home.match.title, INT);
E_CONFIG_VAL(D, T, policy.home.match.type, INT);
E_CONFIG_LIST(D, T, policy.zones, _il_conf_zone_edd);
/* attempt to load existing configuration */
_e_illume_cfg = e_config_domain_load("module.illume2", _il_conf_edd);
/* check version */
if ((_e_illume_cfg) && ((_e_illume_cfg->version >> 16) < IL_CONFIG_MAJOR))
_e_mod_illume_config_free();
/* create new config if we need to */
if (!_e_illume_cfg) _e_mod_illume_config_new();
/* setup category for config panel */
2010-07-08 14:04:52 -07:00
e_configure_registry_category_add("illume", 0, _("Illume"), NULL, "preferences-illume");
/* add config items to category */
e_configure_registry_generic_item_add("illume/policy", 0, _("Policy"),
NULL, "preferences-profiles",
e_mod_illume_config_policy_show);
e_configure_registry_generic_item_add("illume/animation", 0, _("Animation"),
NULL, "preferences-transitions",
e_mod_illume_config_animation_show);
e_configure_registry_generic_item_add("illume/windows", 0, _("Windows"),
NULL, "preferences-winlist",
e_mod_illume_config_windows_show);
return 1;
}
int
e_mod_illume_config_shutdown(void)
{
/* destroy config item entries */
e_configure_registry_item_del("illume/windows");
e_configure_registry_item_del("illume/animation");
e_configure_registry_item_del("illume/policy");
/* destroy config category */
e_configure_registry_category_del("illume");
/* free config structure */
_e_mod_illume_config_free();
/* free data descriptors */
E_CONFIG_DD_FREE(_il_conf_zone_edd);
E_CONFIG_DD_FREE(_il_conf_edd);
return 1;
}
int
e_mod_illume_config_save(void)
{
if ((!_il_conf_edd) || (!_e_illume_cfg)) return 0;
return e_config_domain_save("module.illume2", _il_conf_edd, _e_illume_cfg);
}
/* local functions */
static void
_e_mod_illume_config_free(void)
{
E_Illume_Config_Zone *cz;
/* check for config */
if (!_e_illume_cfg) return;
/* cleanup any stringshares */
if (_e_illume_cfg->policy.name)
eina_stringshare_del(_e_illume_cfg->policy.name);
_e_illume_cfg->policy.name = NULL;
if (_e_illume_cfg->policy.vkbd.class)
eina_stringshare_del(_e_illume_cfg->policy.vkbd.class);
_e_illume_cfg->policy.vkbd.class = NULL;
if (_e_illume_cfg->policy.vkbd.name)
eina_stringshare_del(_e_illume_cfg->policy.vkbd.name);
_e_illume_cfg->policy.vkbd.name = NULL;
if (_e_illume_cfg->policy.vkbd.title)
eina_stringshare_del(_e_illume_cfg->policy.vkbd.title);
_e_illume_cfg->policy.vkbd.title = NULL;
if (_e_illume_cfg->policy.indicator.class)
eina_stringshare_del(_e_illume_cfg->policy.indicator.class);
_e_illume_cfg->policy.indicator.class = NULL;
if (_e_illume_cfg->policy.indicator.name)
eina_stringshare_del(_e_illume_cfg->policy.indicator.name);
_e_illume_cfg->policy.indicator.name = NULL;
if (_e_illume_cfg->policy.indicator.title)
eina_stringshare_del(_e_illume_cfg->policy.indicator.title);
_e_illume_cfg->policy.indicator.title = NULL;
if (_e_illume_cfg->policy.softkey.class)
eina_stringshare_del(_e_illume_cfg->policy.softkey.class);
_e_illume_cfg->policy.softkey.class = NULL;
if (_e_illume_cfg->policy.softkey.name)
eina_stringshare_del(_e_illume_cfg->policy.softkey.name);
_e_illume_cfg->policy.softkey.name = NULL;
if (_e_illume_cfg->policy.softkey.title)
eina_stringshare_del(_e_illume_cfg->policy.softkey.title);
_e_illume_cfg->policy.softkey.title = NULL;
if (_e_illume_cfg->policy.home.class)
eina_stringshare_del(_e_illume_cfg->policy.home.class);
_e_illume_cfg->policy.home.class = NULL;
if (_e_illume_cfg->policy.home.name)
eina_stringshare_del(_e_illume_cfg->policy.home.name);
_e_illume_cfg->policy.home.name = NULL;
if (_e_illume_cfg->policy.home.title)
eina_stringshare_del(_e_illume_cfg->policy.home.title);
_e_illume_cfg->policy.home.title = NULL;
/* free configured zones */
EINA_LIST_FREE(_e_illume_cfg->policy.zones, cz)
E_FREE(cz);
/* free config structure */
E_FREE(_e_illume_cfg);
}
static void
_e_mod_illume_config_new(void)
{
E_Illume_Config_Zone *cz;
/* create initial config */
_e_illume_cfg = E_NEW(E_Illume_Config, 1);
_e_illume_cfg->version = 0;
_e_illume_cfg->animation.vkbd.duration = 1000;
_e_illume_cfg->animation.vkbd.resize_before = 1;
_e_illume_cfg->animation.quickpanel.duration = 1000;
_e_illume_cfg->policy.name = eina_stringshare_add("illume");
_e_illume_cfg->policy.vkbd.class = eina_stringshare_add("Virtual-Keyboard");
_e_illume_cfg->policy.vkbd.name = eina_stringshare_add("Virtual-Keyboard");
_e_illume_cfg->policy.vkbd.title = eina_stringshare_add("Virtual Keyboard");
compositor rewrite / charlie-foxtrot situation huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once. * compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine. ** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes ** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects ** protocol-specific window management and compositor functionality is now kept exclusively in backend files ** e_pixmap api provides generic client finding and rendering api ** screen/xinerama screens are now provided directly by compositor on startup and re-set on change ** e_comp_render_update finally replaced with eina_tiler ** wayland compositor no longer creates X windows ** compositor e_layout removed entirely * e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra * e_manager is just for screensaver and keybind stuff now, possibly remove later? * e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor ** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed. *** do NOT set interceptors on a client's comp_object. seriously. * startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor * ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get * e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas * deskmirror is (more) broken for now * illume is totally fucked * Ecore_X_Window replaced with Ecore_Window in most cases * edge binding XWindows replaced with regular canvas objects * some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result comp files and descriptions: e_comp.c - overall compositor functions, rendering/update loop, shape cutting e_comp_x.c - X window management and compositor functionality e_comp_wl.c - Wayland surface management and compositor functionality e_comp_canvas.c - general compositor canvas functions and utilities e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems additional authors: ivan.briano@intel.com feature: new compositor removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
_e_illume_cfg->policy.vkbd.type = E_WINDOW_TYPE_NORMAL;
_e_illume_cfg->policy.vkbd.match.class = 0;
_e_illume_cfg->policy.vkbd.match.name = 1;
_e_illume_cfg->policy.vkbd.match.title = 1;
_e_illume_cfg->policy.vkbd.match.type = 0;
_e_illume_cfg->policy.indicator.class =
eina_stringshare_add("Illume-Indicator");
_e_illume_cfg->policy.indicator.name =
eina_stringshare_add("Illume-Indicator");
_e_illume_cfg->policy.indicator.title =
eina_stringshare_add("Illume Indicator");
compositor rewrite / charlie-foxtrot situation huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once. * compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine. ** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes ** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects ** protocol-specific window management and compositor functionality is now kept exclusively in backend files ** e_pixmap api provides generic client finding and rendering api ** screen/xinerama screens are now provided directly by compositor on startup and re-set on change ** e_comp_render_update finally replaced with eina_tiler ** wayland compositor no longer creates X windows ** compositor e_layout removed entirely * e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra * e_manager is just for screensaver and keybind stuff now, possibly remove later? * e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor ** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed. *** do NOT set interceptors on a client's comp_object. seriously. * startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor * ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get * e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas * deskmirror is (more) broken for now * illume is totally fucked * Ecore_X_Window replaced with Ecore_Window in most cases * edge binding XWindows replaced with regular canvas objects * some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result comp files and descriptions: e_comp.c - overall compositor functions, rendering/update loop, shape cutting e_comp_x.c - X window management and compositor functionality e_comp_wl.c - Wayland surface management and compositor functionality e_comp_canvas.c - general compositor canvas functions and utilities e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems additional authors: ivan.briano@intel.com feature: new compositor removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
_e_illume_cfg->policy.indicator.type = E_WINDOW_TYPE_DOCK;
_e_illume_cfg->policy.indicator.match.class = 0;
_e_illume_cfg->policy.indicator.match.name = 1;
_e_illume_cfg->policy.indicator.match.title = 1;
_e_illume_cfg->policy.indicator.match.type = 0;
_e_illume_cfg->policy.softkey.class =
eina_stringshare_add("Illume-Softkey");
_e_illume_cfg->policy.softkey.name =
eina_stringshare_add("Illume-Softkey");
_e_illume_cfg->policy.softkey.title =
eina_stringshare_add("Illume Softkey");
compositor rewrite / charlie-foxtrot situation huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once. * compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine. ** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes ** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects ** protocol-specific window management and compositor functionality is now kept exclusively in backend files ** e_pixmap api provides generic client finding and rendering api ** screen/xinerama screens are now provided directly by compositor on startup and re-set on change ** e_comp_render_update finally replaced with eina_tiler ** wayland compositor no longer creates X windows ** compositor e_layout removed entirely * e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra * e_manager is just for screensaver and keybind stuff now, possibly remove later? * e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor ** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed. *** do NOT set interceptors on a client's comp_object. seriously. * startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor * ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get * e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas * deskmirror is (more) broken for now * illume is totally fucked * Ecore_X_Window replaced with Ecore_Window in most cases * edge binding XWindows replaced with regular canvas objects * some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result comp files and descriptions: e_comp.c - overall compositor functions, rendering/update loop, shape cutting e_comp_x.c - X window management and compositor functionality e_comp_wl.c - Wayland surface management and compositor functionality e_comp_canvas.c - general compositor canvas functions and utilities e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems additional authors: ivan.briano@intel.com feature: new compositor removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
_e_illume_cfg->policy.softkey.type = E_WINDOW_TYPE_DOCK;
_e_illume_cfg->policy.softkey.match.class = 0;
_e_illume_cfg->policy.softkey.match.name = 1;
_e_illume_cfg->policy.softkey.match.title = 1;
_e_illume_cfg->policy.softkey.match.type = 0;
_e_illume_cfg->policy.home.class = eina_stringshare_add("Illume-Home");
_e_illume_cfg->policy.home.name = eina_stringshare_add("Illume-Home");
_e_illume_cfg->policy.home.title = eina_stringshare_add("Illume Home");
compositor rewrite / charlie-foxtrot situation huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once. * compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine. ** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes ** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects ** protocol-specific window management and compositor functionality is now kept exclusively in backend files ** e_pixmap api provides generic client finding and rendering api ** screen/xinerama screens are now provided directly by compositor on startup and re-set on change ** e_comp_render_update finally replaced with eina_tiler ** wayland compositor no longer creates X windows ** compositor e_layout removed entirely * e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra * e_manager is just for screensaver and keybind stuff now, possibly remove later? * e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor ** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed. *** do NOT set interceptors on a client's comp_object. seriously. * startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor * ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get * e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas * deskmirror is (more) broken for now * illume is totally fucked * Ecore_X_Window replaced with Ecore_Window in most cases * edge binding XWindows replaced with regular canvas objects * some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result comp files and descriptions: e_comp.c - overall compositor functions, rendering/update loop, shape cutting e_comp_x.c - X window management and compositor functionality e_comp_wl.c - Wayland surface management and compositor functionality e_comp_canvas.c - general compositor canvas functions and utilities e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems additional authors: ivan.briano@intel.com feature: new compositor removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
_e_illume_cfg->policy.home.type = E_WINDOW_TYPE_NORMAL;
_e_illume_cfg->policy.home.match.class = 0;
_e_illume_cfg->policy.home.match.name = 1;
_e_illume_cfg->policy.home.match.title = 1;
_e_illume_cfg->policy.home.match.type = 0;
/* create config for initial zone */
cz = E_NEW(E_Illume_Config_Zone, 1);
cz->id = 0;
cz->mode.dual = 0;
cz->mode.side = 0;
/* add zone config to main config structure */
_e_illume_cfg->policy.zones =
eina_list_append(_e_illume_cfg->policy.zones, cz);
/* add any new config variables here */
/* if ((_e_illume_cfg->version & 0xffff) < 1) */
_e_illume_cfg->version = ((IL_CONFIG_MAJOR << 16) | IL_CONFIG_MINOR);
}