summaryrefslogtreecommitdiff
path: root/src/managers/KeybindManager.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-07-08 09:32:09 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-07-08 09:32:09 +0200
commit46306e59eb4c393ab96231139bb45b888f274e7c (patch)
tree5729e9b9a68eb93315c57e08d481ff1df101ea0f /src/managers/KeybindManager.cpp
parentcd0a01f4de6e1489caa35bece331c81dbaab2587 (diff)
added keycode support to unbind
Diffstat (limited to 'src/managers/KeybindManager.cpp')
-rw-r--r--src/managers/KeybindManager.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index bb66e83d..9fed911b 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -41,8 +41,21 @@ void CKeybindManager::addKeybind(SKeybind kb) {
void CKeybindManager::removeKeybind(uint32_t mod, const std::string& key) {
for (auto it = m_lKeybinds.begin(); it != m_lKeybinds.end(); ++it) {
- if (it->modmask == mod && it->key == key) {
+ if (isNumber(key) && std::stoi(key) > 9) {
+ const auto KEYNUM = std::stoi(key);
+
+ if (it->modmask == mod && it->keycode == KEYNUM) {
+ it = m_lKeybinds.erase(it);
+
+ if (it == m_lKeybinds.end())
+ break;
+ }
+ }
+ else if (it->modmask == mod && it->key == key) {
it = m_lKeybinds.erase(it);
+
+ if (it == m_lKeybinds.end())
+ break;
}
}
}