From 3b4b90dac0548b9cb1b597667903736831f36fee Mon Sep 17 00:00:00 2001 From: pixl Date: Sat, 5 Sep 2020 18:12:56 -0400 Subject: [PATCH] Support NoPress gesture mode on none direction Fix #122, makes logid.example.cfg accurate. --- src/logid/actions/GestureAction.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/logid/actions/GestureAction.cpp b/src/logid/actions/GestureAction.cpp index a9b80f4..f364a32 100644 --- a/src/logid/actions/GestureAction.cpp +++ b/src/logid/actions/GestureAction.cpp @@ -227,6 +227,28 @@ GestureAction::Config::Config(Device* device, libconfig::Setting &root) : } if(d == None) { + try { + auto& mode = gestures[i].lookup("mode"); + if(mode.getType() == libconfig::Setting::TypeString) { + std::string mode_str = mode; + std::transform(mode_str.begin(), mode_str.end(), + mode_str.begin(), ::tolower); + if(mode_str == "nopress") // No action + continue; + else if(mode_str != "onrelease") + logPrintf(WARN, "Line %d: Only NoPress and " + "OnRelease are supported for the " + "None direction, defaulting to " + "OnRelease.", mode.getSourceLine()); + } else { + logPrintf(WARN, "Line %d: mode must be a string, " + "defaulting to OnRelease", + mode.getSourceLine()); + } + } catch(libconfig::SettingNotFoundException& e) { + // Default to OnRelease + } + try { _none_action = Action::makeAction(_device, gestures[i].lookup("action"));