diff options
author | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2009-11-26 00:27:58 +0000 |
---|---|---|
committer | Paul LeoNerd Evans <leonerd@leonerd.org.uk> | 2009-11-26 00:27:58 +0000 |
commit | c4bc0486d40477d8c9203b8696b77774aafed985 (patch) | |
tree | 360e94853ceb202ec725a327b648c99d01daddcf /driver-ti.c | |
parent | bdc22b8b3d4cde7727a5d480c8457fc24182885d (diff) | |
download | termo-c4bc0486d40477d8c9203b8696b77774aafed985.tar.gz termo-c4bc0486d40477d8c9203b8696b77774aafed985.tar.xz termo-c4bc0486d40477d8c9203b8696b77774aafed985.zip |
Moved mouse parsing code out of driver-ti.c into core termkey.c
Diffstat (limited to 'driver-ti.c')
-rw-r--r-- | driver-ti.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/driver-ti.c b/driver-ti.c index 3d37e1a..ee9a454 100644 --- a/driver-ti.c +++ b/driver-ti.c @@ -311,16 +311,18 @@ static TermKeyResult peekkey(TermKey *tk, void *info, TermKeyKey *key, int force return TERMKEY_RES_KEY; } else if(p->type == TYPE_MOUSE) { - if(tk->buffcount - pos < 3) - return TERMKEY_RES_AGAIN; - - key->type = TERMKEY_TYPE_MOUSE; - key->code.mouse.buttons = CHARAT(pos+0) - 0x20; - key->code.mouse.col = CHARAT(pos+1) - 0x20; - key->code.mouse.line = CHARAT(pos+2) - 0x20; - key->modifiers = 0; - *nbytep = pos+3; - return TERMKEY_RES_KEY; + tk->buffstart += pos; + tk->buffcount -= pos; + + TermKeyResult mouse_result = (*tk->method.peekkey_mouse)(tk, key, nbytep); + + tk->buffstart -= pos; + tk->buffcount += pos; + + if(mouse_result == TERMKEY_RES_KEY) + *nbytep += pos; + + return mouse_result; } } |