From 8fc7b2c171abe61e9fc9ed8e4e8c097ee74a45a2 Mon Sep 17 00:00:00 2001 From: usering-around <226918848+usering-around@users.noreply.github.com> Date: Fri, 19 Sep 2025 17:58:03 +0300 Subject: [PATCH] input: fix virtual keyboard keymaps (#11763) --- src/devices/IKeyboard.cpp | 15 +-------------- src/devices/IKeyboard.hpp | 3 +-- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/src/devices/IKeyboard.cpp b/src/devices/IKeyboard.cpp index 0fc30ca9..7e6320e2 100644 --- a/src/devices/IKeyboard.cpp +++ b/src/devices/IKeyboard.cpp @@ -43,15 +43,11 @@ void IKeyboard::clearManuallyAllocd() { if (m_xkbKeymap) xkb_keymap_unref(m_xkbKeymap); - if (m_xkbKeymapV1) - xkb_keymap_unref(m_xkbKeymapV1); - if (m_xkbSymState) xkb_state_unref(m_xkbSymState); m_xkbSymState = nullptr; m_xkbKeymap = nullptr; - m_xkbKeymapV1 = nullptr; m_xkbState = nullptr; m_xkbStaticState = nullptr; m_xkbKeymapFD.reset(); @@ -116,15 +112,6 @@ void IKeyboard::setKeymap(const SStringRuleNames& rules) { m_xkbKeymap = xkb_keymap_new_from_names2(CONTEXT, &XKBRULES, XKB_KEYMAP_FORMAT_TEXT_V2, XKB_KEYMAP_COMPILE_NO_FLAGS); } - auto cKeymapStr = xkb_keymap_get_as_string(m_xkbKeymap, XKB_KEYMAP_FORMAT_TEXT_V1); - if (!cKeymapStr) { - Debug::log(ERR, "Couldn't convert keymap to V1 format"); - m_xkbKeymapV1 = xkb_keymap_new_from_names2(CONTEXT, &XKBRULES, XKB_KEYMAP_FORMAT_TEXT_V1, XKB_KEYMAP_COMPILE_NO_FLAGS); - } else { - m_xkbKeymapV1 = xkb_keymap_new_from_string(CONTEXT, cKeymapStr, XKB_KEYMAP_FORMAT_TEXT_V1, XKB_KEYMAP_COMPILE_NO_FLAGS); - free(cKeymapStr); - } - updateXKBTranslationState(m_xkbKeymap); const auto NUMLOCKON = g_pConfigManager->getDeviceInt(m_hlName, "numlock_by_default", "input:numlock_by_default"); @@ -169,7 +156,7 @@ void IKeyboard::updateKeymapFD() { auto cKeymapStr = xkb_keymap_get_as_string(m_xkbKeymap, XKB_KEYMAP_FORMAT_TEXT_V2); m_xkbKeymapString = cKeymapStr; free(cKeymapStr); - auto cKeymapV1Str = xkb_keymap_get_as_string(m_xkbKeymapV1, XKB_KEYMAP_FORMAT_TEXT_V1); + auto cKeymapV1Str = xkb_keymap_get_as_string(m_xkbKeymap, XKB_KEYMAP_FORMAT_TEXT_V1); m_xkbKeymapV1String = cKeymapV1Str; free(cKeymapV1Str); diff --git a/src/devices/IKeyboard.hpp b/src/devices/IKeyboard.hpp index 9e4bea4e..eb213254 100644 --- a/src/devices/IKeyboard.hpp +++ b/src/devices/IKeyboard.hpp @@ -99,8 +99,7 @@ class IKeyboard : public IHID { xkb_state* m_xkbStaticState = nullptr; xkb_state* m_xkbSymState = nullptr; // same as static but gets layouts - xkb_keymap* m_xkbKeymap = nullptr; - xkb_keymap* m_xkbKeymapV1 = nullptr; + xkb_keymap* m_xkbKeymap = nullptr; struct { uint32_t depressed = 0, latched = 0, locked = 0, group = 0;