aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2016-03-15 19:42:04 +0100
committerBoris Faure <billiob@gmail.com>2016-03-15 19:42:04 +0100
commitbf4a1f4abacff8828bdfd7fb157364490fb70210 (patch)
tree5b2a92c582db99e71f9208e49fcb867c77577381
parenttermpty_cellrow_get() might return NULL. CID1352819 (diff)
downloadterminology-bf4a1f4abacff8828bdfd7fb157364490fb70210.tar.gz
remove buggy keybinding dedup
-rw-r--r--src/bin/config.c20
-rw-r--r--src/bin/keyin.c20
2 files changed, 14 insertions, 26 deletions
diff --git a/src/bin/config.c b/src/bin/config.c
index 82d858e..14982e9 100644
--- a/src/bin/config.c
+++ b/src/bin/config.c
@@ -372,24 +372,6 @@ _add_key(Config *config, const char *name, int ctrl, int alt, int shift,
#undef ADD_KB
-static void
-_remove_duplicate_keys(Config *config)
-{
- Eina_Hash * keys = eina_hash_string_superfast_new(NULL);
- Eina_List *l, *l_next;
- Config_Keys *kb;
-
- EINA_LIST_FOREACH_SAFE(config->keys, l, l_next, kb) {
- if (eina_hash_add(keys, kb->cb, NULL) != EINA_TRUE) {
- config->keys = eina_list_remove_list(config->keys, l);
- eina_stringshare_del(kb->keyname);
- eina_stringshare_del(kb->cb);
- free(kb);
- }
- }
- eina_hash_free(keys);
-}
-
void
config_default_font_set(Config *config, Evas *evas)
{
@@ -590,7 +572,7 @@ config_load(const char *key)
_add_key(config, "t", 1, 1, 0, 0, "tab_title");
/*pass through*/
case 9:
- _remove_duplicate_keys(config);
+ /* actually do nothing */
/*pass through*/
case CONF_VER: /* 10 */
config->version = CONF_VER;
diff --git a/src/bin/keyin.c b/src/bin/keyin.c
index 817e203..deabe81 100644
--- a/src/bin/keyin.c
+++ b/src/bin/keyin.c
@@ -742,6 +742,7 @@ _key_binding_free(void *data)
free(kb);
}
+/* Returns -2 for duplicate key, 0 on success, -1 otherwise */
int
keyin_add_config(Config_Keys *key)
{
@@ -763,7 +764,7 @@ keyin_add_config(Config_Keys *key)
{
_key_binding_free(kb);
ERR("duplicate key '%s'", key->keyname);
- return -1;
+ return -2;
}
return 0;
}
@@ -783,11 +784,11 @@ keyin_remove_config(Config_Keys *key)
return 0;
}
-int
+int
key_bindings_load(Config *config)
{
Config_Keys *key;
- Eina_List *l;
+ Eina_List *l, *l_next;
if (!_key_bindings)
{
@@ -812,17 +813,22 @@ key_bindings_load(Config *config)
eina_hash_free_buckets(_key_bindings);
}
- EINA_LIST_FOREACH(config->keys, l, key)
+ EINA_LIST_FOREACH_SAFE(config->keys, l, l_next, key)
{
int res = keyin_add_config(key);
- if (res != 0)
- return res;
+ if (res == -2)
+ {
+ config->keys = eina_list_remove_list(config->keys, l);
+ eina_stringshare_del(key->keyname);
+ eina_stringshare_del(key->cb);
+ free(key);
+ }
}
return 0;
}
-void
+void
key_bindings_shutdown(void)
{
if (_key_bindings)