aboutsummaryrefslogtreecommitdiff
path: root/termkey2-internal.h
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2014-10-13 01:03:13 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2014-10-13 01:03:13 +0200
commit456093e4edf513d0f1509db048623f6e1b209112 (patch)
tree132a69e315e754c0bf2b82bf6039247107702b62 /termkey2-internal.h
parent5692f32bcfa049fc2b5555b5a883045b217349b9 (diff)
downloadtermo-456093e4edf513d0f1509db048623f6e1b209112.tar.gz
termo-456093e4edf513d0f1509db048623f6e1b209112.tar.xz
termo-456093e4edf513d0f1509db048623f6e1b209112.zip
Work on mouse support, it's a mess
Diffstat (limited to 'termkey2-internal.h')
-rw-r--r--termkey2-internal.h12
1 files changed, 6 insertions, 6 deletions
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);