From a1b1480c21a3ca7c35fd5ab99c966322f64b2f3b Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Mon, 10 Apr 2023 00:56:01 +0100 Subject: [PATCH] keybinds: avoid sending release on suppressed press --- src/managers/KeybindManager.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 0f99f2e4..fde9bc4a 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -352,8 +352,7 @@ bool CKeybindManager::handleKeybinds(const uint32_t& modmask, const std::string& } for (auto& k : m_lKeybinds) { - if (modmask != k.modmask || (g_pCompositor->m_sSeat.exclusiveClient && !k.locked) || k.submap != m_szCurrentSelectedSubmap || - (!pressed && !k.release && k.handler != "pass" && k.handler != "mouse" && k.handler != "global") || k.shadowed) + if (modmask != k.modmask || (g_pCompositor->m_sSeat.exclusiveClient && !k.locked) || k.submap != m_szCurrentSelectedSubmap || k.shadowed) continue; if (!key.empty()) { @@ -382,6 +381,11 @@ bool CKeybindManager::handleKeybinds(const uint32_t& modmask, const std::string& return true; } + if (!pressed && !k.release && k.handler != "pass" && k.handler != "mouse" && k.handler != "global") { + found = true; // avoid sending a release event + continue; + } + const auto DISPATCHER = m_mDispatchers.find(k.mouse ? "mouse" : k.handler); // Should never happen, as we check in the ConfigManager, but oh well @@ -1927,7 +1931,7 @@ void CKeybindManager::toggleOpaque(std::string unused) { if (!PWINDOW) return; - PWINDOW->m_sAdditionalConfigData.forceOpaque = !PWINDOW->m_sAdditionalConfigData.forceOpaque; + PWINDOW->m_sAdditionalConfigData.forceOpaque = !PWINDOW->m_sAdditionalConfigData.forceOpaque; PWINDOW->m_sAdditionalConfigData.forceOpaqueOverridden = true; g_pHyprRenderer->damageWindow(PWINDOW);