From 0d5115ab6b965207f7f073c60389de9893bc71b8 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Mon, 26 Feb 2024 18:34:34 +0000 Subject: [PATCH] core: use lowercase syms for tracking keypresses fixes #86 --- src/core/hyprlock.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/core/hyprlock.cpp b/src/core/hyprlock.cpp index 1566d5d..fe8c3d6 100644 --- a/src/core/hyprlock.cpp +++ b/src/core/hyprlock.cpp @@ -652,20 +652,21 @@ std::optional CHyprlock::passwordLastFailReason() { } void CHyprlock::onKey(uint32_t key, bool down) { - const auto SYM = xkb_state_key_get_one_sym(m_pXKBState, key + 8); + const auto SYM = xkb_state_key_get_one_sym(m_pXKBState, key + 8); + const auto LOWERSYM = xkb_keysym_to_lower(SYM); - if (down && std::find(m_vPressedKeys.begin(), m_vPressedKeys.end(), SYM) != m_vPressedKeys.end()) { + if (down && std::find(m_vPressedKeys.begin(), m_vPressedKeys.end(), LOWERSYM) != m_vPressedKeys.end()) { Debug::log(ERR, "Invalid key down event (key already pressed?)"); return; - } else if (!down && std::find(m_vPressedKeys.begin(), m_vPressedKeys.end(), SYM) == m_vPressedKeys.end()) { + } else if (!down && std::find(m_vPressedKeys.begin(), m_vPressedKeys.end(), LOWERSYM) == m_vPressedKeys.end()) { Debug::log(ERR, "Invalid key down event (stray release event?)"); return; } if (down) - m_vPressedKeys.push_back(SYM); + m_vPressedKeys.push_back(LOWERSYM); else - std::erase(m_vPressedKeys, SYM); + std::erase(m_vPressedKeys, LOWERSYM); if (!down) // we dont care about up events return;