diff options
author | corvid <corvid@lavabit.com> | 2009-06-05 00:12:41 +0000 |
---|---|---|
committer | corvid <corvid@lavabit.com> | 2009-06-05 00:12:41 +0000 |
commit | 03949fea7859bb716ea4389fcf253d04a1b6c6fc (patch) | |
tree | 4af10e1b56e59a1c56b16ee88fccff01517ae4c2 /src/keys.cc | |
parent | 829e38e0ca1d214e00d8076120c50092f319d356 (diff) |
Get key bindings for File menu
Diffstat (limited to 'src/keys.cc')
-rw-r--r-- | src/keys.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/keys.cc b/src/keys.cc index e6f31fc4..17735822 100644 --- a/src/keys.cc +++ b/src/keys.cc @@ -239,6 +239,22 @@ int Keys::getModifier(char *modifierName) } /* + * Given a keys command, return a shortcut for it, or 0 if there is none + * (e.g., for KEYS_NEW_WINDOW, return CTRL+'n'). + */ +int Keys::getShortcut(int command) +{ + int len = dList_length(bindings); + + for (int i = 0; i < len; i++) { + KeyBinding_t *node = (KeyBinding_t*)dList_nth_data(bindings, i); + if (command == node->cmd) + return node->modifier + node->key; + } + return 0; +} + +/* * Parse a key-combination/command-name pair, and * insert it into the bindings list. */ |