diff options
Diffstat (limited to 'termkey2-internal.h')
-rw-r--r-- | termkey2-internal.h | 19 |
1 files changed, 8 insertions, 11 deletions
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; |