Bootstrap pinch gesture
This commit is contained in:
parent
0fdf94b723
commit
a47c7f8115
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1,5 @@
|
|||||||
# C++ generated headers
|
# C++ generated headers
|
||||||
*.gch
|
*.gch
|
||||||
|
|
||||||
|
# IDE-specific
|
||||||
|
.vscode
|
||||||
|
|||||||
@ -28,6 +28,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include "gesture/xdo_gesture.cpp"
|
#include "gesture/xdo_gesture.cpp"
|
||||||
#include "gesture/swipe_gesture.cpp"
|
#include "gesture/swipe_gesture.cpp"
|
||||||
#include "gesture/swipe_gesture.regex.cpp"
|
#include "gesture/swipe_gesture.regex.cpp"
|
||||||
|
#include "gesture/pinch_gesture.cpp"
|
||||||
|
#include "gesture/pinch_gesture.regex.cpp"
|
||||||
#include "service/autostart.cpp"
|
#include "service/autostart.cpp"
|
||||||
#include "service/buffer.cpp"
|
#include "service/buffer.cpp"
|
||||||
#include "service/debug.cpp"
|
#include "service/debug.cpp"
|
||||||
|
|||||||
@ -80,11 +80,21 @@ namespace comfortable_swipe::gesture
|
|||||||
const float EPSILON = this->threshold;
|
const float EPSILON = this->threshold;
|
||||||
if (delta_radius > EPSILON)
|
if (delta_radius > EPSILON)
|
||||||
{
|
{
|
||||||
// TODO: pinch out
|
if (this->previous_gesture != 0)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
std::cout << "PINCH OUT" << std::endl;
|
||||||
|
this->previous_gesture = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (delta_radius < -EPSILON)
|
else if (delta_radius < -EPSILON)
|
||||||
{
|
{
|
||||||
// TODO: pinch in
|
if (this->previous_gesture != 1)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
std::cout << "PINCH IN" << std::endl;
|
||||||
|
this->previous_gesture = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,8 @@ You should have received a copy of the GNU General Public License
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "pinch_gesture.h"
|
||||||
|
|
||||||
namespace comfortable_swipe::gesture
|
namespace comfortable_swipe::gesture
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -19,6 +19,8 @@ You should have received a copy of the GNU General Public License
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "swipe_gesture.h"
|
||||||
|
|
||||||
namespace comfortable_swipe::gesture
|
namespace comfortable_swipe::gesture
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -36,6 +36,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
*/
|
*/
|
||||||
#include "gesture/xdo_gesture.h"
|
#include "gesture/xdo_gesture.h"
|
||||||
#include "gesture/swipe_gesture.h"
|
#include "gesture/swipe_gesture.h"
|
||||||
|
#include "gesture/pinch_gesture.h"
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
namespace comfortable_swipe
|
namespace comfortable_swipe
|
||||||
|
|||||||
@ -46,15 +46,23 @@ namespace comfortable_swipe::service
|
|||||||
config["down4"].c_str()
|
config["down4"].c_str()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
comfortable_swipe::gesture::pinch_gesture pinch_gesture_handler
|
||||||
|
(
|
||||||
|
config.count("threshold") ? std::stof(config["threshold"]) : 0.0,
|
||||||
|
config["pinch_in3"].c_str(),
|
||||||
|
config["pinch_in4"].c_str(),
|
||||||
|
config["pinch_out3"].c_str(),
|
||||||
|
config["pinch_out4"].c_str()
|
||||||
|
);
|
||||||
|
|
||||||
// prepare data containers
|
// prepare data containers
|
||||||
static const int MAX_LINE_LENGTH = 256;
|
std::array<char, 256> line;
|
||||||
static char data[MAX_LINE_LENGTH];
|
|
||||||
|
|
||||||
// start reading lines from input one by one
|
// start reading lines from input one by one
|
||||||
while (fgets_unlocked(data, MAX_LINE_LENGTH, stdin) != NULL)
|
while (fgets_unlocked(line.data(), line.size(), stdin) != NULL)
|
||||||
{
|
{
|
||||||
// attempt to parse swipe gestures
|
swipe_gesture_handler.parse_line(line.data()) ||
|
||||||
swipe_gesture_handler.parse_line(data);
|
pinch_gesture_handler.parse_line(line.data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user