aboutsummaryrefslogtreecommitdiff
path: root/termkey.c
diff options
context:
space:
mode:
authorPaul LeoNerd Evans <leonerd@leonerd.org.uk>2012-04-12 17:02:45 +0100
committerPaul LeoNerd Evans <leonerd@leonerd.org.uk>2012-04-12 17:02:45 +0100
commit8cf08582766e662b1dbc979b4f5b8dfb60ed4e90 (patch)
tree2eea3cb2ad5cb24f49c07087753c1b830a916593 /termkey.c
parent84378bcba829e080a143bba85a1c09e9b1a18b5e (diff)
downloadtermo-8cf08582766e662b1dbc979b4f5b8dfb60ed4e90.tar.gz
termo-8cf08582766e662b1dbc979b4f5b8dfb60ed4e90.tar.xz
termo-8cf08582766e662b1dbc979b4f5b8dfb60ed4e90.zip
Use spare bits in code.mouse[3] to store bigger mouse positions
Diffstat (limited to 'termkey.c')
-rw-r--r--termkey.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/termkey.c b/termkey.c
index 0f3a28d..6664151 100644
--- a/termkey.c
+++ b/termkey.c
@@ -912,10 +912,10 @@ TermKeyResult termkey_interpret_mouse(TermKey *tk, const TermKeyKey *key, TermKe
*button = 0;
if(col)
- *col = (unsigned char)key->code.mouse[1];
+ *col = (unsigned char)key->code.mouse[1] | ((unsigned char)key->code.mouse[3] & 0x0f) << 8;
if(line)
- *line = (unsigned char)key->code.mouse[2];
+ *line = (unsigned char)key->code.mouse[2] | ((unsigned char)key->code.mouse[3] & 0x70) << 4;
if(!event)
return TERMKEY_RES_KEY;
@@ -954,7 +954,7 @@ TermKeyResult termkey_interpret_mouse(TermKey *tk, const TermKeyKey *key, TermKe
if(button)
*button = btn;
- if(key->code.mouse[3])
+ if(key->code.mouse[3] & 0x80)
*event = TERMKEY_MOUSE_RELEASE;
return TERMKEY_RES_KEY;