Support NoPress gesture mode on none direction

Fix #122, makes logid.example.cfg accurate.
This commit is contained in:
pixl 2020-09-05 18:12:56 -04:00
parent 4cfc2515d5
commit 3b4b90dac0
No known key found for this signature in database
GPG Key ID: 1866C148CD593B6E

View File

@ -227,6 +227,28 @@ GestureAction::Config::Config(Device* device, libconfig::Setting &root) :
} }
if(d == None) { 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 { try {
_none_action = Action::makeAction(_device, _none_action = Action::makeAction(_device,
gestures[i].lookup("action")); gestures[i].lookup("action"));