From: Lars Op den Kamp Date: Fri, 21 Sep 2012 10:45:33 +0000 (+0200) Subject: moved code that handles the previous keypress X-Git-Tag: upstream/2.2.0~1^2~17^2~9 X-Git-Url: https://git.piment-noir.org/?p=deb_libcec.git;a=commitdiff_plain;h=21fa005bec345a6b80229c1218e04fb59a17ccdb moved code that handles the previous keypress --- diff --git a/src/lib/CECClient.cpp b/src/lib/CECClient.cpp index c9525af..0bbc081 100644 --- a/src/lib/CECClient.cpp +++ b/src/lib/CECClient.cpp @@ -972,9 +972,14 @@ void CCECClient::AddKey(void) 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(); } diff --git a/src/lib/implementations/CECCommandHandler.cpp b/src/lib/implementations/CECCommandHandler.cpp index f20f6af..d23340f 100644 --- a/src/lib/implementations/CECCommandHandler.cpp +++ b/src/lib/implementations/CECCommandHandler.cpp @@ -673,9 +673,6 @@ int CCECCommandHandler::HandleUserControlPressed(const cec_command &command) 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 ||