all repos — fluxbox @ f9af363e24b18510554c54950ce1f5d142419c0c

custom fork of the fluxbox windowmanager

added the ability to use keycode in keys file
fluxgen fluxgen
commit

f9af363e24b18510554c54950ce1f5d142419c0c

parent

3172279d104738a72352739c07bf658aa0324d03

1 files changed, 20 insertions(+), 2 deletions(-)

jump to
M src/Keys.ccsrc/Keys.cc

@@ -201,9 +201,27 @@ int tmpmod = FbTk::KeyUtil::getModifier(val[argc].c_str());

if(tmpmod) mod |= tmpmod; //If it's a modifier else { - key = FbTk::KeyUtil::getKey(val[argc].c_str()); // else get the key + // keycode covers the following three two-byte cases: + // 0x - hex + // +[1-9] - number between +1 and +9 + // numbers 10 and above + // + if (val[argc].size() > 1 && (isdigit(val[argc][0]) && + (isdigit(val[argc][1]) || val[argc][1] == 'x') || + val[argc][0] == '+' && isdigit(val[argc][1])) ) { + + key = strtoul(val[argc].c_str(), NULL, 0); + + if (errno == EINVAL || errno == ERANGE) + key = 0; + + } else // convert from string symbol + key = FbTk::KeyUtil::getKey(val[argc].c_str()); + if (key == 0) { - cerr<<_FBTEXT(Keys, InvalidKeyMod, "Keys: Invalid key/modifier on line", "A bad key/modifier string was found on line (number following)")<<" "<< + cerr<<_FBTEXT(Keys, InvalidKeyMod, + "Keys: Invalid key/modifier on line", + "A bad key/modifier string was found on line (number following)")<<" "<< m_current_line<<"): "<<linebuffer<<endl; return false; }