From 41903992ef381eee90619c30964433163d368551 Mon Sep 17 00:00:00 2001 From: pixl Date: Fri, 21 Aug 2020 16:57:40 -0400 Subject: [PATCH] Fix ThresholdGesture Style fixes, allow to compile, add copyright notice. --- .../actions/gesture/ThresholdGesture.cpp | 19 ++++++++++++------- src/logid/actions/gesture/ThresholdGesture.h | 8 +++++--- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/logid/actions/gesture/ThresholdGesture.cpp b/src/logid/actions/gesture/ThresholdGesture.cpp index f5843e1..5e1ebd9 100644 --- a/src/logid/actions/gesture/ThresholdGesture.cpp +++ b/src/logid/actions/gesture/ThresholdGesture.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2019-2020 PixlOne + * Copyright 2019-2020 PixlOne, michtere * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,31 +24,36 @@ ThresholdGesture::ThresholdGesture(Device *device, libconfig::Setting &root) : { } -void ThresholdGesture::press() +void ThresholdGesture::press(bool init_threshold) { - _axis = 0; - this->executed = false; + _axis = init_threshold ? _config.threshold() : 0; + this->_executed = false; } void ThresholdGesture::release(bool primary) { (void)primary; // Suppress unused warning - this->executed = false; + this->_executed = false; } void ThresholdGesture::move(int16_t axis) { _axis += axis; - if(!this->executed && metThreshold()) { + if(!this->_executed && metThreshold()) { _config.action()->press(); _config.action()->release(); - this->executed = true; + this->_executed = true; } } bool ThresholdGesture::metThreshold() const { return _axis >= _config.threshold(); +} + +bool ThresholdGesture::wheelCompatibility() const +{ + return false; } \ No newline at end of file diff --git a/src/logid/actions/gesture/ThresholdGesture.h b/src/logid/actions/gesture/ThresholdGesture.h index 6d0cf69..0a38b96 100644 --- a/src/logid/actions/gesture/ThresholdGesture.h +++ b/src/logid/actions/gesture/ThresholdGesture.h @@ -1,5 +1,5 @@ /* - * Copyright 2019-2020 PixlOne + * Copyright 2019-2020 PixlOne, michtere * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,18 +28,20 @@ namespace actions public: ThresholdGesture(Device* device, libconfig::Setting& root); - virtual void press(); + virtual void press(bool init_threshold=false); virtual void release(bool primary=false); virtual void move(int16_t axis); virtual bool metThreshold() const; + virtual bool wheelCompatibility() const; + protected: int16_t _axis; Gesture::Config _config; private: - bool executed = false; + bool _executed = false; }; }}