Fix ThresholdGesture
Style fixes, allow to compile, add copyright notice.
This commit is contained in:
parent
e570e7b91e
commit
41903992ef
|
@ -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,27 +24,27 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,3 +52,8 @@ bool ThresholdGesture::metThreshold() const
|
|||
{
|
||||
return _axis >= _config.threshold();
|
||||
}
|
||||
|
||||
bool ThresholdGesture::wheelCompatibility() const
|
||||
{
|
||||
return false;
|
||||
}
|
|
@ -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;
|
||||
};
|
||||
}}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user