// 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)
+ return;
+
cec_keypress transmitKey(key);
{
CLockObject lock(m_mutex);
- if (key.duration > 0 || key.keycode > CEC_USER_CONTROL_CODE_MAX)
- {
- transmitKey.keycode = CEC_USER_CONTROL_CODE_UNKNOWN;
- }
- else if (m_iCurrentButton == COMBO_KEY)
+ if (m_iCurrentButton == COMBO_KEY && key.duration == 0)
{
// stop + ok -> exit
if (key.keycode == CEC_USER_CONTROL_CODE_SELECT)
m_buttontime = m_iCurrentButton == CEC_USER_CONTROL_CODE_UNKNOWN || key.duration > 0 ? 0 : GetTimeMs();
}
- LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x)", ToString(transmitKey.keycode), transmitKey.keycode);
- CallbackAddKey(transmitKey);
+ if (key.keycode != COMBO_KEY || key.duration > 0)
+ {
+ LIB_CEC->AddLog(CEC_LOG_DEBUG, "key pressed: %s (%1x)", ToString(transmitKey.keycode), transmitKey.keycode);
+ CallbackAddKey(transmitKey);
+ }
}
void CCECClient::SetCurrentButton(const cec_user_control_code iButtonCode)
cec_keypress key;
key.duration = CEC_BUTTON_TIMEOUT;
- key.keycode = CEC_USER_CONTROL_CODE_UNKNOWN;
+ key.keycode = (cec_user_control_code)command.parameters[0];
- switch (command.parameters[0])
- {
- case CEC_USER_CONTROL_CODE_AN_RETURN:
- key.keycode = client && client->GetClientVersion() >= CEC_CLIENT_VERSION_1_5_0 ?
- CEC_USER_CONTROL_CODE_AN_RETURN :
- CEC_USER_CONTROL_CODE_EXIT;
- break;
- case CEC_USER_CONTROL_CODE_AN_CHANNELS_LIST:
- key.keycode = CEC_USER_CONTROL_CODE_AN_CHANNELS_LIST;
- break;
- default:
- break;
- }
-
- if (key.keycode != CEC_USER_CONTROL_CODE_UNKNOWN && client)
+ if (client)
client->AddKey(key);
return COMMAND_HANDLED;