summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm>2013-10-10 11:49:42 +0000
committernicm <nicm>2013-10-10 11:49:42 +0000
commit2756d127507cb939582adf2bbaf7be4cf5b711cd (patch)
treefa9499d446bccd85ab448ce87ca8a667e3f8183b
parent7839993fe734aec38355401ce5a02d85f9dab5ba (diff)
Handle input mouse positions <33 (we already can generate them).
-rw-r--r--tty-keys.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/tty-keys.c b/tty-keys.c
index 26edbf32..3b652db8 100644
--- a/tty-keys.c
+++ b/tty-keys.c
@@ -676,11 +676,17 @@ tty_keys_mouse(struct tty *tty, const char *buf, size_t len, size_t *size)
log_debug("mouse input: %.*s", (int) *size, buf);
/* Check and return the mouse input. */
- if (b < 32 || x < 33 || y < 33)
+ if (b < 32)
return (-1);
b -= 32;
- x -= 33;
- y -= 33;
+ if (x >= 33)
+ x -= 33;
+ else
+ x = 256 - x;
+ if (y >= 33)
+ y -= 33;
+ else
+ y = 256 - y;
} else if (buf[2] == '<') {
/* Read the three inputs. */
*size = 3;