keyboard code further cleanup

This commit is contained in:
vaxerski 2022-06-03 19:15:39 +02:00
parent 246aa000f5
commit ef855440c6

View file

@ -236,17 +236,9 @@ void CInputManager::newKeyboard(wlr_input_device* keyboard) {
PNEWKEYBOARD->keyboard = keyboard;
xkb_rule_names rules;
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 REPEATRATE = g_pConfigManager->getInt("input:repeat_rate");
const auto REPEATDELAY = g_pConfigManager->getInt("input:repeat_delay");
wlr_keyboard_set_keymap(keyboard->keyboard, KEYMAP);
xkb_keymap_unref(KEYMAP);
xkb_context_unref(CONTEXT);
wlr_keyboard_set_repeat_info(keyboard->keyboard, std::max(0, REPEATRATE), std::max(0, REPEATDELAY));
PNEWKEYBOARD->hyprListener_keyboardMod.initCallback(&keyboard->keyboard->events.modifiers, &Events::listener_keyboardMod, PNEWKEYBOARD, "Keyboard");
@ -257,11 +249,11 @@ void CInputManager::newKeyboard(wlr_input_device* keyboard) {
m_pActiveKeyboard->active = false;
m_pActiveKeyboard = PNEWKEYBOARD;
setKeyboardLayout();
wlr_seat_set_keyboard(g_pCompositor->m_sSeat.seat, keyboard->keyboard);
Debug::log(LOG, "New keyboard created, pointers Hypr: %x and WLR: %x", PNEWKEYBOARD, keyboard);
setKeyboardLayout();
}
void CInputManager::setKeyboardLayout() {
@ -289,7 +281,7 @@ void CInputManager::setKeyboardLayout() {
return;
}
const auto PLASTKEEB = wlr_seat_get_keyboard(g_pCompositor->m_sSeat.seat);
const auto PLASTKEEB = m_pActiveKeyboard->keyboard->keyboard;
if (!PLASTKEEB) {
xkb_keymap_unref(KEYMAP);