mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-07 16:05:59 +01:00
Merge branch 'hyprwm:main' into ex-conf-improvements
This commit is contained in:
commit
3c6526dbbe
2 changed files with 20 additions and 22 deletions
|
@ -274,6 +274,13 @@ void CInputManager::newKeyboard(wlr_input_device* keyboard) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::setKeyboardLayout() {
|
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 RULES = g_pConfigManager->getString("input:kb_rules");
|
||||||
const auto MODEL = g_pConfigManager->getString("input:kb_model");
|
const auto MODEL = g_pConfigManager->getString("input:kb_model");
|
||||||
|
@ -286,8 +293,7 @@ void CInputManager::setKeyboardLayout() {
|
||||||
.model = MODEL.c_str(),
|
.model = MODEL.c_str(),
|
||||||
.layout = LAYOUT.c_str(),
|
.layout = LAYOUT.c_str(),
|
||||||
.variant = VARIANT.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 CONTEXT = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||||
const auto KEYMAP = xkb_keymap_new_from_names(CONTEXT, &rules, XKB_KEYMAP_COMPILE_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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto PLASTKEEB = m_pActiveKeyboard->keyboard->keyboard;
|
wlr_keyboard_set_keymap(pKeyboard->keyboard->keyboard, KEYMAP);
|
||||||
|
|
||||||
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_modifiers wlrMods = {0};
|
wlr_keyboard_modifiers wlrMods = {0};
|
||||||
|
|
||||||
|
@ -321,13 +317,13 @@ void CInputManager::setKeyboardLayout() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wlrMods.locked != 0) {
|
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_keymap_unref(KEYMAP);
|
||||||
xkb_context_unref(CONTEXT);
|
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) {
|
void CInputManager::newMouse(wlr_input_device* mouse) {
|
||||||
|
|
|
@ -52,13 +52,15 @@ public:
|
||||||
|
|
||||||
SKeyboard* m_pActiveKeyboard = nullptr;
|
SKeyboard* m_pActiveKeyboard = nullptr;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
uint32_t m_uiCapabilities = 0;
|
uint32_t m_uiCapabilities = 0;
|
||||||
|
|
||||||
void mouseMoveUnified(uint32_t, bool refocus = false);
|
void mouseMoveUnified(uint32_t, bool refocus = false);
|
||||||
|
|
||||||
STabletTool* ensureTabletToolPresent(wlr_tablet_tool*);
|
STabletTool* ensureTabletToolPresent(wlr_tablet_tool*);
|
||||||
|
|
||||||
|
void applyConfigToKeyboard(SKeyboard*);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline std::unique_ptr<CInputManager> g_pInputManager;
|
inline std::unique_ptr<CInputManager> g_pInputManager;
|
Loading…
Reference in a new issue