aboutsummaryrefslogtreecommitdiffstats
path: root/test-visual.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2022-07-28 20:31:28 +0200
committerMattias Andrée <maandree@kth.se>2022-07-28 20:37:42 +0200
commit402bf1269c59db4b3a78077ab095a84181181808 (patch)
treeb9f445318d9f1e09a5af77ac39b23dc8e50c7a52 /test-visual.c
parentMinor code improvement (diff)
downloadlibgamepad-402bf1269c59db4b3a78077ab095a84181181808.tar.gz
libgamepad-402bf1269c59db4b3a78077ab095a84181181808.tar.bz2
libgamepad-402bf1269c59db4b3a78077ab095a84181181808.tar.xz
Remove dependency on libevdev (mostly complete) + minor fixes
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'test-visual.c')
-rw-r--r--test-visual.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/test-visual.c b/test-visual.c
index 9743006..bd3a610 100644
--- a/test-visual.c
+++ b/test-visual.c
@@ -39,7 +39,7 @@ draw_axis(char buffer[], const struct abs_axis *axis, size_t len)
x = (size_t)(axis->value - axis->min) * len;
x += (size_t)(axis->max - axis->min) / 2;
x /= (size_t)(axis->max - axis->min);
- memmove(&buffer[x + sizeof("\033[m") - 1], &buffer[x], len - x);
+ memmove(&buffer[x + sizeof("\033[m") - 1], &buffer[x], len + 1 - x);
memcpy(&buffer[x], "\033[m", sizeof("\033[m") - 1);
return buffer;
}
@@ -63,7 +63,7 @@ main(int argc, char *argv[])
ssize_t saxis_len;
size_t axis_len, req_axis_len;
size_t max_max_len = 0, max_min_len = 0;
- int r;
+ ssize_t r;
if (argc != 2) {
fprintf(stderr, "Please provide the path to the subdevice as the only command line argument\n");
@@ -152,7 +152,7 @@ main(int argc, char *argv[])
for (;;) {
/* TODO use nonblocking; listen for window resize */
- r = libgamepad_next_event(&gamepad, &event);
+ r = libgamepad_next_event(&gamepad, &event, 1);
if (r <= 0) {
if (!r || errno == EINTR)
continue;