Make "keybinding list" accept a context

See #588
develop
lethosor 2015-03-30 19:03:16 -04:00
parent 0849099f20
commit 331be2b589
1 changed files with 4 additions and 1 deletions

@ -1978,13 +1978,16 @@ std::vector<std::string> Core::ListKeyBindings(std::string keyspec)
{ {
int sym, mod; int sym, mod;
std::vector<std::string> rv; std::vector<std::string> rv;
if (!parseKeySpec(keyspec, &sym, &mod)) std::string focus;
if (!parseKeySpec(keyspec, &sym, &mod, &focus))
return rv; return rv;
tthread::lock_guard<tthread::mutex> lock(*HotkeyMutex); tthread::lock_guard<tthread::mutex> lock(*HotkeyMutex);
std::vector<KeyBinding> &bindings = key_bindings[sym]; std::vector<KeyBinding> &bindings = key_bindings[sym];
for (int i = bindings.size()-1; i >= 0; --i) { for (int i = bindings.size()-1; i >= 0; --i) {
if (focus.size() && focus != bindings[i].focus)
continue;
if (bindings[i].modifiers == mod) if (bindings[i].modifiers == mod)
{ {
std::string cmd = bindings[i].cmdline; std::string cmd = bindings[i].cmdline;