diff options
author | nicm <nicm> | 2017-06-23 15:36:52 +0000 |
---|---|---|
committer | nicm <nicm> | 2017-06-23 15:36:52 +0000 |
commit | 95ed7d48c84198da0ec4b1b9b5de9358a47da753 (patch) | |
tree | 5b6515359ef39b43aae547292172ce20a17e160b /key-string.c | |
parent | a67df177634f5ff3f6a24598d4016f61a794af62 (diff) | |
download | rtmux-95ed7d48c84198da0ec4b1b9b5de9358a47da753.tar.gz rtmux-95ed7d48c84198da0ec4b1b9b5de9358a47da753.tar.bz2 rtmux-95ed7d48c84198da0ec4b1b9b5de9358a47da753.zip |
Add user-keys option to allow user-defined keys to be set, from Dan
Aloni.
Diffstat (limited to 'key-string.c')
-rw-r--r-- | key-string.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/key-string.c b/key-string.c index e1413a15..d630d778 100644 --- a/key-string.c +++ b/key-string.c @@ -110,12 +110,16 @@ static const struct { static key_code key_string_search_table(const char *string) { - u_int i; + u_int i, user; for (i = 0; i < nitems(key_string_table); i++) { if (strcasecmp(string, key_string_table[i].string) == 0) return (key_string_table[i].key); } + + if (sscanf(string, "User%u", &user) == 1 && user < KEYC_NUSER) + return (KEYC_USER + user); + return (KEYC_UNKNOWN); } @@ -265,6 +269,10 @@ key_string_lookup_key(key_code key) return ("MouseMoveStatus"); if (key == KEYC_MOUSEMOVE_BORDER) return ("MouseMoveBorder"); + if (key >= KEYC_USER && key < KEYC_USER + KEYC_NUSER) { + snprintf(out, sizeof out, "User%u", (u_int)(key - KEYC_USER)); + return (out); + } /* * Special case: display C-@ as C-Space. Could do this below in |