aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorthinkingwithberries <[email protected]>2022-06-23 21:51:40 +0800
committerGitHub <[email protected]>2022-06-23 21:51:40 +0800
commit3c6526dbbec819787c2a74e8e6d0407ee0f58146 (patch)
treede6fa24e2715e6ac34590aa29ccead42c9329626
parentccdb03391ecc4f66034a056a4bd601e3477d8b3d (diff)
parent4945c5887d516fafc84d53e041b2aa901c7c94ee (diff)
downloadHyprland-3c6526dbbec819787c2a74e8e6d0407ee0f58146.tar.gz
Hyprland-3c6526dbbec819787c2a74e8e6d0407ee0f58146.zip
Merge branch 'hyprwm:main' into ex-conf-improvements
-rw-r--r--src/managers/input/InputManager.cpp38
-rw-r--r--src/managers/input/InputManager.hpp4
2 files changed, 20 insertions, 22 deletions
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index 6bc59472..fb4b50ef 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -274,20 +274,26 @@ void CInputManager::newKeyboard(wlr_input_device* keyboard) {
}
void CInputManager::setKeyboardLayout() {
+ for (auto& k : m_lKeyboards)
+ applyConfigToKeyboard(&k);
+}
+
+void CInputManager::applyConfigToKeyboard(SKeyboard* pKeyboard) {
+
+ ASSERT(pKeyboard);
- const auto RULES = g_pConfigManager->getString("input:kb_rules");
- const auto MODEL = g_pConfigManager->getString("input:kb_model");
- const auto LAYOUT = g_pConfigManager->getString("input:kb_layout");
- const auto VARIANT = g_pConfigManager->getString("input:kb_variant");
- const auto OPTIONS = g_pConfigManager->getString("input:kb_options");
+ const auto RULES = g_pConfigManager->getString("input:kb_rules");
+ const auto MODEL = g_pConfigManager->getString("input:kb_model");
+ const auto LAYOUT = g_pConfigManager->getString("input:kb_layout");
+ const auto VARIANT = g_pConfigManager->getString("input:kb_variant");
+ const auto OPTIONS = g_pConfigManager->getString("input:kb_options");
xkb_rule_names rules = {
.rules = RULES.c_str(),
.model = MODEL.c_str(),
.layout = LAYOUT.c_str(),
.variant = VARIANT.c_str(),
- .options = OPTIONS.c_str()
- };
+ .options = OPTIONS.c_str()};
const auto CONTEXT = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
const auto KEYMAP = xkb_keymap_new_from_names(CONTEXT, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS);
@@ -298,17 +304,7 @@ void CInputManager::setKeyboardLayout() {
return;
}
- const auto PLASTKEEB = m_pActiveKeyboard->keyboard->keyboard;
-
- if (!PLASTKEEB) {
- xkb_keymap_unref(KEYMAP);
- xkb_context_unref(CONTEXT);
-
- Debug::log(ERR, "No Seat Keyboard???");
- return;
- }
-
- wlr_keyboard_set_keymap(PLASTKEEB, KEYMAP);
+ wlr_keyboard_set_keymap(pKeyboard->keyboard->keyboard, KEYMAP);
wlr_keyboard_modifiers wlrMods = {0};
@@ -321,14 +317,14 @@ void CInputManager::setKeyboardLayout() {
}
if (wlrMods.locked != 0) {
- wlr_keyboard_notify_modifiers(g_pInputManager->m_pActiveKeyboard->keyboard->keyboard, 0, 0, wlrMods.locked, 0);
+ wlr_keyboard_notify_modifiers(pKeyboard->keyboard->keyboard, 0, 0, wlrMods.locked, 0);
}
xkb_keymap_unref(KEYMAP);
xkb_context_unref(CONTEXT);
- Debug::log(LOG, "Set the keyboard layout to %s and variant to %s", rules.layout, rules.variant);
-}
+ Debug::log(LOG, "Set the keyboard layout to %s and variant to %s for keyboard \"%s\"", rules.layout, rules.variant, pKeyboard->keyboard->name);
+}
void CInputManager::newMouse(wlr_input_device* mouse) {
m_lMice.emplace_back();
diff --git a/src/managers/input/InputManager.hpp b/src/managers/input/InputManager.hpp
index 18d9857e..ef962bdd 100644
--- a/src/managers/input/InputManager.hpp
+++ b/src/managers/input/InputManager.hpp
@@ -52,13 +52,15 @@ public:
SKeyboard* m_pActiveKeyboard = nullptr;
- private:
+private:
uint32_t m_uiCapabilities = 0;
void mouseMoveUnified(uint32_t, bool refocus = false);
STabletTool* ensureTabletToolPresent(wlr_tablet_tool*);
+
+ void applyConfigToKeyboard(SKeyboard*);
};
inline std::unique_ptr<CInputManager> g_pInputManager; \ No newline at end of file