From 5ddf28c93a3786ce2910527ffb3bde97cc12ddf6 Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Tue, 4 Dec 2012 00:48:22 +0100 Subject: [PATCH] press & hold --- src/lib/CECClient.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) 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(); + } } } -- 2.34.1