added an option to use keysyms as ints

This commit is contained in:
vaxerski 2022-04-12 15:29:44 +02:00
parent 1667180ac3
commit b52e6ea055
1 changed files with 5 additions and 6 deletions

View File

@ -21,6 +21,9 @@ uint32_t KeybindManager::getKeyCodeFromName(std::string name) {
if (name == "")
return 0;
if (name.find_first_not_of("1234567890") == std::string::npos)
return std::stoi(name);
const auto ORIGINALCASENAME = name;
transform(name.begin(), name.end(), name.begin(), ::tolower);
@ -69,12 +72,8 @@ uint32_t KeybindManager::getKeyCodeFromName(std::string name) {
unsigned int KeybindManager::modToMask(std::string mod) {
try {
uint32_t modmask = std::stoi(mod.c_str());
return modmask;
} catch(...) {
; // means its not alphanumeric, go ahead
}
if (mod.find_first_not_of("1234567890") == std::string::npos && mod != "")
return std::stoi(mod);
unsigned int sum = 0;