mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-22 18:49:49 +01:00
fix keybinds shadowing multibinds
This commit is contained in:
parent
1626707b7f
commit
8dcc3032a8
2 changed files with 13 additions and 3 deletions
|
@ -184,7 +184,7 @@ bool CKeybindManager::handleKeybinds(const uint32_t& modmask, const std::string&
|
|||
DISPATCHER->second(k.arg);
|
||||
}
|
||||
|
||||
shadowKeybinds();
|
||||
shadowKeybinds(keysym == 0 ? 0 : keysym, keycode == -1 ? -1 : keycode);
|
||||
|
||||
found = true;
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ bool CKeybindManager::handleKeybinds(const uint32_t& modmask, const std::string&
|
|||
return found;
|
||||
}
|
||||
|
||||
void CKeybindManager::shadowKeybinds() {
|
||||
void CKeybindManager::shadowKeybinds(const xkb_keysym_t& doesntHave, const uint32_t& doesntHaveCode) {
|
||||
// shadow disables keybinds after one has been triggered
|
||||
|
||||
for (auto& k : m_lKeybinds) {
|
||||
|
@ -206,12 +206,22 @@ void CKeybindManager::shadowKeybinds() {
|
|||
if ((pk == KBKEY || pk == KBKEYUPPER)) {
|
||||
shadow = true;
|
||||
}
|
||||
|
||||
if (pk == doesntHave && doesntHave != 0) {
|
||||
shadow = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& pk : m_dPressedKeycodes) {
|
||||
if (pk == (unsigned int)k.keycode) {
|
||||
shadow = true;
|
||||
}
|
||||
|
||||
if (pk == doesntHaveCode && doesntHaveCode != 0 && doesntHaveCode != -1) {
|
||||
shadow = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
k.shadowed = shadow;
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
void removeKeybind(uint32_t, const std::string&);
|
||||
uint32_t stringToModMask(std::string);
|
||||
void clearKeybinds();
|
||||
void shadowKeybinds();
|
||||
void shadowKeybinds(const xkb_keysym_t& doesntHave = 0, const uint32_t& doesntHaveCode = 0);
|
||||
|
||||
std::unordered_map<std::string, std::function<void(std::string)>> m_mDispatchers;
|
||||
|
||||
|
|
Loading…
Reference in a new issue