diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 09:25:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 09:25:13 +0000 |
commit | e353c8eff2bef4b84c539d4c03dc7c0a5adf9f9b (patch) | |
tree | 7ac20f83cf66e65d9e27e7be128f2142324466d7 /xbmc/input/joysticks/generic/ButtonMapping.cpp | |
parent | Adding upstream version 2:20.4+dfsg. (diff) | |
download | kodi-e353c8eff2bef4b84c539d4c03dc7c0a5adf9f9b.tar.xz kodi-e353c8eff2bef4b84c539d4c03dc7c0a5adf9f9b.zip |
Adding upstream version 2:20.5+dfsg.upstream/2%20.5+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xbmc/input/joysticks/generic/ButtonMapping.cpp')
-rw-r--r-- | xbmc/input/joysticks/generic/ButtonMapping.cpp | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/xbmc/input/joysticks/generic/ButtonMapping.cpp b/xbmc/input/joysticks/generic/ButtonMapping.cpp index 665a233..af6bf86 100644 --- a/xbmc/input/joysticks/generic/ButtonMapping.cpp +++ b/xbmc/input/joysticks/generic/ButtonMapping.cpp @@ -454,34 +454,31 @@ bool CButtonMapping::MapPrimitive(const CDriverPrimitive& primitive) { bool bHandled = false; - if (m_buttonMap->IsIgnored(primitive)) + auto now = std::chrono::steady_clock::now(); + + bool bTimeoutElapsed = true; + + if (m_buttonMapper->NeedsCooldown()) + bTimeoutElapsed = (now >= m_lastAction + std::chrono::milliseconds(MAPPING_COOLDOWN_MS)); + + if (bTimeoutElapsed) + { + bHandled = m_buttonMapper->MapPrimitive(m_buttonMap, m_keymap, primitive); + + if (bHandled) + m_lastAction = std::chrono::steady_clock::now(); + } + else if (m_buttonMap->IsIgnored(primitive)) { bHandled = true; } else { - auto now = std::chrono::steady_clock::now(); - - bool bTimeoutElapsed = true; - - if (m_buttonMapper->NeedsCooldown()) - bTimeoutElapsed = (now >= m_lastAction + std::chrono::milliseconds(MAPPING_COOLDOWN_MS)); + auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(now - m_lastAction); - if (bTimeoutElapsed) - { - bHandled = m_buttonMapper->MapPrimitive(m_buttonMap, m_keymap, primitive); - - if (bHandled) - m_lastAction = std::chrono::steady_clock::now(); - } - else - { - auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(now - m_lastAction); - - CLog::Log(LOGDEBUG, "Button mapping: rapid input after {}ms dropped for profile \"{}\"", - duration.count(), m_buttonMapper->ControllerID()); - bHandled = true; - } + CLog::Log(LOGDEBUG, "Button mapping: rapid input after {}ms dropped for profile \"{}\"", + duration.count(), m_buttonMapper->ControllerID()); + bHandled = true; } return bHandled; |