aboutsummaryrefslogtreecommitdiff
path: root/tty-keys.c
diff options
context:
space:
mode:
Diffstat (limited to 'tty-keys.c')
-rw-r--r--tty-keys.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/tty-keys.c b/tty-keys.c
index 8538e74b..64dd91bb 100644
--- a/tty-keys.c
+++ b/tty-keys.c
@@ -1061,17 +1061,13 @@ tty_keys_mouse(struct tty *tty, const char *buf, size_t len, size_t *size,
log_debug("%s: mouse input: %.*s", c->name, (int)*size, buf);
/* Check and return the mouse input. */
- if (b < 32)
+ if (b < MOUSE_PARAM_BTN_OFF ||
+ x < MOUSE_PARAM_POS_OFF ||
+ y < MOUSE_PARAM_POS_OFF)
return (-1);
- b -= 32;
- if (x >= 33)
- x -= 33;
- else
- x = 256 - x;
- if (y >= 33)
- y -= 33;
- else
- y = 256 - y;
+ b -= MOUSE_PARAM_BTN_OFF;
+ x -= MOUSE_PARAM_POS_OFF;
+ y -= MOUSE_PARAM_POS_OFF;
} else if (buf[2] == '<') {
/* Read the three inputs. */
*size = 3;