I am an idiot, keysym fix

This commit is contained in:
vaxerski 2022-04-12 22:14:04 +02:00
parent 245712664e
commit 1898839d4c
2 changed files with 8 additions and 3 deletions

View File

@ -21,8 +21,13 @@ 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);
if (name.find_first_not_of("1234567890") == std::string::npos) {
const auto KC = std::stoi(name);
if (KC > 10) // 0-9 are OK for parsing they are on the KB
return std::stoi(name);
}
const auto ORIGINALCASENAME = name;
transform(name.begin(), name.end(), name.begin(), ::tolower);

View File

@ -780,7 +780,7 @@ void Events::eventKeyPress(xcb_generic_event_t* event) {
const auto IGNOREDMOD = KeybindManager::modToMask(ConfigManager::getString("ignore_mod"));
for (auto& keybind : KeybindManager::keybinds) {
if (keybind.getKeysym() != 0 && keybind.getKeysym() == KEYSYM && (keybind.getMod() == E->state || ((keybind.getMod() | IGNOREDMOD) == E->state))) {
if (keybind.getKeysym() != 0 && keybind.getKeysym() == KEYSYM && ((keybind.getMod() == E->state) || ((keybind.getMod() | IGNOREDMOD) == E->state))) {
keybind.getDispatcher()(keybind.getCommand());
return;
// TODO: fix duplicating keybinds