From 456093e4edf513d0f1509db048623f6e1b209112 Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Mon, 13 Oct 2014 01:03:13 +0200 Subject: Work on mouse support, it's a mess --- termkey2-internal.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'termkey2-internal.h') diff --git a/termkey2-internal.h b/termkey2-internal.h index b76ba79..3881865 100644 --- a/termkey2-internal.h +++ b/termkey2-internal.h @@ -86,21 +86,21 @@ static inline void termkey_key_get_linecol (const termkey_key_t *key, int *line, int *col) { if (col) - *col = (unsigned char) key->code.mouse[1] - | ((unsigned char) key->code.mouse[3] & 0x0f) << 8; + *col = ((unsigned char) key->code.mouse[1] + | ((unsigned char) key->code.mouse[3] & 0x0f) << 8) - 1; if (line) - *line = (unsigned char) key->code.mouse[2] - | ((unsigned char) key->code.mouse[3] & 0x70) << 4; + *line = ((unsigned char) key->code.mouse[2] + | ((unsigned char) key->code.mouse[3] & 0x70) << 4) - 1; } static inline void termkey_key_set_linecol (termkey_key_t *key, int line, int col) { - if (line > 0xfff) + if (++line > 0xfff) line = 0xfff; - if (col > 0x7ff) + if (++col > 0x7ff) col = 0x7ff; key->code.mouse[1] = (line & 0x0ff); -- cgit v1.2.3-70-g09d2