From e330d751a42def1e014227d5e39969af6e87591f Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Mon, 13 Oct 2014 23:36:14 +0200 Subject: Make mode 1015 and 1006 work, prepare for 1005 --- termkey2-internal.h | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'termkey2-internal.h') diff --git a/termkey2-internal.h b/termkey2-internal.h index 3881865..5da33ff 100644 --- a/termkey2-internal.h +++ b/termkey2-internal.h @@ -86,26 +86,23 @@ static inline void termkey_key_get_linecol (const termkey_key_t *key, int *line, int *col) { if (col) - *col = ((unsigned char) key->code.mouse[1] - | ((unsigned char) key->code.mouse[3] & 0x0f) << 8) - 1; + *col = key->code.mouse.x; if (line) - *line = ((unsigned char) key->code.mouse[2] - | ((unsigned char) key->code.mouse[3] & 0x70) << 4) - 1; + *line = key->code.mouse.y; } static inline void termkey_key_set_linecol (termkey_key_t *key, int line, int col) { - if (++line > 0xfff) - line = 0xfff; + if (line > UINT16_MAX) + line = UINT16_MAX; - if (++col > 0x7ff) - col = 0x7ff; + if (col > UINT16_MAX) + col = UINT16_MAX; - key->code.mouse[1] = (line & 0x0ff); - key->code.mouse[2] = (col & 0x0ff); - key->code.mouse[3] = (line & 0xf00) >> 8 | (col & 0x300) >> 4; + key->code.mouse.x = col; + key->code.mouse.y = line; } extern termkey_driver_t termkey_driver_csi; -- cgit v1.2.3-70-g09d2