Browse Source

Merge pull request #495 from plexinc/long-cecfix

Have CEC use keydown as default and updown as option
Lionel CHAZALLON 8 years ago
parent
commit
01c49c1a1b
2 changed files with 16 additions and 2 deletions
  1. 4 0
      resources/settings/settings_description.json
  2. 12 2
      src/input/InputCEC.cpp

+ 4 - 0
resources/settings/settings_description.json

@@ -392,6 +392,10 @@
       {
         "value": "activatesource",
         "default": true
+      },
+      {
+        "value": "usekeyupdown",
+        "default": false
       }
     ]
   },

+ 12 - 2
src/input/InputCEC.cpp

@@ -258,6 +258,7 @@ QString InputCECWorker::getCommandParamsList(cec_command command)
 int InputCECWorker::CecCommand(void *cbParam, const cec_command command)
 {
   QString cmdString, keyCode;
+  bool useUpDown = SettingsComponent::Get().value(SETTINGS_SECTION_CEC, "usekeyupdown").toBool();
   auto cec = static_cast<InputCECWorker*>(cbParam);
   Q_ASSERT(cec);
 
@@ -322,7 +323,11 @@ int InputCECWorker::CecCommand(void *cbParam, const cec_command command)
         {
           // samsung Return key
           case CEC_USER_CONTROL_CODE_AN_RETURN:
-            cec->sendReceivedInput(CEC_INPUT_NAME, INPUT_KEY_BACK, down ? InputBase::KeyDown : InputBase::KeyUp);
+            if (useUpDown)
+              cec->sendReceivedInput(CEC_INPUT_NAME, INPUT_KEY_BACK, down ? InputBase::KeyDown : InputBase::KeyUp);
+            else if (down)
+              cec->sendReceivedInput(CEC_INPUT_NAME, INPUT_KEY_BACK, InputBase::KeyPressed);
+
             return 1;
             break;
 
@@ -334,7 +339,12 @@ int InputCECWorker::CecCommand(void *cbParam, const cec_command command)
       cmdString = cec->getCommandString((cec_user_control_code)command.parameters[0]);
 
       if (!cmdString.isEmpty())
-        cec->sendReceivedInput(CEC_INPUT_NAME, cmdString, down ? InputBase::KeyDown : InputBase::KeyUp);
+      {
+        if (useUpDown)
+          cec->sendReceivedInput(CEC_INPUT_NAME, cmdString, down ? InputBase::KeyDown : InputBase::KeyUp);
+        else if (down)
+          cec->sendReceivedInput(CEC_INPUT_NAME, cmdString, InputBase::KeyPressed);
+      }
     }
       break;