void CCECClient::AddKey(const cec_keypress &key)
{
+ // send back the previous key if there is one
+ AddKey();
+
{
CLockObject lock(m_mutex);
- m_iCurrentButton = key.duration > 0 ? CEC_USER_CONTROL_CODE_UNKNOWN : key.keycode;
+ m_iCurrentButton = key.duration > 0 || key.keycode > CEC_USER_CONTROL_CODE_MAX ?
+ CEC_USER_CONTROL_CODE_UNKNOWN :
+ key.keycode;
m_buttontime = key.duration > 0 ? 0 : GetTimeMs();
}
CCECClient *client = device->GetClient();
if (client)
- client->AddKey();
-
- if (command.parameters[0] <= CEC_USER_CONTROL_CODE_MAX)
client->SetCurrentButton((cec_user_control_code) command.parameters[0]);
if (command.parameters[0] == CEC_USER_CONTROL_CODE_POWER ||