=== modified file 'driver-csi.c' --- driver-csi.c 2012-04-24 14:25:17 +0000 +++ driver-csi.c 2012-04-12 16:02:45 +0000 @@ -288,7 +288,17 @@ key->modifiers = (key->code.mouse[0] & 0x1c) >> 2; key->code.mouse[0] &= ~0x1c; - termkey_key_set_linecol(key, arg[1], arg[2]); + key->code.mouse[3] = 0; + + if(arg[1] > 0xfff) + arg[1] = 0xfff; + key->code.mouse[1] = (arg[1] & 0x0ff); + key->code.mouse[3] |= (arg[1] & 0xf00) >> 8; + + if(arg[2] > 0x7ff) + arg[1] = 0x7ff; + key->code.mouse[2] = (arg[2] & 0x0ff); + key->code.mouse[3] |= (arg[2] & 0x300) >> 4; *nbytep = csi_len; return TERMKEY_RES_KEY; @@ -300,7 +310,17 @@ key->modifiers = (key->code.mouse[0] & 0x1c) >> 2; key->code.mouse[0] &= ~0x1c; - termkey_key_set_linecol(key, arg[1], arg[2]); + key->code.mouse[3] = 0; + + if(arg[1] > 0xfff) + arg[1] = 0xfff; + key->code.mouse[1] = (arg[1] & 0x0ff); + key->code.mouse[3] |= (arg[1] & 0xf00) >> 8; + + if(arg[2] > 0x7ff) + arg[1] = 0x7ff; + key->code.mouse[2] = (arg[2] & 0x0ff); + key->code.mouse[3] |= (arg[2] & 0x300) >> 4; if(cmd == 'm') // release key->code.mouse[3] |= 0x80; === modified file 'termkey-internal.h' --- termkey-internal.h 2012-04-24 14:25:17 +0000 +++ termkey-internal.h 2012-03-26 17:30:04 +0000 @@ -64,28 +64,6 @@ } method; }; -static inline void termkey_key_get_linecol(const TermKeyKey *key, int *line, int *col) -{ - if(col) - *col = (unsigned char)key->code.mouse[1] | ((unsigned char)key->code.mouse[3] & 0x0f) << 8; - - if(line) - *line = (unsigned char)key->code.mouse[2] | ((unsigned char)key->code.mouse[3] & 0x70) << 4; -} - -static inline void termkey_key_set_linecol(TermKeyKey *key, int line, int col) -{ - if(line > 0xfff) - line = 0xfff; - - if(col > 0x7ff) - col = 0x7ff; - - key->code.mouse[1] = (line & 0x0ff); - key->code.mouse[2] = (col & 0x0ff); - key->code.mouse[3] = (line & 0xf00) >> 8 | (col & 0x300) >> 4; -} - extern struct TermKeyDriver termkey_driver_csi; extern struct TermKeyDriver termkey_driver_ti; === modified file 'termkey.c' --- termkey.c 2012-04-24 14:25:17 +0000 +++ termkey.c 2012-04-12 16:02:45 +0000 @@ -911,7 +911,11 @@ if(button) *button = 0; - termkey_key_get_linecol(key, line, col); + if(col) + *col = (unsigned char)key->code.mouse[1] | ((unsigned char)key->code.mouse[3] & 0x0f) << 8; + + if(line) + *line = (unsigned char)key->code.mouse[2] | ((unsigned char)key->code.mouse[3] & 0x70) << 4; if(!event) return TERMKEY_RES_KEY;