Bläddra i källkod

* src/io.c:

+ Fixed an off-by-one error in the mouse driver.
tags/v0.99.beta14
Sam Hocevar sam 21 år sedan
förälder
incheckning
ee33cd6156
1 ändrade filer med 7 tillägg och 2 borttagningar
  1. +7
    -2
      src/io.c

+ 7
- 2
src/io.c Visa fil

@@ -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])
{


Laddar…
Avbryt
Spara