mirror of
https://github.com/hyprwm/hyprlock.git
synced 2024-11-16 23:05:58 +01:00
core: use raw key values for tracking keypresses (#92)
This commit is contained in:
parent
8876ceccc2
commit
fd8b81aec8
1 changed files with 5 additions and 6 deletions
|
@ -653,20 +653,19 @@ std::optional<std::string> CHyprlock::passwordLastFailReason() {
|
||||||
|
|
||||||
void CHyprlock::onKey(uint32_t key, bool down) {
|
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(), LOWERSYM) != m_vPressedKeys.end()) {
|
if (down && std::find(m_vPressedKeys.begin(), m_vPressedKeys.end(), key) != m_vPressedKeys.end()) {
|
||||||
Debug::log(ERR, "Invalid key down event (key already pressed?)");
|
Debug::log(ERR, "Invalid key down event (key already pressed?)");
|
||||||
return;
|
return;
|
||||||
} else if (!down && std::find(m_vPressedKeys.begin(), m_vPressedKeys.end(), LOWERSYM) == m_vPressedKeys.end()) {
|
} else if (!down && std::find(m_vPressedKeys.begin(), m_vPressedKeys.end(), key) == m_vPressedKeys.end()) {
|
||||||
Debug::log(ERR, "Invalid key down event (stray release event?)");
|
Debug::log(ERR, "Invalid key down event (stray release event?)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (down)
|
if (down)
|
||||||
m_vPressedKeys.push_back(LOWERSYM);
|
m_vPressedKeys.push_back(key);
|
||||||
else
|
else
|
||||||
std::erase(m_vPressedKeys, LOWERSYM);
|
std::erase(m_vPressedKeys, key);
|
||||||
|
|
||||||
if (!down) // we dont care about up events
|
if (!down) // we dont care about up events
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue