Skip to content

Commit e525ed4

Browse files
author
Robin Müller
committed
Added threshold values to configuration struct
1 parent 7584456 commit e525ed4

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/configuraion.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
#include <stddef.h>
2929
#include <stdbool.h>
30+
#include <stdint.h>
3031

3132
#include "int_array.h"
3233

@@ -36,6 +37,8 @@
3637
struct configuration {
3738
bool vert_scroll;
3839
bool horz_scroll;
40+
uint8_t vert_threshold_percentage;
41+
uint8_t horz_threshold_percentage;
3942
int_array_t swipe_keys[MAX_FINGERS][DIRECTIONS_COUNT];
4043
};
4144

src/gesture_detection.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ void process_events(int fd, configuration_t config) {
164164
mt_slots_t mt_slots;
165165

166166
point_t thresholds;
167-
thresholds.x = get_axix_threshold(fd, ABS_X, 20);
168-
thresholds.y = get_axix_threshold(fd, ABS_Y, 20);
167+
thresholds.x = get_axix_threshold(fd, ABS_X, config.horz_threshold_percentage);
168+
thresholds.y = get_axix_threshold(fd, ABS_Y, config.vert_threshold_percentage);
169169

170170
if (thresholds.x < 0 || thresholds.y < 0) {
171171
return;

src/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ int main(int argc, char *argv[]) {
5353
}
5454
configuration_t config;
5555
clean_config(&config);
56+
config.horz_threshold_percentage = 15;
57+
config.vert_threshold_percentage = 15;
5658
process_events(fd, config);
5759
close(fd);
5860
}

0 commit comments

Comments
 (0)