diff --git a/cpp/gesture/swipe_gesture.cpp b/cpp/gesture/swipe_gesture.cpp index 7dcea37..9056911 100644 --- a/cpp/gesture/swipe_gesture.cpp +++ b/cpp/gesture/swipe_gesture.cpp @@ -22,6 +22,7 @@ along with this program. If not, see . #include // std::cout, std::endl #include // std::stoi, std::stof #include // std::regex, std::regex_match, std::cmatch +#include #include "swipe_gesture.h" extern "C" @@ -50,7 +51,8 @@ namespace comfortable_swipe::gesture ): comfortable_swipe::gesture::xdo_gesture(), threshold_squared(threshold*threshold), - commands(new const char*[8]{left3, left4, right3, right4, up3, up4, down3, down4}) + commands(new const char*[8]{left3, left4, right3, right4, up3, up4, down3, down4}), + flag_swiping(false) { // improve responsiveness of first gesture by pre-empting xdotool runtime xdo_get_mouse_location(this->xdo, &this->ix, &this->iy, &this->screen_num); @@ -139,8 +141,6 @@ namespace comfortable_swipe::gesture */ bool swipe_gesture::parse_line(const char * line) { - - // prepare regex matchers (will only load at most once) static const std::regex gesture_swipe_begin(swipe_gesture::GESTURE_BEGIN_REGEX_PATTERN); static const std::regex gesture_swipe_update(swipe_gesture::GESTURE_UPDATE_REGEX_PATTERN); static const std::regex gesture_swipe_end(swipe_gesture::GESTURE_END_REGEX_PATTERN); diff --git a/cpp/service/start.cpp b/cpp/service/start.cpp index b0b1cbd..c7e0e50 100644 --- a/cpp/service/start.cpp +++ b/cpp/service/start.cpp @@ -20,6 +20,7 @@ along with this program. If not, see . */ #include "_index.hpp" +#include // std::cin, std::cout, std::ios #include // std::system #include // pipe, fork, perror, exit @@ -32,6 +33,11 @@ namespace comfortable_swipe::service */ void start() { + std::ios::sync_with_stdio(false); + std::cin.tie(0); + std::cout.tie(0); + std::cout.flush(); + // redirect stdout to stdin int fd[2]; pipe(fd); // create the pipes