From ee33cd61567d78043e69fb9a7583188acdf18da5 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Fri, 21 Nov 2003 14:14:26 +0000 Subject: [PATCH] * src/io.c: + Fixed an off-by-one error in the mouse driver. --- src/io.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/io.c b/src/io.c index 135a2aa..bb10f5b 100644 --- a/src/io.c +++ b/src/io.c @@ -75,6 +75,7 @@ int caca_get_event(void) if(key[1] == 'O') { + /* ^[OP ^[OQ ^[OR ^[OS */ switch(key[2]) { case 'P': return CACA_EVENT_KEY_PRESS | CACA_KEY_F1; @@ -85,6 +86,7 @@ int caca_get_event(void) } else if(key[1] == '[') { + /* ^[[A ^[[B ^[[C ^[[D */ switch(key[2]) { case 'A': return CACA_EVENT_KEY_PRESS | CACA_KEY_UP; @@ -96,6 +98,7 @@ int caca_get_event(void) key[3] = _read_key(); key[4] = _read_key(); + /* ^[[Mxxx */ if(key[2] == 'M') { int event = CACA_EVENT_MOUSE_CLICK; @@ -103,12 +106,13 @@ int caca_get_event(void) key[5] = _read_key(); event |= (int)(key[3] - ' ') << 16; - event |= (int)(key[4] - ' ') << 8; - event |= (int)(key[5] - ' ') << 0; + event |= (int)(key[4] - '!') << 8; + event |= (int)(key[5] - '!') << 0; return event; } + /* ^[[15~ ^[[17~ ^[[18~ ^[[19~ */ if(key[2] == '1' && key[4] == '~') switch(key[3]) { @@ -118,6 +122,7 @@ int caca_get_event(void) case '9': return CACA_EVENT_KEY_PRESS | CACA_KEY_F8; } + /* ^[[20~ ^[[21~ ^[[23~ ^[[24~ */ if(key[2] == '2' && key[4] == '~') switch(key[3]) {