=== modified file 'driver-csi.c' --- driver-csi.c 2012-04-12 16:02:45 +0000 +++ driver-csi.c 2012-04-11 23:19:10 +0000 @@ -288,17 +288,15 @@ key->modifiers = (key->code.mouse[0] & 0x1c) >> 2; key->code.mouse[0] &= ~0x1c; - 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(arg[1] > 0xff) + key->code.mouse[1] = 0xff; + else + key->code.mouse[1] = arg[1]; + + if(arg[2] > 0xff) + key->code.mouse[2] = 0xff; + else + key->code.mouse[2] = arg[2]; *nbytep = csi_len; return TERMKEY_RES_KEY; @@ -310,20 +308,17 @@ key->modifiers = (key->code.mouse[0] & 0x1c) >> 2; key->code.mouse[0] &= ~0x1c; - 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; + if(arg[1] > 0xff) + key->code.mouse[1] = 0xff; + else + key->code.mouse[1] = arg[1]; + + if(arg[2] > 0xff) + key->code.mouse[2] = 0xff; + else + key->code.mouse[2] = arg[2]; + + key->code.mouse[3] = (cmd == 'm'); *nbytep = csi_len; return TERMKEY_RES_KEY; === modified file 't/30mouse.c' --- t/30mouse.c 2012-04-12 16:02:45 +0000 +++ t/30mouse.c 2012-04-11 23:19:10 +0000 @@ -10,7 +10,7 @@ char buffer[32]; size_t len; - plan_tests(60); + plan_tests(58); /* vt100 doesn't have a mouse, we need xterm */ tk = termkey_new_abstract("xterm", 0); @@ -126,14 +126,6 @@ is_int(ev, TERMKEY_MOUSE_RELEASE, "mouse event for release SGR"); - termkey_push_bytes(tk, "\e[<0;500;300M", 13); - - termkey_getkey(tk, &key); - termkey_interpret_mouse(tk, &key, &ev, &button, &line, &col); - - is_int(line, 300, "mouse line for press SGR wide"); - is_int(col, 500, "mouse column for press SGR wide"); - termkey_destroy(tk); return exit_status(); === modified file 'termkey.c' --- termkey.c 2012-04-12 16:02:45 +0000 +++ termkey.c 2012-04-11 23:19:10 +0000 @@ -912,10 +912,10 @@ *button = 0; if(col) - *col = (unsigned char)key->code.mouse[1] | ((unsigned char)key->code.mouse[3] & 0x0f) << 8; + *col = (unsigned char)key->code.mouse[1]; if(line) - *line = (unsigned char)key->code.mouse[2] | ((unsigned char)key->code.mouse[3] & 0x70) << 4; + *line = (unsigned char)key->code.mouse[2]; if(!event) return TERMKEY_RES_KEY; @@ -954,7 +954,7 @@ if(button) *button = btn; - if(key->code.mouse[3] & 0x80) + if(key->code.mouse[3]) *event = TERMKEY_MOUSE_RELEASE; return TERMKEY_RES_KEY;