From: Lars Op den Kamp Date: Mon, 3 Dec 2012 23:48:22 +0000 (+0100) Subject: press & hold X-Git-Tag: upstream/2.2.0~1^2~9^2~1^2~7 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=5ddf28c93a3786ce2910527ffb3bde97cc12ddf6;p=deb_libcec.git press & hold --- 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(); + } } }