From 86b7b1bf49605f2d301e4a81658a39c0e8b40caa Mon Sep 17 00:00:00 2001 From: Harry Jeffery Date: Tue, 28 Nov 2017 21:39:07 +0000 Subject: Simplify and refactor ini usage Switch imv to use a more mature ini implementation, and also simplify the ini syntax in the config files. --- src/binds.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/binds.c') diff --git a/src/binds.c b/src/binds.c index 9de63d7..e0426e6 100644 --- a/src/binds.c +++ b/src/binds.c @@ -189,15 +189,18 @@ static int print_event(char *buf, size_t len, const SDL_Event *event) /* Try plain old character input */ const char *keyname = SDL_GetKeyName(kevent->keysym.sym); - /* Because '<' and '>' have special meaning in our syntax, and '=' is - * restricted within ini files, we rename these. - */ + /* Because '<' and '>' have special meaning in our syntax, and '=', '[', and + * ']' are restricted within ini files, we rename these. */ if(!strcmp(keyname, "<")) { keyname = "Less"; } else if(!strcmp(keyname, ">")) { keyname = "Greater"; } else if(!strcmp(keyname, "=")) { keyname = "Equals"; + } else if(!strcmp(keyname, "[")) { + keyname = "LeftSquareBracket"; + } else if(!strcmp(keyname, "]")) { + keyname = "RightSquareBracket"; } return snprintf(buf, len, "%s%s", prefix, keyname); @@ -263,6 +266,13 @@ struct list *imv_bind_parse_keys(const char *keys) list_deep_free(list); return NULL; } + } else { + /* Just a regular character */ + char *item = malloc(2); + item[0] = *keys; + item[1] = 0; + list_append(list, item); + ++keys; } } -- cgit v1.2.3