summaryrefslogtreecommitdiff
path: root/src/managers/input/InputManager.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-12-16 17:20:51 +0000
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-12-16 17:20:51 +0000
commitf72c237d85f406f4a6a4ca181ee35399ca8c37bc (patch)
tree3c9d099d171c5ef4dc5d359cfaa1ae705cab05c1 /src/managers/input/InputManager.cpp
parent98a4fa2b0d79298fa29b048a3ba15c3bf5aed8cd (diff)
add disabling keyboards
Diffstat (limited to 'src/managers/input/InputManager.cpp')
-rw-r--r--src/managers/input/InputManager.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index d3cd9079..6815f36b 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -555,6 +555,10 @@ void CInputManager::applyConfigToKeyboard(SKeyboard* pKeyboard) {
const auto VARIANT = HASCONFIG ? g_pConfigManager->getDeviceString(devname, "kb_variant") : g_pConfigManager->getString("input:kb_variant");
const auto OPTIONS = HASCONFIG ? g_pConfigManager->getDeviceString(devname, "kb_options") : g_pConfigManager->getString("input:kb_options");
+ const auto ENABLED = HASCONFIG ? g_pConfigManager->getDeviceInt(devname, "enabled") : true;
+
+ pKeyboard->enabled = ENABLED;
+
try {
if (NUMLOCKON == pKeyboard->numlockOn && REPEATDELAY == pKeyboard->repeatDelay && REPEATRATE == pKeyboard->repeatRate && RULES != "" &&
RULES == pKeyboard->currentRules.rules && MODEL == pKeyboard->currentRules.model && LAYOUT == pKeyboard->currentRules.layout &&
@@ -847,6 +851,9 @@ void CInputManager::updateKeyboardsLeds(wlr_input_device* pKeyboard) {
}
void CInputManager::onKeyboardKey(wlr_keyboard_key_event* e, SKeyboard* pKeyboard) {
+ if (!pKeyboard->enabled)
+ return;
+
bool passEvent = g_pKeybindManager->onKeyEvent(e, pKeyboard);
wlr_idle_notify_activity(g_pCompositor->m_sWLRIdle, g_pCompositor->m_sSeat.seat);
@@ -868,6 +875,9 @@ void CInputManager::onKeyboardKey(wlr_keyboard_key_event* e, SKeyboard* pKeyboar
}
void CInputManager::onKeyboardMod(void* data, SKeyboard* pKeyboard) {
+ if (!pKeyboard->enabled)
+ return;
+
const auto PIMEGRAB = m_sIMERelay.getIMEKeyboardGrab(pKeyboard);
const auto ALLMODS = accumulateModsFromAllKBs();
@@ -1053,6 +1063,9 @@ uint32_t CInputManager::accumulateModsFromAllKBs() {
if (kb.isVirtual && shouldIgnoreVirtualKeyboard(&kb))
continue;
+ if (!kb.enabled)
+ continue;
+
finalMask |= wlr_keyboard_get_modifiers(wlr_keyboard_from_input_device(kb.keyboard));
}