From: Lars Op den Kamp Date: Fri, 14 Oct 2011 14:17:08 +0000 (+0200) Subject: cec: send a keypress with 0 duration when a key is pressed and with a duration set... X-Git-Tag: upstream/2.2.0~1^2~226 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=6710d300ded40bf47eef036513b757bf3b8651a7;p=deb_libcec.git cec: send a keypress with 0 duration when a key is pressed and with a duration set when it's released --- diff --git a/src/lib/LibCEC.cpp b/src/lib/LibCEC.cpp index a1f2650..7c0f792 100644 --- a/src/lib/LibCEC.cpp +++ b/src/lib/LibCEC.cpp @@ -251,6 +251,13 @@ void CLibCEC::SetCurrentButton(cec_user_control_code iButtonCode) { m_iCurrentButton = iButtonCode; m_buttontime = GetTimeMs(); + + /* push keypress to the keybuffer with 0 duration. + push another press to the keybuffer with the duration set when the button is released */ + cec_keypress key; + key.duration = 0; + key.keycode = m_iCurrentButton; + m_keyBuffer.Push(key); } void * CECCreate(const char *strDeviceName, CEC::cec_logical_address iLogicalAddress /*= CEC::CECDEVICE_PLAYBACKDEVICE1 */, uint16_t iPhysicalAddress /* = CEC_DEFAULT_PHYSICAL_ADDRESS */)