Skip to content

Commit

Permalink
Pass through duration on all button repeats
Browse files Browse the repository at this point in the history
  • Loading branch information
popcornmix committed Nov 3, 2014
1 parent aa77d2c commit b5ef8ab
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/lib/CECClient.cpp
Expand Up @@ -976,10 +976,6 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */, bool bButtonRelease /*
cec_keypress key;
key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN;

// we ignore button releases when supporting repeating keys
if (bButtonRelease && m_configuration.iButtonRepeatRateMs && m_configuration.iButtonReleaseDelayMs)
return;

{
CLockObject lock(m_mutex);
if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN)
Expand All @@ -1005,6 +1001,10 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */, bool bButtonRelease /*
}
}

// we don't forward releases when supporting repeating keys
if (bButtonRelease && m_configuration.iButtonRepeatRateMs)
return;

if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN)
{
LIB_CEC->AddLog(CEC_LOG_DEBUG, "key released: %s (%1x) D:%dms", ToString(key.keycode), key.keycode, key.duration);
Expand Down Expand Up @@ -1097,7 +1097,7 @@ void CCECClient::AddKey(const cec_keypress &key)

if (!isrepeat && (key.keycode != comboKey || key.duration > 0))
{
LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x)", ToString(transmitKey.keycode), transmitKey.keycode);
LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x, %d)", ToString(transmitKey.keycode), transmitKey.keycode, transmitKey.duration);
CallbackAddKey(transmitKey);
}
}
Expand Down Expand Up @@ -1134,7 +1134,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void)
(m_iCurrentButton != comboKey && m_releaseButtontime && iNow >= (uint64_t)m_releaseButtontime)))
{
key.duration = (unsigned int) (iNow - m_initialButtontime);
key.keycode = m_iCurrentButton;
key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN;

m_iCurrentButton = CEC_USER_CONTROL_CODE_UNKNOWN;
m_initialButtontime = 0;
Expand All @@ -1147,7 +1147,7 @@ uint16_t CCECClient::CheckKeypressTimeout(void)
else if (m_iCurrentButton != CEC_USER_CONTROL_CODE_UNKNOWN &&
(m_iCurrentButton != comboKey && m_repeatButtontime && iNow >= (uint64_t)m_repeatButtontime))
{
key.duration = 0;
key.duration = (unsigned int) (iNow - m_initialButtontime);
key.keycode = m_iCurrentButton;
m_repeatButtontime = iNow + m_configuration.iButtonRepeatRateMs;
timeout = std::min((uint64_t)timeout, m_repeatButtontime - iNow);
Expand All @@ -1166,8 +1166,8 @@ uint16_t CCECClient::CheckKeypressTimeout(void)
timeout = CEC_PROCESSOR_SIGNAL_WAIT_TIME;
}
}
LIB_CEC->AddLog(CEC_LOG_DEBUG, "key %s: %s (%1x) timeout:%dms (rel:%d,rep:%d,prs:%d,rel:%d)", key.keycode == CEC_USER_CONTROL_CODE_UNKNOWN ? "idle" : key.duration ? "released" : "repeated",
ToString(m_iCurrentButton), m_iCurrentButton, timeout, (int)(m_releaseButtontime ? m_releaseButtontime - iNow : 0), (int)(m_repeatButtontime ? m_repeatButtontime - iNow : 0), m_pressedButtoncount, m_releasedButtoncount);
LIB_CEC->AddLog(CEC_LOG_DEBUG, "Key %s: %s (duration:%d) (%1x) timeout:%dms (rel:%d,rep:%d,prs:%d,rel:%d)", ToString(m_iCurrentButton), key.keycode == CEC_USER_CONTROL_CODE_UNKNOWN ? "idle" : m_repeatButtontime ? "repeated" : "released", key.duration,
m_iCurrentButton, timeout, (int)(m_releaseButtontime ? m_releaseButtontime - iNow : 0), (int)(m_repeatButtontime ? m_repeatButtontime - iNow : 0), m_pressedButtoncount, m_releasedButtoncount);
}

if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN)
Expand Down

0 comments on commit b5ef8ab

Please sign in to comment.