Browse Source

* src/io.c:

+ Fixed an off-by-one error in the mouse driver.
tags/v0.99.beta14
Sam Hocevar sam 21 years ago
parent
commit
ee33cd6156
1 changed files with 7 additions and 2 deletions
  1. +7
    -2
      src/io.c

+ 7
- 2
src/io.c View File

@@ -75,6 +75,7 @@ int caca_get_event(void)


if(key[1] == 'O') if(key[1] == 'O')
{ {
/* ^[OP ^[OQ ^[OR ^[OS */
switch(key[2]) switch(key[2])
{ {
case 'P': return CACA_EVENT_KEY_PRESS | CACA_KEY_F1; case 'P': return CACA_EVENT_KEY_PRESS | CACA_KEY_F1;
@@ -85,6 +86,7 @@ int caca_get_event(void)
} }
else if(key[1] == '[') else if(key[1] == '[')
{ {
/* ^[[A ^[[B ^[[C ^[[D */
switch(key[2]) switch(key[2])
{ {
case 'A': return CACA_EVENT_KEY_PRESS | CACA_KEY_UP; case 'A': return CACA_EVENT_KEY_PRESS | CACA_KEY_UP;
@@ -96,6 +98,7 @@ int caca_get_event(void)
key[3] = _read_key(); key[3] = _read_key();
key[4] = _read_key(); key[4] = _read_key();


/* ^[[Mxxx */
if(key[2] == 'M') if(key[2] == 'M')
{ {
int event = CACA_EVENT_MOUSE_CLICK; int event = CACA_EVENT_MOUSE_CLICK;
@@ -103,12 +106,13 @@ int caca_get_event(void)
key[5] = _read_key(); key[5] = _read_key();


event |= (int)(key[3] - ' ') << 16; 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; return event;
} }


/* ^[[15~ ^[[17~ ^[[18~ ^[[19~ */
if(key[2] == '1' && key[4] == '~') if(key[2] == '1' && key[4] == '~')
switch(key[3]) switch(key[3])
{ {
@@ -118,6 +122,7 @@ int caca_get_event(void)
case '9': return CACA_EVENT_KEY_PRESS | CACA_KEY_F8; case '9': return CACA_EVENT_KEY_PRESS | CACA_KEY_F8;
} }


/* ^[[20~ ^[[21~ ^[[23~ ^[[24~ */
if(key[2] == '2' && key[4] == '~') if(key[2] == '2' && key[4] == '~')
switch(key[3]) switch(key[3])
{ {


Loading…
Cancel
Save