X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2FCECClient.cpp;h=2e0045ced209f8f856406b990458d93840069d1d;hb=5ddf28c93a3786ce2910527ffb3bde97cc12ddf6;hp=9d814cd35868409222f1f0457b0441a941388434;hpb=ff11274bc7372ba2780a0ca366298d5808fe4115;p=deb_libcec.git diff --git a/src/lib/CECClient.cpp b/src/lib/CECClient.cpp index 9d814cd..2e0045c 100644 --- a/src/lib/CECClient.cpp +++ b/src/lib/CECClient.cpp @@ -937,12 +937,13 @@ void CCECClient::AddKey(bool bSendComboKey /* = false */) void CCECClient::AddKey(const cec_keypress &key) { - // send back the previous key if there is one - AddKey(); - if (key.keycode > CEC_USER_CONTROL_CODE_MAX && key.keycode < CEC_USER_CONTROL_CODE_SELECT) + { + // send back the previous key if there is one + AddKey(); return; + } cec_keypress transmitKey(key); @@ -964,10 +965,18 @@ void CCECClient::AddKey(const cec_keypress &key) AddKey(true); } - if (key.duration == 0) + if (m_iCurrentButton == key.keycode) { - m_iCurrentButton = transmitKey.keycode; - m_buttontime = m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN || key.duration > 0 ? 0 : GetTimeMs(); + m_buttontime = GetTimeMs(); + } + else + { + AddKey(); + if (key.duration == 0) + { + m_iCurrentButton = transmitKey.keycode; + m_buttontime = m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN || key.duration > 0 ? 0 : GetTimeMs(); + } } }