mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-02 11:05:58 +01:00
add disabling keyboards
This commit is contained in:
parent
98a4fa2b0d
commit
f72c237d85
2 changed files with 14 additions and 0 deletions
|
@ -103,6 +103,7 @@ struct SKeyboard {
|
||||||
|
|
||||||
bool isVirtual = false;
|
bool isVirtual = false;
|
||||||
bool active = false;
|
bool active = false;
|
||||||
|
bool enabled = true;
|
||||||
|
|
||||||
xkb_layout_index_t activeLayout = 0;
|
xkb_layout_index_t activeLayout = 0;
|
||||||
|
|
||||||
|
|
|
@ -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 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 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 {
|
try {
|
||||||
if (NUMLOCKON == pKeyboard->numlockOn && REPEATDELAY == pKeyboard->repeatDelay && REPEATRATE == pKeyboard->repeatRate && RULES != "" &&
|
if (NUMLOCKON == pKeyboard->numlockOn && REPEATDELAY == pKeyboard->repeatDelay && REPEATRATE == pKeyboard->repeatRate && RULES != "" &&
|
||||||
RULES == pKeyboard->currentRules.rules && MODEL == pKeyboard->currentRules.model && LAYOUT == pKeyboard->currentRules.layout &&
|
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) {
|
void CInputManager::onKeyboardKey(wlr_keyboard_key_event* e, SKeyboard* pKeyboard) {
|
||||||
|
if (!pKeyboard->enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
bool passEvent = g_pKeybindManager->onKeyEvent(e, pKeyboard);
|
bool passEvent = g_pKeybindManager->onKeyEvent(e, pKeyboard);
|
||||||
|
|
||||||
wlr_idle_notify_activity(g_pCompositor->m_sWLRIdle, g_pCompositor->m_sSeat.seat);
|
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) {
|
void CInputManager::onKeyboardMod(void* data, SKeyboard* pKeyboard) {
|
||||||
|
if (!pKeyboard->enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
const auto PIMEGRAB = m_sIMERelay.getIMEKeyboardGrab(pKeyboard);
|
const auto PIMEGRAB = m_sIMERelay.getIMEKeyboardGrab(pKeyboard);
|
||||||
|
|
||||||
const auto ALLMODS = accumulateModsFromAllKBs();
|
const auto ALLMODS = accumulateModsFromAllKBs();
|
||||||
|
@ -1053,6 +1063,9 @@ uint32_t CInputManager::accumulateModsFromAllKBs() {
|
||||||
if (kb.isVirtual && shouldIgnoreVirtualKeyboard(&kb))
|
if (kb.isVirtual && shouldIgnoreVirtualKeyboard(&kb))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (!kb.enabled)
|
||||||
|
continue;
|
||||||
|
|
||||||
finalMask |= wlr_keyboard_get_modifiers(wlr_keyboard_from_input_device(kb.keyboard));
|
finalMask |= wlr_keyboard_get_modifiers(wlr_keyboard_from_input_device(kb.keyboard));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue