bump config version, add mouse/wheel bindings for manipulating gadgets/bryces

this copies the user's current bindings for moving/resizing/menu on a window
and applies them to gadget-related objects for UX coherency
This commit is contained in:
Mike Blumenkrantz 2016-03-03 10:30:23 -05:00
parent 21a6a600c3
commit 863a50acbb
2 changed files with 82 additions and 1 deletions

View File

@ -65,6 +65,37 @@ typedef struct _E_Color_Class
int r3, g3, b3, a3;
} E_Color_Class;
static void
_e_config_binding_mouse_add(E_Binding_Context ctxt, int button, E_Binding_Modifier mod, int any_mod, const char *action, const char *params)
{
E_Config_Binding_Mouse *binding;
binding = calloc(1, sizeof(E_Config_Binding_Mouse));
binding->context = ctxt;
binding->button = button;
binding->modifiers = mod;
binding->any_mod = any_mod;
binding->action = eina_stringshare_add(action);
binding->params = eina_stringshare_add(params);
e_bindings->mouse_bindings = eina_list_append(e_bindings->mouse_bindings, binding);
}
static void
_e_config_binding_wheel_add(E_Binding_Context ctxt, int direction, int z, E_Binding_Modifier mod, int any_mod, const char *action, const char *params)
{
E_Config_Binding_Wheel *binding;
binding = calloc(1, sizeof(E_Config_Binding_Wheel));
binding->context = ctxt;
binding->direction = direction;
binding->z = z;
binding->modifiers = mod;
binding->any_mod = any_mod;
binding->action = eina_stringshare_add(action);
binding->params = eina_stringshare_add(params);
e_bindings->wheel_bindings = eina_list_append(e_bindings->wheel_bindings, binding);
}
static Eina_Bool
_e_config_cb_efreet_cache_update(void *data EINA_UNUSED, int type EINA_UNUSED, void *ev EINA_UNUSED)
{
@ -1351,6 +1382,56 @@ e_config_load(void)
e_config->keyboard.repeat_delay = 400;
e_config->keyboard.repeat_rate = 25;
}
CONFIG_VERSION_CHECK(20)
{
Eina_List *l;
E_Config_Binding_Mouse *ebm;
E_Config_Module *em, *module;
CONFIG_VERSION_UPDATE_INFO(20);
EINA_LIST_FOREACH(e_bindings->mouse_bindings, l, ebm)
{
if (eina_streq(ebm->action, "window_move"))
{
_e_config_binding_mouse_add(E_BINDING_CONTEXT_ANY, ebm->button, ebm->modifiers,
ebm->any_mod, "gadget_move", NULL);
}
else if (eina_streq(ebm->action, "window_resize"))
{
_e_config_binding_mouse_add(E_BINDING_CONTEXT_ANY, ebm->button, ebm->modifiers,
ebm->any_mod, "gadget_resize", NULL);
}
else if (eina_streq(ebm->action, "window_menu"))
{
_e_config_binding_mouse_add(E_BINDING_CONTEXT_ANY, ebm->button, ebm->modifiers,
ebm->any_mod, "gadget_menu", NULL);
_e_config_binding_mouse_add(E_BINDING_CONTEXT_ANY, ebm->button, ebm->modifiers,
ebm->any_mod, "bryce_menu", NULL);
}
}
_e_config_binding_wheel_add(E_BINDING_CONTEXT_ANY, 0, 1, E_BINDING_MODIFIER_CTRL, 0, "bryce_resize", NULL);
_e_config_binding_wheel_add(E_BINDING_CONTEXT_ANY, 0, -1, E_BINDING_MODIFIER_CTRL, 0, "bryce_resize", NULL);
EINA_LIST_FOREACH(e_config->modules, l, em)
{
if (!em->enabled) continue;
if (eina_streq(em->name, "connman"))
{
module = E_NEW(E_Config_Module, 1);
module->name = eina_stringshare_add("wireless");
module->enabled = 1;
e_config->modules = eina_list_append(e_config->modules, module);
}
else if (eina_streq(em->name, "clock"))
{
module = E_NEW(E_Config_Module, 1);
module->name = eina_stringshare_add("time");
module->enabled = 1;
e_config->modules = eina_list_append(e_config->modules, module);
}
}
}
}
if (!e_config->remember_internal_fm_windows)
e_config->remember_internal_fm_windows = !!(e_config->remember_internal_windows & E_REMEMBER_INTERNAL_FM_WINS);

View File

@ -46,7 +46,7 @@ typedef enum
/* increment this whenever a new set of config values are added but the users
* config doesn't need to be wiped - simply new values need to be put in
*/
#define E_CONFIG_FILE_GENERATION 19
#define E_CONFIG_FILE_GENERATION 20
#define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH * 1000000) + E_CONFIG_FILE_GENERATION)
#define E_CONFIG_BINDINGS_VERSION 0 // DO NOT INCREMENT UNLESS YOU WANT TO WIPE ALL BINDINGS!!!!!