Compile regex outside of buffer function to avoid runtime hiccup
This commit is contained in:
parent
1079d0afe2
commit
cdaa98abe1
@ -206,14 +206,17 @@ namespace service {
|
||||
}
|
||||
|
||||
namespace service {
|
||||
|
||||
// process regex at compile time
|
||||
const regex gesture_begin(util::GESTURE_SWIPE_BEGIN_REGEX_PATTERN);
|
||||
const regex gesture_update(util::GESTURE_SWIPE_UPDATE_REGEX_PATTERN);
|
||||
const regex gesture_end(util::GESTURE_SWIPE_END_REGEX_PATTERN);
|
||||
|
||||
// parses output from libinput debug-events
|
||||
void buffer() {
|
||||
// check first if $user
|
||||
ios::sync_with_stdio(false);
|
||||
cin.tie(0); cout.tie(0);
|
||||
const regex gesture_begin(util::GESTURE_SWIPE_BEGIN_REGEX_PATTERN);
|
||||
const regex gesture_update(util::GESTURE_SWIPE_UPDATE_REGEX_PATTERN);
|
||||
const regex gesture_end(util::GESTURE_SWIPE_END_REGEX_PATTERN);
|
||||
string sentence;
|
||||
// read config file
|
||||
auto config = util::read_config_file(conf_filename().data());
|
||||
@ -252,7 +255,7 @@ namespace service {
|
||||
}
|
||||
// starts service
|
||||
void start() {
|
||||
int x = system("stdbuf -oL -e0 libinput debug-events | " PROGRAM " buffer");
|
||||
int x = system("stdbuf -oL -eL libinput debug-events | " PROGRAM " buffer");
|
||||
}
|
||||
// stops service
|
||||
void stop() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user