From ef4b18459ac97d73cc0949f1d6a1a93c703546f3 Mon Sep 17 00:00:00 2001 From: Maarten van Gompel Date: Thu, 27 Aug 2020 10:56:48 +0200 Subject: [PATCH] size of each edge is configurable Signed-off-by: Maarten van Gompel --- config.def.h | 6 ++++-- lisgd.c | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/config.def.h b/config.def.h index 3a3ca3e..5b25da8 100644 --- a/config.def.h +++ b/config.def.h @@ -15,8 +15,10 @@ unsigned int degreesleniency = 15; unsigned int timeoutms = 800; unsigned int orientation = 0; unsigned int verbose = 0; -double edgesizex = 50.0; -double edgesizey = 50.0; +double edgesizeleft = 50.0; +double edgesizetop = 50.0; +double edgesizeright = 50.0; +double edgesizebottom = 50.0; char *device = "/dev/input/event1"; Gesture gestures[] = { diff --git a/lisgd.c b/lisgd.c index 8be78cf..28e4af3 100644 --- a/lisgd.c +++ b/lisgd.c @@ -167,22 +167,22 @@ Edge gesturecalculateedge(double x0, double y0, double x1, double y1) { Edge horizontal = EdgeNone; Edge vertical = EdgeNone; - if (x0 <= edgesizex) { + if (x0 <= edgesizeleft) { horizontal = EdgeLeft; - } else if (x0 >= screenwidth - edgesizex) { + } else if (x0 >= screenwidth - edgesizeright) { horizontal = EdgeRight; - } else if (x1 <= edgesizex) { + } else if (x1 <= edgesizeleft) { horizontal = EdgeLeft; - } else if (x1 >= screenwidth - edgesizex) { + } else if (x1 >= screenwidth - edgesizeright) { horizontal = EdgeRight; } - if (y0 <= edgesizey) { + if (y0 <= edgesizetop) { vertical = EdgeTop; - } else if (y0 >= screenheight - edgesizey) { + } else if (y0 >= screenheight - edgesizebottom) { vertical = EdgeBottom; - } else if (y1 <= edgesizey) { + } else if (y1 <= edgesizetop) { vertical = EdgeTop; - } else if (y1 >= screenheight - edgesizey) { + } else if (y1 >= screenheight - edgesizebottom) { vertical = EdgeBottom; } if (horizontal == EdgeLeft && vertical == EdgeTop) { @@ -348,7 +348,7 @@ touchup(struct libinput_event *e) if (pendingswipe == swipe) nfpendingswipe++; resetslot(slot); - // All fingers up - check if within milisecond limit, exec, & reset + // All fingers up - check if within millisecond limit, exec, & reset if (nfdown == 0) { if ( timeoutms > @@ -482,7 +482,7 @@ main(int argc, char *argv[]) } } } else { - fprintf(stderr, "lisgd [-v] [-d /dev/input/0] [-o 0] [-t 200] [-r 20] [-m 400] [-g '1,LR,L,notify-send swiped left to right from left edge']\n"); + fprintf(stderr, "lisgd [-v] [-d /dev/input/0] [-o 0] [-t 200] [-r 20] [-m 400] [-g '1,LR,L,*,notify-send swiped left to right from left edge']\n"); exit(1); } }