Handle input mouse positions <33 (we already can generate them).

This commit is contained in:
Nicholas Marriott 2013-08-02 08:51:57 +01:00
parent 2dfd3fbd71
commit 7673732c0f

View File

@ -676,11 +676,17 @@ tty_keys_mouse(struct tty *tty, const char *buf, size_t len, size_t *size)
log_debug("mouse input: %.*s", (int) *size, buf); log_debug("mouse input: %.*s", (int) *size, buf);
/* Check and return the mouse input. */ /* Check and return the mouse input. */
if (b < 32 || x < 33 || y < 33) if (b < 32)
return (-1); return (-1);
b -= 32; b -= 32;
x -= 33; if (x >= 33)
y -= 33; x -= 33;
else
x = 256 - x;
if (y >= 33)
y -= 33;
else
y = 256 - y;
} else if (buf[2] == '<') { } else if (buf[2] == '<') {
/* Read the three inputs. */ /* Read the three inputs. */
*size = 3; *size = 3;