diff options
author | Harry Jeffery <harry@exec64.co.uk> | 2017-11-28 21:39:07 +0000 |
---|---|---|
committer | Harry Jeffery <harry@exec64.co.uk> | 2017-11-28 21:39:07 +0000 |
commit | 86b7b1bf49605f2d301e4a81658a39c0e8b40caa (patch) | |
tree | 5ac5408bf89adb9b4a9e00fdf1bc62ed668d7ab7 /src/binds.c | |
parent | fe4d9bcf92b504e4a67600f90aa57c1f9791c0a6 (diff) | |
download | imv-86b7b1bf49605f2d301e4a81658a39c0e8b40caa.tar.gz |
Simplify and refactor ini usage
Switch imv to use a more mature ini implementation, and also simplify
the ini syntax in the config files.
Diffstat (limited to 'src/binds.c')
-rw-r--r-- | src/binds.c | 16 |
1 files changed, 13 insertions, 3 deletions
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; } } |