=== modified file 't/30mouse.c' --- t/30mouse.c 2012-04-05 17:54:30 +0000 +++ t/30mouse.c 2012-04-05 16:57:13 +0000 @@ -10,7 +10,7 @@ char buffer[32]; size_t len; - plan_tests(31); + plan_tests(20); /* vt100 doesn't have a mouse, we need xterm */ tk = termkey_new_abstract("xterm", 0); @@ -27,7 +27,6 @@ is_int(button, 1, "mouse button for press"); is_int(line, 1, "mouse line for press"); is_int(col, 1, "mouse column for press"); - is_int(key.modifiers, 0, "modifiers for press"); len = termkey_strfkey(tk, buffer, sizeof buffer, &key, 0); is_int(len, 13, "string length for press"); @@ -46,7 +45,6 @@ is_int(button, 1, "mouse button for drag"); is_int(line, 1, "mouse line for drag"); is_int(col, 2, "mouse column for drag"); - is_int(key.modifiers, 0, "modifiers for press"); termkey_push_bytes(tk, "\e[M##!", 6); @@ -56,22 +54,6 @@ is_int(ev, TERMKEY_MOUSE_RELEASE, "mouse event for release"); is_int(line, 1, "mouse line for release"); is_int(col, 3, "mouse column for release"); - is_int(key.modifiers, 0, "modifiers for press"); - - termkey_push_bytes(tk, "\e[M0++", 6); - - termkey_getkey(tk, &key); - is_int(termkey_interpret_mouse(tk, &key, &ev, &button, &line, &col), TERMKEY_RES_KEY, "interpret_mouse yields RES_KEY"); - - is_int(ev, TERMKEY_MOUSE_PRESS, "mouse event for Ctrl-press"); - is_int(button, 1, "mouse button for Ctrl-press"); - is_int(line, 11, "mouse line for Ctrl-press"); - is_int(col, 11, "mouse column for Ctrl-press"); - is_int(key.modifiers, TERMKEY_KEYMOD_CTRL, "modifiers for Ctrl-press"); - - len = termkey_strfkey(tk, buffer, sizeof buffer, &key, 0); - is_int(len, 15, "string length for Ctrl-press"); - is_str(buffer, "C-MousePress(1)", "string buffer for Ctrl-press"); termkey_destroy(tk); === modified file 'termkey.c' --- termkey.c 2012-04-05 17:54:30 +0000 +++ termkey.c 2012-03-08 21:31:16 +0000 @@ -894,10 +894,7 @@ key->code.mouse[0] = CHARAT(0) - 0x20; key->code.mouse[1] = CHARAT(1) - 0x20; key->code.mouse[2] = CHARAT(2) - 0x20; - - key->modifiers = (key->code.mouse[0] & 0x1c) >> 2; - key->code.mouse[0] &= ~0x1c; - + key->modifiers = 0; *nbytep = 3; return TERMKEY_RES_KEY; } @@ -925,14 +922,12 @@ int drag = code & 0x20; - code &= ~0x3c; - - switch(code) { + switch(code & ~0x20) { case 0: case 1: case 2: *event = drag ? TERMKEY_MOUSE_DRAG : TERMKEY_MOUSE_PRESS; - btn = code + 1; + btn = (code & ~0x20) + 1; break; case 3: @@ -943,7 +938,7 @@ case 64: case 65: *event = drag ? TERMKEY_MOUSE_DRAG : TERMKEY_MOUSE_PRESS; - btn = code + 4 - 64; + btn = (code & ~0x20) + 4 - 64; break; default: