diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2014-10-13 23:36:14 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2014-10-13 23:39:15 +0200 |
commit | e330d751a42def1e014227d5e39969af6e87591f (patch) | |
tree | aab18e54d2a99f48bbc1a9492af17357a0d17497 /termkey2-internal.h | |
parent | 456093e4edf513d0f1509db048623f6e1b209112 (diff) | |
download | termo-e330d751a42def1e014227d5e39969af6e87591f.tar.gz termo-e330d751a42def1e014227d5e39969af6e87591f.tar.xz termo-e330d751a42def1e014227d5e39969af6e87591f.zip |
Make mode 1015 and 1006 work, prepare for 1005
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; |