Simple utility to turn swipes into words -- "plugin" for wvkbd to enable swipe-typing under wayland SXMO.
-rw-r--r--swipeGuess.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/swipeGuess.c b/swipeGuess.c
index dad4548..41fb29c 100644
--- a/swipeGuess.c
+++ b/swipeGuess.c
@@ -1,6 +1,7 @@
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
+#include <ctype.h>
#define BUFSIZE 1024
char wordBuff[BUFSIZE];
@@ -20,15 +21,21 @@ char *fgetst(char *restrict s, int size, FILE *restrict stream) {
return r;
}
+bool charcmp(char a, char b) {
+ return tolower(a) == tolower(b);
+}
+
bool swipeCompare(char *swipe, char *word) {
- if (swipe[0] != word[0]) return false;
+ if (! charcmp(swipe[0], word[0])) {
+ return false;
+ }
char *swipeP = swipe;
char *wordP = word;
wordP++;
bool lastMatch = false;
for(swipeP++; swipeP[0]; swipeP++) {
lastMatch = false;
- while (swipeP[0] == wordP[0]) {
+ while (charcmp(swipeP[0], wordP[0])) {
wordP++;
lastMatch = true;
}