mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-05-19 08:30:22 -07:00
keybinds: allow executing binds not bound to a key (#10102)
This commit is contained in:
parent
400dd16072
commit
d29723cb76
@ -150,6 +150,10 @@ CKeybindManager::CKeybindManager() {
|
||||
if (!m_pLastLongPressKeybind || g_pSeatManager->keyboard.expired())
|
||||
return;
|
||||
|
||||
const auto PACTIVEKEEB = g_pSeatManager->keyboard.lock();
|
||||
if (!PACTIVEKEEB->allowBinds)
|
||||
return;
|
||||
|
||||
const auto DISPATCHER = g_pKeybindManager->m_mDispatchers.find(m_pLastLongPressKeybind->handler);
|
||||
|
||||
Debug::log(LOG, "Long press timeout passed, calling dispatcher.");
|
||||
@ -163,6 +167,10 @@ CKeybindManager::CKeybindManager() {
|
||||
if (m_vActiveKeybinds.size() == 0 || g_pSeatManager->keyboard.expired())
|
||||
return;
|
||||
|
||||
const auto PACTIVEKEEB = g_pSeatManager->keyboard.lock();
|
||||
if (!PACTIVEKEEB->allowBinds)
|
||||
return;
|
||||
|
||||
for (const auto& k : m_vActiveKeybinds) {
|
||||
const auto DISPATCHER = g_pKeybindManager->m_mDispatchers.find(k->handler);
|
||||
|
||||
@ -170,7 +178,6 @@ CKeybindManager::CKeybindManager() {
|
||||
DISPATCHER->second(k->arg);
|
||||
}
|
||||
|
||||
const auto PACTIVEKEEB = g_pSeatManager->keyboard.lock();
|
||||
self->updateTimeout(std::chrono::milliseconds(1000 / PACTIVEKEEB->repeatRate));
|
||||
},
|
||||
nullptr);
|
||||
@ -424,6 +431,9 @@ bool CKeybindManager::onKeyEvent(std::any event, SP<IKeyboard> pKeyboard) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!pKeyboard->allowBinds)
|
||||
return true;
|
||||
|
||||
if (!m_pXKBTranslationState) {
|
||||
Debug::log(ERR, "BUG THIS: m_pXKBTranslationState nullptr!");
|
||||
updateXKBTranslationState();
|
||||
@ -434,9 +444,6 @@ bool CKeybindManager::onKeyEvent(std::any event, SP<IKeyboard> pKeyboard) {
|
||||
|
||||
auto e = std::any_cast<IKeyboard::SKeyEvent>(event);
|
||||
|
||||
if (!pKeyboard->allowBinds)
|
||||
return true;
|
||||
|
||||
const auto KEYCODE = e.keycode + 8; // Because to xkbcommon it's +8 from libinput
|
||||
|
||||
const xkb_keysym_t keysym = xkb_state_key_get_one_sym(pKeyboard->resolveBindsBySym ? pKeyboard->xkbSymState : m_pXKBTranslationState, KEYCODE);
|
||||
@ -770,6 +777,8 @@ SDispatchResult CKeybindManager::handleKeybinds(const uint32_t modmask, const SP
|
||||
else if (SPECIALDISPATCHER && pressed)
|
||||
m_vPressedSpecialBinds.emplace_back(k);
|
||||
|
||||
found = true;
|
||||
|
||||
// Should never happen, as we check in the ConfigManager, but oh well
|
||||
if (DISPATCHER == m_mDispatchers.end()) {
|
||||
Debug::log(ERR, "Invalid handler in a keybind! (handler {} does not exist)", k->handler);
|
||||
@ -787,11 +796,9 @@ SDispatchResult CKeybindManager::handleKeybinds(const uint32_t modmask, const SP
|
||||
|
||||
m_iPassPressed = -1;
|
||||
|
||||
if (k->handler == "submap") {
|
||||
found = true; // don't process keybinds on submap change.
|
||||
if (k->handler == "submap")
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (k->repeat) {
|
||||
const auto PACTIVEKEEB = g_pSeatManager->keyboard.lock();
|
||||
|
@ -1540,9 +1540,6 @@ uint32_t CInputManager::accumulateModsFromAllKBs() {
|
||||
if (!kb->enabled)
|
||||
continue;
|
||||
|
||||
if (!kb->allowBinds)
|
||||
continue;
|
||||
|
||||
finalMask |= kb->getModifiers();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user