diff options
author | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2008-12-02 00:56:43 +0000 |
---|---|---|
committer | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2008-12-02 00:56:43 +0000 |
commit | 2fba93b6904e22e46de66648d5c98af7512e1e1e (patch) | |
tree | 074c1f9f991127acbdad7724d3eccfe45d055ab8 /termkey.c | |
parent | f75bdf1516b031b0f975b77f289ea408e30cb9c9 (diff) | |
download | termo-2fba93b6904e22e46de66648d5c98af7512e1e1e.tar.gz termo-2fba93b6904e22e46de66648d5c98af7512e1e1e.tar.xz termo-2fba93b6904e22e46de66648d5c98af7512e1e1e.zip |
Added termkey_keyname2sym() to API
Diffstat (limited to 'termkey.c')
-rw-r--r-- | termkey.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -824,6 +824,20 @@ const char *termkey_get_keyname(termkey_t *tk, termkey_keysym sym) return "UNKNOWN"; } +termkey_keysym termkey_keyname2sym(termkey_t *tk, const char *keyname) +{ + /* We store an array, so we can't do better than a linear search. Doesn't + * matter because user won't be calling this too often */ + + termkey_keysym sym; + + for(sym = 0; sym < tk->nkeynames; sym++) + if(tk->keynames[sym] && strcmp(keyname, tk->keynames[sym]) == 0) + return sym; + + return TERMKEY_SYM_UNKNOWN; +} + static termkey_keysym register_c0(termkey_t *tk, termkey_keysym sym, unsigned char ctrl, const char *name) { return register_c0_full(tk, sym, 0, 0, ctrl, name); |